Other Parts Discussed in Thread: SYSBIOS
Hello
I am currently facing some HWI overflow inside SYSBIOS scheduler and I cannot understand what would cause it.
My development is handling SPI communication through McBSP module to an external component. This component acts as slave on the SPI bus and indicates that data are ready to be read with dedicated "data_ready" interrupt wired to GPIO19. The GPIO is configured as asynchronous input with pull up enabled.
With a simple implementation on bare-metal using PIE and while loop this works fine.
- HWI is configured using XINT to trigger some ISR that sets a flag and returns; IT is a pulse signal going low for ~20µs from 3.3V to 0V, issued periodically every 16ms.
- The state machine inside while loop is pending on flag set by Hwi (@16ms) then retrieve the data (6 * 32bits words) through SPI with SPICLOCK @500kHz and pend for next data_ready.
I aim at importing this feature on another project with Sysbios activated (this is not my first sysbios project and I reused some existing project that is working fine), and CPU running at 36MHz.
I kept configuration of the XINT on app side :
- GpioIntRegs.GPIOXINT3SEL.bit.GPIOSEL = GPIO19;
- XIntruptRegs.XINT3CR. bit.ENABLE = 1
The HWI is configured through SYSBIOS Hwi (ti.sysbios.family.c28) with IT number 120 (XINT_3).
- Automatically acknowledge IT option is selected.
- IT is disabled at startup, enabled inside code through Hwi_enableInterrupt(120) once configuration is completed.
- ISR function call is simplistic. As expected, I removed the interrupt keyword as well as any reference to PIE. I used to post semaphore inside this ISR but removed it to try to get to the bottom of my issue and replaced it with boolean flag bDataReady to TRUE.
On task side, my initial implementation was using a dedicated task with while loop and pending semaphore. It would end with the semaphore posted but the task preempted and sysbios lost in hwi scheduler.
To try to simplify this, I moved my function to Idle task with test on boolean flag bDataReady instead of semaphore to read data.
The symptom of my issue is as follows: as long as the HWI is disabled, everything runs smoothly. When I activate the HWI (Hwi_enableInterrupt(120) + XIntruptRegs.XINT3CR. bit.ENABLE) then the sysbios keep spending time inside the sysbios low level feature and does not manage to service my application.
Breakpoints inside my tasks are not reached anymore ; only the one inside the Hwi toggles.
When I hit the pause button, I end up inside sysbios features such as Hwi scheduler (Hwi__epilogue.h, Hwi.c or assembly related features).
I manage to restore proper behavior if I manually disable the XINT HWI inside the ISR and enable it back once data were retrieved.. but this does not seem really sane behavior. It would seem that the IT is not properly acknowledged.
I attempted to add some qualifier to the GPIO with no success.
I attempted to use the CPU load module from sysbios. It states in red 102 on the Hwi side.
What I am missing ? Is there some condition/configuration to ensure that sysbios properly ACK the XINT related Hwi ?
Thank you for your time and best regards,
Sebastien