I am developing along STM32F407VGT on STM32F4-Discovery board.
I have one thread which continuously fills a double DMA buffer where the DMA moves data from memory to a GPIO peripheral at very high frequency. I have a DMA ISR every 570 uS.
I have another function, called from the shell, which uses chprintf() and writes characters to a stream managed by the SERIAL driver (SD3).
If I execute this function, very soon the OS gets stuck at SV#8 error. This happens during the DMA ISR at the state check __dbg_check_enter_isr().
Code: Select all
/**
* @brief DMA2 stream 1 shared interrupt handler.
*/
OSAL_IRQ_HANDLER(STM32_DMA2_CH1_HANDLER) {
uint32_t flags;
OSAL_IRQ_PROLOGUE(); <===== OS GET STUCK HERE =====
flags = (DMA2->LISR >> 6U) & STM32_DMA_ISR_MASK;
DMA2->LIFCR = flags << 6U;
if (dma.streams[9].func)
dma.streams[9].func(dma.streams[9].param, flags);
OSAL_IRQ_EPILOGUE();
}
This is the stack trace:
Thread #1 (Suspended : Signal : SIGINT:Interrupt)
chSysHalt() at chsys.c:232 0x80015ae
__dbg_check_enter_isr() at chdebug.c:220 0x8001940
Vector124() at stm32_dma.c:329 0x8003c9e
<signal handler called>() at 0xfffffffd
chSchGoSleepS() at chschd.c:313 0x800231c
chSchGoSleepTimeoutS() at chschd.c:374 0x80023c2
chThdEnqueueTimeoutS() at chthreads.c:879 0x8002418
osalThreadEnqueueTimeoutS() at osal.h:895 0x800453e
oqPutTimeout() at hal_queues.c:546 0x800453e
_put() at hal_serial.c:64 0x80045cc
chvprintf() at chprintf.c:329 0x800279a
chprintf() at chprintf.c:371 0x800279a
render_dump() at eeprom_shell.c:65 0x8002f22
do_dump() at eeprom_shell.c:88 0x8002f22
argparse_getvalue() at argparse.c:149 0x8003172
parse_short_opt() at argparse.c:181 0x80031d2
ARGPARSE_Parse() at argparse.c:313 0x8003274
EEPROM_Shell() at eeprom_shell.c:126 0x8003460
cmdexec() at shell.c:106 0x80051ae
shellThread() at shell.c:405 0x80051ae
__port_thread_start() at chcoreasm.S:203 0x80002fe
I had to manage this error already several times, all those times when I forgot to use the I-class API. But this time I can't figure out what I am doing wrong.
If I get SV#8 it probably means I am missing some chSysLock() during the chprintf(), but I supposed this was already managed in the stream object.
Thanks in advance for any hint.