S32k324 RTC wake up

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k324 RTC wake up

Jump to solution
999 Views
Prasad_330
Contributor III

hi,

I am using S32k324 controller,

I am trying to put the controller in sleep mode and waking up from the RTC.

I am able to put the controller into standby mode.

But the controller is not waking from Standby mode.

RTC-API is used to  wakeup controller.

I have also attached the stand-alone rtc wake up code.

Please let me know what modifications has to be done 

0 Kudos
Reply
1 Solution
968 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

Try to use this wake up config instead:


static inline void Rtc_Ip_SetCompareValue(uint8 instance, uint32 value)
{
    /* Set RTCVAL */
    rtcBase[instance]->RTCVAL = value;
}

void Wkup_Config(void)
{
	/* WKPU configuration */
	Wkpu_Ip_Init(WKPU_INST, &Wkpu_Ip_Config_PB);
	Wkpu_Ip_EnableInterrupt(WKPU_INST, 0);

	/* Init RTC and RTC_0_InitConfig_PB is config tool generated */
	Rtc_Ip_Init(RTC_INST, &RTC_0_InitConfig_PB);

	/* Disables the API functionality
       Clears the API interrupt flag*/
	Rtc_Ip_StopTimer(RTC_INST);

	Rtc_Ip_StartCounter(RTC_INST); 				/*<! Start the counter. */
	Rtc_Ip_SetCompareValue(RTC_INST, RTC_API_TIME);	/*<! Set counter value. */
	Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 0);
}

Also, make sure that SIRC is enabled in standby mode:

Julin_AragnM_0-1723136674936.png

Best regards,
Julián

View solution in original post

9 Replies
812 Views
Prasad_330
Contributor III

hi Julian_AragonM

I am working on s32k324 VLSR mode.

I have changed the clock to FIRC, But i am not able to make the CORE_CLK to 3MHZ.  Because the FIRC = 48MHZ  clock divider max value is only 8. so core clock = 48MHZ/8  is equal to 6MHZ.

How to change into 3MHZ.

I also wanted to know what are the module that can be used in the VLSR. I wanted use CAN and UART in VLSR mode.

how to change the "FlexCanProtocol clock" to 3MHZ

Can you plz help me out.

0 Kudos
Reply
798 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

You can select the frequency for Fast IRC from the Clocks Diagram:

Julin_AragnM_0-1724177021594.png

And for the peripherals, please go into "Peripheral Clock View" and the source clock for each peripheral can be selected:

Julin_AragnM_1-1724177085346.png

Best regards,
Julián

 

0 Kudos
Reply
772 Views
Prasad_330
Contributor III

hi Julian_AragonM

Thanks for the reply,

I have configured the clock configuration and Peripheral Clock View  as suggested by you.

But my FlexCAN configuration is configured as below snapshot and it is working properly in the RUN mode

Prasad_330_0-1724241462190.png

where my FlexCAN Protocal Clock is 25000000(25Mhz).

Now in VLSR mode if I change the clock of FlexCAN  to 3000000(3Mhz), should want to do any changes in the bitrate (kbps). if  so, then how to configure.

I am getting the bus_error in VLSR mode.

Plz let me know any other configuration I am missing.

 

0 Kudos
Reply
743 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

The FlexCAN protocol clock needs to be configured as the peripheral clock:

1.png

Julin_AragnM_4-1724273279504.png

 

Please refer to chapter 73.3.10.8 Protocol timing from the S32K3XX's reference manual. 

Best regards,
Julián

 
 
 

 

0 Kudos
Reply
541 Views
Prasad_330
Contributor III

Hi Julian

we are working on s32k324 very Low speed run mode for CAN 

 

To enter into VLSR mode from the RUN mode, I am changing the CLOCK to 3Mhz.

Before changing the clock i am de_initializing the CAN.

after changing the clock to 3MHZ ,I am reinitializing the CAN with 3Mhz

Prasad_330_0-1724995535468.png

 

The structure (above )"FlexCAN_Config0_VLSRM"  is created by me.

It is copied from the other project where  Flex CAN Protocol Clock is equal to 3MHZ and bitrate is equal to 500Kbps.

In the RUN mode CAN Tx and RX is working fine.

In the VLSR mode 

For CAN transmission we getting the return value as "FLEXCAN_STATUS_SUCCESS" for the ever first  time and from next cycle we are getting "FLEXCAN_STATUS_TIMEOUT" and also we are not getting any bus error.

But  if CAN transmission is done @100 ms interval from external environment to the s32k324 (using CAN Analyzer) most of the time we get  the return value as "FLEXCAN_STATUS_SUCCESS"  and randomly we are getting the CAN interrupt, which we have to get for every 100ms.

I have also attached the stand alone code for CAN VLSR mode.

Plz let me know any other parameter should be taken care

0 Kudos
Reply
477 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

It seems like my colleague has already answered your post: S32k324 VLSR mode - NXP Community. Please check your bit timing parameters for the FlexCAN module.

Best regards,
Julián

0 Kudos
Reply
969 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

Try to use this wake up config instead:


static inline void Rtc_Ip_SetCompareValue(uint8 instance, uint32 value)
{
    /* Set RTCVAL */
    rtcBase[instance]->RTCVAL = value;
}

void Wkup_Config(void)
{
	/* WKPU configuration */
	Wkpu_Ip_Init(WKPU_INST, &Wkpu_Ip_Config_PB);
	Wkpu_Ip_EnableInterrupt(WKPU_INST, 0);

	/* Init RTC and RTC_0_InitConfig_PB is config tool generated */
	Rtc_Ip_Init(RTC_INST, &RTC_0_InitConfig_PB);

	/* Disables the API functionality
       Clears the API interrupt flag*/
	Rtc_Ip_StopTimer(RTC_INST);

	Rtc_Ip_StartCounter(RTC_INST); 				/*<! Start the counter. */
	Rtc_Ip_SetCompareValue(RTC_INST, RTC_API_TIME);	/*<! Set counter value. */
	Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 0);
}

Also, make sure that SIRC is enabled in standby mode:

Julin_AragnM_0-1723136674936.png

Best regards,
Julián

943 Views
Prasad_330
Contributor III

hi Julian_AragonM

Thanks for your reply,

Your solution worked for me.

I also wanted to know is there Very Low Speed Run (VLSR) mode.

Can you please share me some documents  regarding the configuration of VLSR mode or some Sample code 

0 Kudos
Reply
926 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

You can refer to the pdf included with the Low Power Managements demos. All of the example codes contain another clock configuration which uses the FIRC for VLSR.

Julin_AragnM_0-1723219566635.png

Julin_AragnM_1-1723219842524.png

Julin_AragnM_2-1723219901111.png

Best regards,
Julián

 

 

0 Kudos
Reply