2020-06-30 05:10 AM
Hello,
Context:
Problem:
When no data is received on UART, SPI is working properly. If one of my task is using SPI to write to the flash (for example), while data is received through UART (and so the UART interruption called), an Hardfault is generated.
Also, I'm forced to use SPI at less than 8Mbits/s (doesn't work at 16Mbit/s) and I don't know why..
I've already checked stacks (of the mcu and freeRTOS tasks) and they seemed alright.
I noticed that SPI1 and USART1 share the same peripheral bus (I don't know if it is revelant)
Do you have any idea of where does it could come from?
Thank you,
Charles B.
2020-06-30 05:27 AM
Perhasp FreeRTOS has some mean to get a backtrace in the hardfault handler. Try to activate to get more information.
2020-06-30 05:31 AM
Is USART1 working without SPI activity ?
I guess you have nested interrupts enabled. Did you reserve enough main stack (usually defined by linker script) for potentially nested ISRs ?
Did you define some of the very helpful FreeRTOS debug support macros like configASSERT, configCHECK_FOR_STACK_OVERFLOW including vApplicationOverflowHook, etc. ?
2020-06-30 09:13 AM
USART1 is working without SPI activity.
I have tried to use SPI polling instead of SPI IT and it still doesn't work.
It seems that my UART interrupt callback is too long (but I'm just filling one charactere in a buffer, so that's sad.. :( )
I've enabled freeRTOS debug support and there is no stack overflow.
I need to work on my UART interruption to avoid nested calls.
Thank you for your help!
Charles