-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeed-Studio LoRa-E5-Mini LoRaWAN OTAA timeout #844
Comments
Seems likely, considering that the E5 board only seems to have two RF switch control pins instead of the 3 used by Nucleo STM32WL. So it would suggest it does not have the high-power/low-power transmit modes of the original STM32WL (and therefore you would have to modify the rfswitch_table), but that's just a guess on my side, probably best to clarify with the manufacturer. Another thing is that I haven't tested against chirpstack, just TTN. Should be noted that in TTN, for US-915 frequencies you have to select a subset of all the available channels to be used. Is that also the case in chirpstack? Also, maybe try eanbling debug mode if there is more information. |
Here is a JoinRequest and JoinAccept from Chirpstack: |
Also, from an example provided by STM32CubeIDE I was able to figure out the RFSwitchTable, but it didn't seem to help yet. I am still using PA0 as a placeholder since RadioLib expects the table to have 3 pins - changing RFSWITCH_MAX_PINS to 2 does not compile, there are parts of the library that still expect 3 values. static const uint32_t rfswitch_pins[] = {PA4, PA5, PA0}; static const Module::RfSwitchMode_t rfswitch_table[] = { |
You're not meant to change the value of Lines 492 to 506 in ddcce42
Regarding the join request, I think this is the issue:
If I'm reading that correctly, it seems like your gateway/application server has decided to send the join accept reply at 925.1 MHz, which is downlink channel 3. However, the node used uplink at 905.1 MHz, channel number 14. So the downlink channel should have been 14 % 8 = 6, not 3. |
I enabled debug printing and see the following: /////////////////////////////////////////////////////////////////////////// [SX1278] Initializing ... GPIO pre-transfer timeout, is it connected? RadioLib Debug Info Found SX126x: RADIOLIB_SX126X_REG_VERSION_STRING: M SX126x ////////////////////////////////////////////////////////////////////////////////////////////////// I cannot find where "GPIO pre-transfer timeout, is it connected?" is printed from, but it seems like that may be an initialization thing since it eventually is cleared. What I also cannot figure out is why the channels and frequencies are not printing, my thought is that maybe the RX channel is not being properly set? Any thoughts on where I can add a debug statement to investigate? |
The GPIO timeouts are checked here: Lines 311 to 330 in ddcce42
It's very strange, since that message usually means the user provided incorrect BUSY pin number or there's a wiring issue. On STM32WL, this should be handled by the SX126x peripheral. The missing frequency in debug is most likely caused by the STM32 Arduino core not supporting printf for floats (I got so used to ESP32 doing that I completely forgot other platforms might not be able to do so). Anyway I updated the debug printing to fix this, could you try again? Another strange thing is that after the uplink, the debug should print downlink frequency, if that doesn't happen then the program never reached that point at all. |
The printing of floats now works I added some timestamps (ms) and debug messages to the beginOTAA function, here is the result of single attempt: ////////////////////////////////////////////////////////// //start a timer to inlcude with the debug print statments //print the timestamp and the action RADIOLIB_DEBUG_PRINTLN("%lu: Setting uplink/downlink frequencies and datarates...", mod->hal->millis() - debugstart); RADIOLIB_DEBUG_PRINTLN("%lu: Configuring devNonce...", mod->hal->millis() - debugstart); // build the join-request message RADIOLIB_DEBUG_PRINTLN("%lu: Building join request message...", mod->hal->millis() - debugstart); // add the authentication code RADIOLIB_DEBUG_PRINTLN("%lu: Sending join request...", mod->hal->millis() - debugstart); RADIOLIB_DEBUG_PRINTLN("%lu: Configuring Downlink channel...", mod->hal->millis() - debugstart); // set the function that will be called when the reply is received // downlink messages are sent with inverted IQ RADIOLIB_DEBUG_PRINTLN("%lu: Starting receive...", mod->hal->millis() - debugstart); RADIOLIB_DEBUG_PRINTLN("%lu: Waiting for join accept...", mod->hal->millis() - debugstart); |
I found the issue!!! // set the function that will be called when the reply is received the phyLayer was calling the SX126x.h setDio1Action rather than the STM32WLx.h one. |
@davidfobar you're right, for STM32WLx the interrupt will indeed not work. The problem was that the methods like |
How do you enable DEBUG logging? |
@gpabdo #define RADIOLIB_DEBUG I've then added my own debug statements with |
Thanks so much! |
To help further my MIC mismatch issue, this is the key reported by both the server and end node: I don't understand why there is a downlink to begin with, chirpstack is reporting the hello world message is unconfirmed, and I am not attempting to send anything either. |
@davidfobar when exactly is this issue appearing? Is it during the join procedure or afterwards? The downlink shown in the screenshot seems to be empty apart from a RekeyInd command. But the format of that command is invalid, as it sets the minor version to 0, which is reserved by the LoRaWAN specification. |
it is only after joining is complete. I have the end node looping and sending incremental hello world messages and then looking for a downlink message. I can get the uplink message out of chirpstack without issue. I am now trying to make sure that I can send messages back to the endnode, but I saw this issue first. |
Which LoraWAN version is chirpstack configured for? It's sending a RekeyInd MAC command, so I would guess it's 1.1, but you didn't specify it. |
I have the device profile configured for 1.1, other options are available, but of course this was the only configuration that would all RadioLIB to connect without a MIC issue using the end node example. |
Then it is rather strange that chirpstack sends RekeyInd with revision set to 0. MIC calculation changed quite a lot across different LoRaWAN versions, so if there is some mismatch there it could cause this issue. I'm confident it's correct on RadioLib end, since I've tested extensively against TTN on v1.1.
It's just the MAC command being sent from server to the node without any user data, that's not uncommon. |
Updating to chirpstack v4 resolved the RekeyInd MAC command. Thank you for adding support for the STM32wle5 interrupts. I will continue my discussion with bad downlink MICs in a new issue. |
Using the E5 dev board (https://www.seeedstudio.com/LoRa-E5-mini-STM32WLE5JC-p-4869.html), I can get chirpstack to recieve a JoinRequest and issue a JoinAccept however RadioLib provides a timeout error (-6).
I don't know if I am setting the RFSwitches correctly:
////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
The remainder of the STM32WLx_Transmit_Interrupt.ino code is unchanged.
Serial terminal output:
///////////////////////////////////////////////////////////////////////////////////////////
Is this a RF Switch issue?
The text was updated successfully, but these errors were encountered: