AnsweredAssumed Answered

I can't return the tasks when wake up from VLPS in freertos

Question asked by Jinwon Kang on May 1, 2019
Latest reply on May 8, 2019 by Jinwon Kang

Hello, everyone.

I'm jinwon.

 

I'm using the following environment.

 S32K144,

 Compiler : IAR 8.30.1

 SDK :  3.0.0 RTM SDK.

 FreeRTOS v10.0.1

 

I switched to VLPS mode with POWER_SYS_SetMode api and wake up to RUN mode with GPIO interrupt.

Interrupt is well work, but I can not return to run Tasks.

 

void vApplicationIdleHook( void )
{

       // Check sleep condition

      if( POWER_STATUS_SLEEP ) {
         power_mode = POWER_SYS_GetCurrentMode();
         if( power_mode != POWER_MANAGER_VLPS ) {

                 // Change FlexCAN mode to disable mode

               FLEXCAN_DRV_Init(AMTEL_UDSCAN_INSTANCE, &canCom0_State, &canCom0_InitConfigDisable /*&canCom0_InitConfigFreeze*/ );

               // Setting GPIO interrupt

               INT_SYS_InstallHandler( PORTB_IRQn, &ISR_WakeUp_CAN_RX_PIN, (isr_t *)0 );
               PINS_DRV_SetPinIntSel( PORTB, 4U, PORT_INT_FALLING_EDGE );
               INT_SYS_EnableIRQ( PORTB_IRQn );

               status = POWER_SYS_SetMode( CONF_POWER_MANAGER_VLPS, POWER_MANAGER_POLICY_FORCIBLE );
               if( status == STATUS_SUCCESS ) {

                }

         }

      }

 

      // After entry VLPS mode, I can never reach here.

}

 

void ISR_WakeUp_CAN_RX_PIN(void)
{
      uint32_t CanRX_pin = PINS_DRV_GetPortIntFlag(PORTB) & (1 << 4U);

 

      if(CanRX_pin != 0)
      {
         PINS_DRV_ClearPinIntFlagCmd(PORTB, 4U);

         // I checked that this code reached here.
         status = POWER_SYS_SetMode( CONF_POWER_MANAGER_RUN, POWER_MANAGER_POLICY_FORCIBLE );
         if( status == STATUS_SUCCESS ) {

               // It's not reach here.

               // Return value is STATUS_TIMEOUT
          }

 

            INT_SYS_DisableIRQ(PORTB_IRQn);

             FLEXCAN_DRV_Init(AMTEL_UDSCAN_INSTANCE, &canCom0_State, &canCom0_InitConfigNormal);

              // After here, I can't run main task.
      }

}

 

How I can work more? Could you help me, please ?

Outcomes