Using CMP in round robin/trigger mode to wake-up S32K from VLPS

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Using CMP in round robin/trigger mode to wake-up S32K from VLPS

跳至解决方案
2,650 次查看
youssef
Contributor II

Hi,

 

I'm trying to get S32K waked-up from VLPS using CMP in round robin mode. Here are the steps that I did:

 

- Configure SIRC divider to 2 and enable it, so I have 4 Mhz as SIRCDIV2 CLK.

- Enable clock gated LPTMR0.

- LPTMR0 is configured tu use SIRCDIV2 clk in free runing counter with CMR=0

- Configure CMP0 in round robin mode with:

 

/* IN0, from the 8-bit DAC output
* IN1, from the analog 8-1 mux
* Enable Channel 0, 1 and 5 for round robin
* Enable DAC
* Supply voltage reference is Vin1

 

* 1 round-robin clock cycle later, the result is sampled
* Compare result is 0 initial values for all channels
* From datasheet: Initialization delay for CMP in Low-speed mode is 30us max
* round robin clock is 2 MHz --> INITMOD = 30000/500 = 60

* Low Speed (LS) comparison mode is selected.
* Analog Comparator is enabled

* Clear CMP inputs changed flags 

/*
* Enable Round robin
* Enable round robin interrupt
*/
CMP0->C2 |= CMP_C2_RRE(1) | CMP_C2_RRIE(1);

/* Clear TCF */
LPTMR0->CSR |= LPTMR_CSR_TCF(1u);
/* Enable LPTMR0 */
LPTMR0->CSR |= LPTMR_CSR_TEN(1u);

 

 

Am I missing something?

Is there any example how to configure LPTMR0 to trigger CMP in round robin?

 

Thanks

Youssef

1 解答
2,159 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

You may refer to the example below.

https://community.nxp.com/docs/DOC-335759 

Regards,

Daniel

在原帖中查看解决方案

3 回复数
2,160 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

You may refer to the example below.

https://community.nxp.com/docs/DOC-335759 

Regards,

Daniel

2,159 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi, 

Why do you set CMR = 0?

In this case the trigger will remain asserted.

Regards,

Daniel

2,159 次查看
youssef
Contributor II

Hi Daniel,

Yes I found out that this was a mistake. I fixed the issue by Setting CMR to a value to define the trigger period. The CMP now works correctly in round robin mode. I can wake up the MCU from VLPS when cmp inputs change..

Regards,

Youssef

0 项奖励
回复