SV#8 happens on different IRQ only after starting this thread and some calls of HAL or RT sleep/VT from this thread, which leads to SV#8 at ST, SPI DMA or SD.
System works stable without this thread, so I am trying to find out what is wrong with thread creation code from this topic: viewtopic.php?f=24&t=4471
In any case there is "priority order violation" error.
1. If create thread with HIGHPRIO using chThdCreateI and call chSchWakeupS system halts with: "priority order violation" 2. If do not call chSchWakeupS system halts on chSysUnlock with: "priority order violation" 3. If create thread with HIGHPRIO using chThdCreateI and call chSchRescheduleS(), system will be halted later with chSysHalt("SV#8")
How to create thread correctly using chThdCreateI?
/** * @brief Creates a new thread into a static memory area. * @details The new thread is initialized and make ready to execute. * @post The created thread has a reference counter set to one, it is * caller responsibility to call @p chThdRelease() or @p chthdWait() * in order to release the reference. The thread persists in the * registry until its reference counter reaches zero. * @note A thread can terminate by calling @p chThdExit() or by simply * returning from its main function. * * @param[out] tdp pointer to the thread descriptor * @return The pointer to the @p thread_t structure allocated for * the thread into the working space area. * * @iclass */ thread_t *chThdCreate(const thread_descriptor_t *tdp) { thread_t *tp;