Part Number: CC2640
Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hello,
I've been chasing a very strange bug for a while now and do not think I'm going to be able to track it down on my own. The product I'm working on uses a CC2640 and the application was initially based off of the simple_peripheral example. We are running BLE SDK version 2.2, TI-RTOS version 2.18 w/SYS/BIOS version 6.45.
First, a little background on what led to the issue. I recently implemented a custom OTA firmware upgrade scheme for the CC2640. It borrows heavily from TI's version of OAD, and uses the same external flash / SPI drivers. The main difference is I've implemented custom characteristics within our own BLE service to handle the data transfer and control, rather than using TI's OAD service. I've thoroughly tested my OTA implementation and it is stable. It's probably worth noting that we're using SPI1, rather than SPI0 for communicating with the external flash. After completing the OTA work I I enabled the watchdog on the CC2640. I am configuring the watchdog directly through the inline functions in #include <driverlib/watchdog.h>. The watchdog functionality seems to work fine, I've intentionally inserted code to trip the watchdog and everything works as expected. However, when I have the watchdog feature enabled and attempt to do an over-the-air update I get an exception. I've stretched out the watchdog timer to insure that there aren't issues with the watchdog not being serviced during the OTA. My gut feeling is it's some kind of stack or heap overflow type of problem. I've tried adjusting the HWI stack, task stack, ICall heap, and BIOS heap sizes to no avail. I've done a lot of inspection of the raw memory before/after the exception trips and haven't been able to locate any overflows. I've also been trying to use the ROV tool to narrow down the issue, but haven't had any luck and am getting some strange/unexpected data out of the tool.
When I attempt to kick off an OTA session my application attempts to open the external flash and read out image information just like TI's OAD implementation. An exception gets tripped in the ExtFlash_open();. I've traced the exception to the first time this function tries to write to SPI, specifically where the SPICC26XXDMA_transfer() calls Semaphore_pend() on line 866:
if (!Semaphore_pend(Semaphore_handle(&(object->transferComplete)), object->transferTimeout))
This function trips an exception. I've tried loading the RTOS ROM symbols to trace into Semaphore_pend, but it's hard to follow and hasn't led me to the issue. Here are some screenshots and comments from the ROV:
Task Stacks at time of exception:
Exception details: (I also checked the CFSR both at entry to my exception handler, and at entry to the exception handler in ROM, all 0's both times...I don't understand whats raising the exception)
Tried to use the "Scan for errors feature" but it generated and error.....
I'm guessing whatever is causing the above is also related to why I can't monitor the system stack in ROV:
I'll be trying to reproduce the issue with the watchdog disabled so that I can rule that out, but I am running out of ideas for ways to try to trace this issue, any help is much appreciated.
Best Regards,
Josh M
