AnsweredAssumed Answered

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

Question asked by youssef chabaane on Nov 24, 2017
Latest reply on Dec 11, 2017 by youssef chabaane



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 */
/* Enable LPTMR0 */



Am I missing something?

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