How to configure SIRC DIV2 clock in LPTMR component before entering into VLPR/VLPS mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to configure SIRC DIV2 clock in LPTMR component before entering into VLPR/VLPS mode

766件の閲覧回数
Ramsai
Contributor I

Hi,

I am working on a project in which during RUN mode I have configured SIRC DIV2 clock with interrupt enable and it is working fine.

For checking the interrupts, I have configured the GPIO. Before controller goes to sleep it will be high and after wakeup it is made as low.

Similarly, I tried to configure SIRC DIV2(8MHz) clock with interrupt enable before entering VLPR/VLPS mode.

While debugging using multi-link, I am able to get interrupts during sleep periodically as configured. Below is the attached image.

sleep_wakeup_With_Debugger_&_SIRC DIV2 clock_16_02_2024.jpg

 

Whereas when I removed the debugger after flashing the code and when I do Hard reset, during sleep I am unable to get interrupts periodically. Before entering it is becoming high and only after giving external interrupt (LIN) it is made as low. It means there is no interrupt happened in sleep. Below is the attached image.

sleep_wakeup_With_Out_Debugger_&_SIRC DIV2 clock_16_02_2024.jpg

If I configured LPO(1KHz) clock before entering VLPR/VLPS mode. I am able to observe the interrupts periodically. Below is the attached image.

sleep_wakeup_With_Out_Debugger_16_02_2024.jpg

Below are the screenshots of LPTMR configuration with LPO clock and with SIRCDIV2 clock.

With LPO clock:

Ramsai_0-1708057290903.png

With SIRC DIV2 clock:

Ramsai_1-1708057456442.png

I have attached image below related to code implemented before controller goes to sleep.

Ramsai_2-1708057836268.png

In the above image, yellow highlighted indicates that configuring the new LPTMR configuration before entering VLPR. This is where I configured SIRC DIV2 clock instead of LPO clock.

Red highlighted indicates, RUN mode LPTMR configuration is de-initialized.

Blue highlighted indicates, entering VLPR mode.

Below is the attached images of VLPR code.

Ramsai_3-1708058339438.png

Ramsai_5-1708059643769.png

 

Could you please check the configuration and suggest me if any changes are required either in code or in the LPTMR configuration.

Controller name: FS32K116LFT0VLFT

Ide: S32DS

Compiler: IAR

0 件の賞賛
返信
5 返答(返信)

747件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Ramsai,

I have noticed that SIRC clock in VLPS is disabled in init_SIRC()

danielmartynek_0-1708089422166.png

Can you double check the register?

Also, the LPTMR must not be clocked at freq. higher than BUS_CLK

RM, rev.14, Table 27-8. Peripheral clock summary

danielmartynek_1-1708089507711.png

 

Regards,

Daniel

 

 

0 件の賞賛
返信

730件の閲覧回数
Ramsai
Contributor I

Hi @danielmartynek ,

Thanks for the quick reply.

Has you suggested, I updated the changes related to SIRCCSR and also in VLPS mode bus clock is 4MHz and so at LPTMR component level I selected Prescalar has prescalar4_Glitch filter mode 2 clocks (I modified this change because you mentioned that SIRCDIV2 clock frequency should be less than Bus clock frequency.

Attached below is the image of Bus-clock frequency in VLPS mode.

Clock_Configuration.jpg

 

After flashing the code, observed that at LPTMR component level pre-scalar change, my device is not responding after LIN wakeup.

Whereas if I select pre-scalar value to 2, glitch filter mode: invalid then device is responding after LIN wakeup.

Attached the image below and highlighted the related to code changes.

SIRCDIV2_SCG_SIRCCSR_Timer mode_prescaler 4_Glitch filter mode_2 clocks.jpg

 Below image shows the Trace and Graphic view.

SIRCDIV2_SCG_SIRCCSR_Timer mode_prescaler 4_Glitch filter mode_2 clocks_Trace.jpg

Please check the changes and let me know if I did anything wrong or any modification is required.

Regards,

Ramsai

0 件の賞賛
返信

728件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Ramsai,

The LPTMR clock should be limited at the source, that is SIRCDIV2_CLK.

In general, SIRCDIV2_CLK must be <= 4MHz in VLPS.

danielmartynek_0-1708335151407.png

 

 

Thank you,

Daniel

0 件の賞賛
返信

724件の閲覧回数
Ramsai
Contributor I

Hi @danielmartynek ,

I already tried by modifying the Pre-scalar value of SIRC DIV2 clock.

1. I generated the configuration with pre-scalar value as "Timer mode: prescalar 2, Glitch filter mode: invalid". You can observe that Counter clock frequency is 4MHz.

 Observations: The controller is not waking up periodically. But once LIN wakeup is given the controller is getting wokeup and data is transmitting.

Ramsai_0-1708336016291.png

 

2. I generated the configuration with pre-scalar value as "Timer mode: prescalar 4, Glitch filter mode: invalid". You can observe that Counter clock frequency is 2MHz.

 Observations: The controller is not waking up periodically. But once LIN wakeup is given the controller is not getting wokeup and not transmitting data.

Ramsai_1-1708336189617.png

In your last reply you mentioned that SIRC DIV2 clock frequency should be less than or equal to 4MHz. So, in above two conditions you can see that the counter clock frequency is less than or equal to 4MHz.

 

Regards,

Ramsai.

0 件の賞賛
返信

711件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

If SIRCDIV2_CLK freq. is higher than 4MHz, the application is out of specification.

We can't guarantee the functionality of the MCU in this case.

Can you first change the source clock freq. and then reconfigure the LPTMR as needed?

 

Thank you

0 件の賞賛
返信