Is it possible to use osDelay() between osKernelInitialize() and osKernelStart()?
I ran osMutexCreate () after osKernelInitialize (). Is it possible to use osMutexWait() before osKernelStart() next?
#I live in Japan so my English is not good.
The RTOS automatically switches when an event happens. An event could be a message, a timeout, etc. This is by design. This switching is not good if your code is initializing peripherals, or creating new threads. You need everything created and initialized first, so things will work properly when an event comes in.
It is oversimplified, but calling osKernelInitialize() pauses the RTOS ticks, and these ticks control timeouts, countdowns, timers for the RTOS. With the ticks paused, you can initialize things without interruption. When you are done initializing, start the RTOS running again by calling osKernelStart().
Calling osdelay() after osKernelInitialize() won't work, because (oversimplified) The RTOS Kernel paused sending out ticks. There are no incoming ticks for the osdelay() to countdown with.
Thank you for your reply. I understand that. I was satisfied with the reason why it was divided into two.Thank you very much.
View all questions in Keil forum