-
Notifications
You must be signed in to change notification settings - Fork 429
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
ESP32 heap corruption in CC1101_Receive_Address example #839
Comments
Just a note - i've also tried it on a newer esp32 board with same result, and on an esp32-c3 (which is riscV based) with a very similar result:
(No debugging this time, sorry) |
Looking at the debug output, it looks like it receives a "packet", attempts to retrieve its length which is larger than should be possible, hence some overflow and then the crash. Is something transmitting? |
I mean, it's possible? As far as I know, I'm not transmitting anything. Also, I get the same behavior when I disconnect the antenna... |
I've seen spurious packet detection on the CC1101 in the past, it is possible this happening again so I will investigate. Unfortunately I currently don't have access to the hardware, so it will take me a couple of days to get to this. |
Had some time to investigate, it looks like that after power up, the device will trigger an "packet received" interrupt, despite the fact there is no packet received. The ISR runs and tries to read the packet from the FIFO, which at that point contains random data - hence the impossible packet length and on ESP32, heap corruption exception. I think the root cause has something to do with the GDO0 on CC1101 being configured to output clock by default. RadioLib turns that off, but if the timing is wrong, it could trigger an interrupt before it is switched from clock to packet received. So far I was not able to resolve the issue, but I'll keep trying. |
Looks like this is caused by incorrect pakcet length read in blocking mode. I added a patch in the latest commit which should resolve this, but overall I would advise against using blocking receive in favor of interrupt-driver receive. |
IMPORTANT: Check the wiki
Before submitting new issue, please check the Wiki and the API documentation. You might find a solution to your issue there.
I checked the wiki just in case; didn't see anything.
Describe the bug
I built the
CC1101_Receive_Address
example because I'm new to RadioLib and the CC1101 module I'm using. When running the sketch on an ESP32 dev board, I see an assert about heap corruption (from the esp32 arduino code, I believe) and it reboots - then gets the assert again, reboots again, etc.(The ESP32 board is an old one - "ESP32 Devkit V1 www.doit.am", and I've marked it "Rev 0" which I believe is the revision of ESP32 and is probably buggy - though I don't think the bugs it has necessarily relate to this)
I rebuilt with debugging enabled, and the (large, sorry) output is here:
To Reproduce
Using RadioLib 6.2.0, and the CC1101_Receive_Address example sketch with ONLY the following line changed to reflect the pinout changes of CS, GDO0 and GDO2 connection on my module:
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
... built with PlatformIO with this in the
platformio.ini
file:Platformio is using this arduino-esp32 release: Arduino Release v2.0.11 based on ESP-IDF v4.4.5
Expected behavior
Expected some amount of output on console depending on the RF environment
Screenshots
If applicable, add screenshots to help explain your problem.
Additional info (please complete):
ESP32
Arduino Release v2.0.11 based on ESP-IDF v4.4.5
CC1101
Using PlatformIO, but with an Arduino 2.0.11 base
6.2.0
The text was updated successfully, but these errors were encountered: