-
Notifications
You must be signed in to change notification settings - Fork 2k
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
LoRaWan node ISR stack overflowed #14962
Comments
The code you are mentioning is from Loramac-node, right ?
Where do you add that code ? in |
I did add the code in $RIOTBASE/pkg/semtech-loramac/contrib/semtech-loramac.c
Can I use LoRaMac-node version 4.4.4 code in RIOT?I modified PKG_VERSION to 4.4.4, but the compilation failed.The branch I use is 2020.01-branch. |
Adapting the package to loramac-node 4.4.4 is quite some work since this project doesn't use a standard numbering for their release (4.4.1 => 4.4.2 reorganizes a lot of files, refactor some large part of the code, etc). So they are not patch versions... |
Since my node needs to enter the sleep mode during the working process, I cannot solve the above problems through watchdog. Do you have any good suggestions for the information I provided above? |
What is the platform you are using ? STM32,SAM0 ? |
I am using stm32l151cc platform |
@fjmolinas has a good knowledge on L1 so maybe we has an intuition on what could be the cause ? |
Can you test in a newer branch to see if the issue is still present?
Can you elaborate?
That means the issue is upstream right? @aabadie you mention updating the pkg is not a short term option, can you confirm this bug? Should we provide a patch in the meantime? |
I tested 2020.01-branch and 2020.04-branch, and they both have the same problem.
There are the following fragments in /bin/pkg/l151-lorawan/semtech-loramac/src/mac/LoRaMac.c.
There are the following fragments in $RIOTBASE/pkg/semtech-loramac/contrib/semtech-loramac.c
|
Could you please try the following patch (untested)? diff --git a/pkg/semtech-loramac/contrib/semtech_loramac.c b/pkg/semtech-loramac/contrib/semtech_loramac.c
index 0cd3a46b4f..368287f517 100644
--- a/pkg/semtech-loramac/contrib/semtech_loramac.c
+++ b/pkg/semtech-loramac/contrib/semtech_loramac.c
@@ -539,10 +539,16 @@ static void _semtech_loramac_event_cb(netdev_t *dev, netdev_event_t event)
case NETDEV_EVENT_RX_COMPLETE:
{
- size_t len;
+ int len;
uint8_t radio_payload[SX127X_RX_BUFFER_SIZE];
- len = dev->driver->recv(dev, NULL, 0, 0);
- dev->driver->recv(dev, radio_payload, len, &packet_info);
+ len = dev->driver->recv(dev, radio_payload, SX127X_RX_BUFFER_SIZE, &packet_info);
+ if (len < 0) {
+ /* the RxError call will be handled by the NETDEV_EVENT_CRC_ERROR called inside the recv function */
+ break;
+ }
semtech_loramac_radio_events.RxDone(radio_payload,
len, packet_info.rssi,
packet_info.snr);
Let me know if that works. |
I actually found the issue. We have 2 problems:
The semtech pkg expects the NETDEV_EVENT_RX_COMPLETE event to be "a frame was received and the CRC was OK", and the NETDEV_EVENT_CRC_ERROR to be "a frame was received but the CRC failed. So, the glue code should either call
Overall, the snippet in #14962 (comment) should solve the issue. For mid term, we should probably move out the NETDEV_EVENT_CRC_ERROR from the |
Still, the |
@jia200x
|
It seems the MAC got stuck when receiving a Proprietary frame (or something went wrong that made the stack believe that there was a Proprietary frame). I will dig deeper. FYI, RIOT also has it's own implementation of LoRAWAN (GNRC LoRaWAN). @MichelRottleuthner has been running a low power application for several months with that one. Maybe you could try that one in the meantime? Anyway, I will investigate this problem. |
@jia200x |
@jia200x any progress on this one ? |
We should still keep this one open |
Not yet, I will try to go back to this ASAP |
Ping? |
Description
LoRaWan node ISR stack overflowed, when receiving error
Steps to reproduce the issue
Set the LoRaWan node to sleep mode, wake up the node every 20s, join and send data after wake-up, and then sleep. If the node repeats this process for a long time, When LoRaWan receives error, it will cause ISR stack overflowed
Actual results
This is the context information after node failure
Cause Analysis
I found that in the following code, the length of the array LoRaMacRxPayload[LORAMAC_PHY_MAXPAYLOAD] is 255, but the parameter size may have an error value greater than 255
So I added the following code, when the function is called.
But when I continued to test under the above conditions, I found that when running the test for a long time, my LoRaWan node sometimes fell into an infinite loop. The abnormal phenomenon is that the sleep mode cannot be entered again, and there is no debugging information output.
Versions
RIOT Branch
2020.01-branch
Operating System Environment
Installed compiler toolchains
xtensa-esp8266-elf-gcc: missing
clang: missing
Installed compiler libs
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-esp8266-elf-newlib: missing
avr-libc: missing (missing)
Installed development tools
The text was updated successfully, but these errors were encountered: