<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic VLPS Wakeup ISR + FreeRTOS xTaskNotifyFromISR Issue on S32K144 in S32K</title>
    <link>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201694#M54310</link>
    <description>&lt;P&gt;Hello NXP Team,&lt;/P&gt;&lt;P&gt;I am working with the S32K144 MCU using FreeRTOS and implementing Very Low Power Stop (VLPS) mode. I have a GPIO switch on PORTB intended to wake the MCU and notify a FreeRTOS task.&lt;/P&gt;&lt;P&gt;Setup:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;GPIO switch connected to PORTB.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;ISR triggers on switch press.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Using xTaskNotifyFromISR to notify a FreeRTOS task.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;FreeRTOS configuration:&lt;BR /&gt;configPRIO_BITS = 4&lt;BR /&gt;configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY = 0x01&lt;BR /&gt;configMAX_SYSCALL_INTERRUPT_PRIORITY = (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY &amp;lt;&amp;lt; (8 - configPRIO_BITS))&lt;BR /&gt;configKERNEL_INTERRUPT_PRIORITY = 255&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ISR and NVIC configuration:&lt;BR /&gt;PORTB-&amp;gt;ISFR = (1U &amp;lt;&amp;lt; SWITCH_PIN_NUMBER) // Clear interrupt flag for switch pin&lt;BR /&gt;INT_SYS_SetPriority(PORTB_IRQn, SWITCH_IRQ_PRIORITY)&lt;BR /&gt;INT_SYS_EnableIRQ(PORTB_IRQn)&lt;/P&gt;&lt;P&gt;void PORTB_IRQHandler(void) {&lt;BR /&gt;BaseType_t xHigherPriorityTaskWoken = pdFALSE;&lt;BR /&gt;if (PORTB-&amp;gt;ISFR &amp;amp; (1U &amp;lt;&amp;lt; SWITCH_PIN_NUMBER)) {&lt;BR /&gt;PORTB-&amp;gt;ISFR = (1U &amp;lt;&amp;lt; SWITCH_PIN_NUMBER) // Clear interrupt flag&lt;BR /&gt;uint32_t switch_state = (((PINS_DRV_ReadPins(PTB) &amp;gt;&amp;gt; SWITCH_PIN_NUMBER) &amp;amp; 0x01) == 0) ? SWITCH_ON : SWITCH_OFF&lt;BR /&gt;xTaskNotifyFromISR(hmainTask, switch_state, eSetBits, &amp;amp;xHigherPriorityTaskWoken)&lt;BR /&gt;portYIELD_FROM_ISR(xHigherPriorityTaskWoken)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;vPortEnterCritical()&lt;BR /&gt;status_t ret = POWER_SYS_SetMode(0, POWER_MANAGER_POLICY_AGREEMENT)&lt;BR /&gt;if (ret == STATUS_SUCCESS) wakeupOccurred = true&lt;BR /&gt;vPortExitCritical()&lt;/P&gt;&lt;P&gt;Observed behavior:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;ISR priority = 0 (highest): MCU wakes from VLPS, but xTaskNotifyFromISR does not work.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;ISR priority = 1: xTaskNotifyFromISR works, but MCU does not wake from VLPS.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;My understanding:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Priority 0 interrupts cannot be masked by BASEPRI, so FreeRTOS APIs cannot be safely called.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;FreeRTOS APIs must be called from ISRs with priority &amp;gt;= configMAX_SYSCALL_INTERRUPT_PRIORITY.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;VLPS wakeup may require the highest-priority interrupt.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;What is the recommended pattern on the S32K144 to reliably wake the MCU from VLPS and safely notify a FreeRTOS task?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Is there a better approach provided by NXP?&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any guidance, reference examples, or best practices would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Pandiyan T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Nov 2025 08:52:08 GMT</pubDate>
    <dc:creator>Panidiyan_T</dc:creator>
    <dc:date>2025-11-10T08:52:08Z</dc:date>
    <item>
      <title>VLPS Wakeup ISR + FreeRTOS xTaskNotifyFromISR Issue on S32K144</title>
      <link>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201694#M54310</link>
      <description>&lt;P&gt;Hello NXP Team,&lt;/P&gt;&lt;P&gt;I am working with the S32K144 MCU using FreeRTOS and implementing Very Low Power Stop (VLPS) mode. I have a GPIO switch on PORTB intended to wake the MCU and notify a FreeRTOS task.&lt;/P&gt;&lt;P&gt;Setup:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;GPIO switch connected to PORTB.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;ISR triggers on switch press.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Using xTaskNotifyFromISR to notify a FreeRTOS task.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;FreeRTOS configuration:&lt;BR /&gt;configPRIO_BITS = 4&lt;BR /&gt;configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY = 0x01&lt;BR /&gt;configMAX_SYSCALL_INTERRUPT_PRIORITY = (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY &amp;lt;&amp;lt; (8 - configPRIO_BITS))&lt;BR /&gt;configKERNEL_INTERRUPT_PRIORITY = 255&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ISR and NVIC configuration:&lt;BR /&gt;PORTB-&amp;gt;ISFR = (1U &amp;lt;&amp;lt; SWITCH_PIN_NUMBER) // Clear interrupt flag for switch pin&lt;BR /&gt;INT_SYS_SetPriority(PORTB_IRQn, SWITCH_IRQ_PRIORITY)&lt;BR /&gt;INT_SYS_EnableIRQ(PORTB_IRQn)&lt;/P&gt;&lt;P&gt;void PORTB_IRQHandler(void) {&lt;BR /&gt;BaseType_t xHigherPriorityTaskWoken = pdFALSE;&lt;BR /&gt;if (PORTB-&amp;gt;ISFR &amp;amp; (1U &amp;lt;&amp;lt; SWITCH_PIN_NUMBER)) {&lt;BR /&gt;PORTB-&amp;gt;ISFR = (1U &amp;lt;&amp;lt; SWITCH_PIN_NUMBER) // Clear interrupt flag&lt;BR /&gt;uint32_t switch_state = (((PINS_DRV_ReadPins(PTB) &amp;gt;&amp;gt; SWITCH_PIN_NUMBER) &amp;amp; 0x01) == 0) ? SWITCH_ON : SWITCH_OFF&lt;BR /&gt;xTaskNotifyFromISR(hmainTask, switch_state, eSetBits, &amp;amp;xHigherPriorityTaskWoken)&lt;BR /&gt;portYIELD_FROM_ISR(xHigherPriorityTaskWoken)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;vPortEnterCritical()&lt;BR /&gt;status_t ret = POWER_SYS_SetMode(0, POWER_MANAGER_POLICY_AGREEMENT)&lt;BR /&gt;if (ret == STATUS_SUCCESS) wakeupOccurred = true&lt;BR /&gt;vPortExitCritical()&lt;/P&gt;&lt;P&gt;Observed behavior:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;ISR priority = 0 (highest): MCU wakes from VLPS, but xTaskNotifyFromISR does not work.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;ISR priority = 1: xTaskNotifyFromISR works, but MCU does not wake from VLPS.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;My understanding:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Priority 0 interrupts cannot be masked by BASEPRI, so FreeRTOS APIs cannot be safely called.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;FreeRTOS APIs must be called from ISRs with priority &amp;gt;= configMAX_SYSCALL_INTERRUPT_PRIORITY.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;VLPS wakeup may require the highest-priority interrupt.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;What is the recommended pattern on the S32K144 to reliably wake the MCU from VLPS and safely notify a FreeRTOS task?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Is there a better approach provided by NXP?&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any guidance, reference examples, or best practices would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Pandiyan T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 08:52:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201694#M54310</guid>
      <dc:creator>Panidiyan_T</dc:creator>
      <dc:date>2025-11-10T08:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: VLPS Wakeup ISR + FreeRTOS xTaskNotifyFromISR Issue on S32K144</title>
      <link>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201891#M54321</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/250965"&gt;@Panidiyan_T&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;If you could share the project I could test it on my side.&lt;/P&gt;
&lt;P&gt;Anyway,&amp;nbsp;FreeRTOS requires that ISRs calling FromISR APIs have a priority equal or lower than configMAX_SYSCALL_INTERRUPT_PRIORITY.&lt;/P&gt;
&lt;P&gt;Don't call vPortEnterCritical() before&amp;nbsp;POWER_SYS_SetMode().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 13:29:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201891#M54321</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2025-11-10T13:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: VLPS Wakeup ISR + FreeRTOS xTaskNotifyFromISR Issue on S32K144</title>
      <link>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201900#M54322</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/160001"&gt;@danielmartynek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response.&lt;/P&gt;&lt;P&gt;If I remove the vPortEnterCritical() call before POWER_SYS_SetMode(), the MCU does not actually enter VLPS mode — it transitions momentarily and then immediately wakes up.&lt;/P&gt;&lt;P&gt;Could you please suggest the correct or recommended approach to properly enter VLPS mode while running FreeRTOS?&lt;BR /&gt;If possible, could you also share an example or reference implementation demonstrating how to safely enter VLPS from a FreeRTOS task context?&lt;/P&gt;&lt;P&gt;Thank you for your support!&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Pandiyan T&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 13:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201900#M54322</guid>
      <dc:creator>Panidiyan_T</dc:creator>
      <dc:date>2025-11-10T13:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: VLPS Wakeup ISR + FreeRTOS xTaskNotifyFromISR Issue on S32K144</title>
      <link>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201946#M54323</link>
      <description>&lt;P&gt;I haven’t found any official example combining FreeRTOS and VLPS.&lt;BR /&gt;From what I see, the wake-up issue is likely caused by SysTick still running.&lt;BR /&gt;Try disabling SysTick right before calling POWER_SYS_SetMode() to enter VLPS.&lt;/P&gt;
&lt;P&gt;Keep in mind:&lt;/P&gt;
&lt;P&gt;In VLPS, the SysTick timer is disabled because the core clock is gated.&lt;BR /&gt;However, if you have a debugger connected, the MCU does not enter true VLPS; instead, it goes into an emulated STOP mode.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_0-1762786752586.png" style="width: 509px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/364718iEB24FCE522089057/image-dimensions/509x220?v=v2" width="509" height="220" role="button" title="danielmartynek_0-1762786752586.png" alt="danielmartynek_0-1762786752586.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Additionally, the FreeRTOS port.c already provides a weak implementation of&amp;nbsp;vPortSuppressTicksAndSleep().&lt;/P&gt;
&lt;P&gt;It stops SysTick during idle.&lt;BR /&gt;Calculates reload values for the next tick.&lt;BR /&gt;Executes __WFI().&lt;BR /&gt;Calls two hooks: configPRE_SLEEP_PROCESSING() configPOST_SLEEP_PROCESSING()&lt;/P&gt;
&lt;P&gt;This is&amp;nbsp;a weak implementation, it can be overwritten by your own implementation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Tue, 11 Nov 2025 07:42:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2201946#M54323</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2025-11-11T07:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: VLPS Wakeup ISR + FreeRTOS xTaskNotifyFromISR Issue on S32K144</title>
      <link>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2202548#M54362</link>
      <description>Hi Daniel,&lt;BR /&gt;&lt;BR /&gt;After disabling the SysTick timer before calling POWER_SYS_SetMode(), the system is now entering VLPS successfully without using vPortEnterCritical().&lt;BR /&gt;Also, the wake-up and notify-from-ISR mechanisms are both working together as expected.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your guidance!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Pandiyan</description>
      <pubDate>Tue, 11 Nov 2025 08:26:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/VLPS-Wakeup-ISR-FreeRTOS-xTaskNotifyFromISR-Issue-on-S32K144/m-p/2202548#M54362</guid>
      <dc:creator>Panidiyan_T</dc:creator>
      <dc:date>2025-11-11T08:26:00Z</dc:date>
    </item>
  </channel>
</rss>

