Software hangs up in hardfault - may be due to very fast interrupts?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Software hangs up in hardfault - may be due to very fast interrupts?

589 Views
mahesh3
Contributor III

Hello Community,

I am trying to interact with an external SPI ADC using IMXRT1051 on a custom board.

Below is the block diagram of the hardware.


block diagram.png

I am using FreeRTOS to build the application. Below is the block diagram of the software.

software-diagram.png

The ADC is generating interrupts on the DRDY pin at a rate of 16KHz. A GPIO interrupt gets triggered on the DRDY falling edge and raises an event via a binary semaphore. The ADC task performs an SPI polling read transaction. It does some processing and generates result on the logging UART (LPUART1) and on the communication UART (LPUART2).

The problem that I am facing is if I run ADC task + logging task, things are working fine. If I run communication task + logging task still things work good. Once all three are running I start getting hardfaults at random locations.

The hardfault occurs consistently after some 30 - 31 communication request packets arrive.
I am posting this here just to understand is this a good way to design the application. Can IMXRT handle so many interrupts at this rate?


I tried increasing the system stack size from the managed linker script section from 0x4000 to 0x8000 to even 0x10000 but still I do not see any change in the behavior.
I have tried experimenting even with the task stack sizes and I am sure that it is not overflowing. (I am printing the task stack utilization on the log UART and I am also using the vApplicationStackOverflowHook() to catch a stack overflow but both are clean).
I have also set correct interrupt priorities so that it is safe to call FreeRTOS APIs.

Please let me know your thoughts. I am using MCUXpresso for development.

Labels (1)
0 Kudos
Reply
2 Replies

495 Views
nxf77486
NXP TechSupport
NXP TechSupport

Hello,

 

Thank you for contacting NXP support.

So I understand that when you work o pairs you do not face ay troubles ( communication task + logging task / task + logging task). Can you please share with me the Stack Size of the FreeRTOS tool on the MCUXpresso.

Also please help me verify the following macro value (this could affect the management of the task if it is less of the quantity of tasks.

configMAX_PRIORITIES

 

0 Kudos
Reply

564 Views
mahesh3
Contributor III

I solved the issue. It had no relation with fast interrupts. The cause was a buffer overflow.
I am still letting this post stay because I want to hear from other if there are any better methods to do what I am doing.

Thanks,

Mahesh Murty

0 Kudos
Reply