What if your program crashes just because it tried to talk inside an interrupt the wrong way?
Why ISR-safe API functions (FromISR suffix) in FreeRTOS? - Purpose & Use Cases
Imagine you have a program that reacts to hardware events like button presses or sensor signals. These events happen anytime, and your program must respond quickly. If you try to update shared data or send messages from these event handlers (called Interrupt Service Routines or ISRs) using normal functions, things can go wrong.
Using regular functions inside ISRs can cause your program to freeze or crash because those functions might wait for resources or disable interrupts, which is not allowed during an interrupt. This makes your system unreliable and hard to debug.
FreeRTOS provides special ISR-safe API functions with the suffix 'FromISR' designed to be called safely inside ISRs. These functions avoid waiting or blocking and handle critical sections properly, so your program stays stable and responsive.
xQueueSend(queue, &data, portMAX_DELAY);
xQueueSendFromISR(queue, &data, &higherPriorityTaskWoken);
It allows your program to safely communicate and synchronize between interrupts and tasks without risking crashes or delays.
When a sensor triggers an interrupt, you can quickly send its data to a processing task using 'FromISR' functions, ensuring the system stays fast and stable.
Normal API calls can cause problems inside interrupts.
'FromISR' functions are specially made to be safe in ISRs.
Using them keeps your system reliable and responsive.