SOLVED: LMIC on STM32F103 - Problems with Join

Hi all

I picked up one of the STM32F103C8T6 (LoRaM3-D V1.1) from BSFrance as mentioned here:
https://www.thethingsnetwork.org/forum/t/big-stm32-boards-topic/13391
after I found the 32u4 quite limited in memory with the rather big LMIC running. But it runs.

So, I tried, using Arduinio IDE, to make a TTN node out of it :slight_smile:

I checked several resources regarding STM32 and finally found that there is an Arduino core from the manufacturer (https://github.com/BSFrance/BSFrance-stm32)
I got this working after seeing errors and then manually copying all the arm-none… .exes in the subdirectory: BSFrance-stm32-master\stm32\tools\win\gcc\bin which seemed to have been missing. Only a .bat was present.
That worked ok.

Now, the LMIC gave me some more trouble:
Similar to the problem found here: (https://github.com/tftelkamp/arduino-lmic-v1.5/issues/5) the thing stopped working every time it reached the “os_init();” in my code.
I think(!) that the problem is with the disabling of the interrupts in radio_init() in radio.c (libraries\arduino-lmic-master\src\lmic)
First command to be found there is: “hal_disableIRQs();” which seems to disable the interrupts and the internal clock as well and the subsequent command “hal_waitUntil(…” waits forever.
I gave it a try and moved the “hal_disableIRQs();” to after the wait commands just in from of the “opmode(OPMODE_SLEEP);”
That seemed to do the trick. However I do not understand why this piece of code is OK with e.g. the 32u4. But well, different processors, different behaviours.

Additionally, from the datasheet I deducted that I need to make a connection from DIO1 to e.g. PA0 and make the pinmapping like that:
const lmic_pinmap lmic_pins = {
.nss = PA4,
.rxtx = LMIC_UNUSED_PIN,
.rst = PA2,
.dio = {PA3, PA0, LMIC_UNUSED_PIN},
};

Long story short, the code eventually compiled, starts, and sends a join request which I can see on my gateway console (yellow flash icon).
My gateway accepts the join (green flash icon).

BUT, the “join accept” seems to never be received or processed by the node.
The node continues the join requests over and over again.
It is not rebooting, it is just sitting and waiting and trying.

According to this post, I also added the clock error code:
LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100);
but it did not change anything.
Serial output is:
Packet queued
79985: EV_JOINING
nothing more…

So, now I am kind of stuck and do not really have an idea where to look next or start searching for the problem. I have no deeper understanding of how the LMIC works and what the problem could be.
Or even if some of my modifications cause the problem.
Maybe somebody got this LoRaM3-D to work with TTN and might give me a hint.

Thank you
Michael

Big STM32 boards topic

1 Like

To all future readers:
The solution can be found here:
https://www.thethingsnetwork.org/forum/t/big-stm32-boards-topic/13391/74

Thank you all for pointing me in the right direction.

2 Likes