cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L151K6:COMP2...Does closing WINDWE analog switch (for Window mode) disconnect COMP1 non-inverting input from AS14 in the analog switch matrix?

REdmo.1
Associate III

Using the Cosmic IDE, I have the non-inverting input of COMP1 driven from PA4 by closing RI_AnalogSwitch_14 and RI_AnalogSwitch_0 and enabling RI_IOSwitch_3. I have COMP1 configured for COMP_Edge_Rising and the COMP1 interrupt is enabled. I see interrupts occurring when there are positive transitions on PA4. All good.

I'd really like to measure the slope of those transitions, so I want to use the Window mode to additionally trigger COMP2 at a lower voltage. According to figure 23 in the datasheet, it would seem that all I need to do (after setting the COMP2 inverting input appropriately and enabling the interrupt) is close the WNDWE analog switch to connect the non-inverting input of COMP1 to the non-inverting input of COMP2.

But this doesn't seem to work. Worse still, I now don't see COMP1 interrupts. It's as though closing the WNDWE analog switch has disconnected COMP1 from AS14 in the analog switch matrix.

Figure 54 doesn't seem to clarify the situation.

Perhaps, there is a clue in the data sheet:

In window mode, only the Group 8 (PD0, PD1 and PE5) can be used as a non-inverting input.

But that doesn't seem to correspond to Figure 23, which suggests that there is a possible routing through the analog switch matrix from other inputs.

Any help appreciated, Thanks,

Richard

2 REPLIES 2
Simon V.
ST Employee

Hello Richard,

The figure 23 is an overview of the Routing interface. There is a specific sentence in the comparator chapter which indicate that in window mode, only the Group 8 (PD0, PD1 and PE5) can be used as a non-inverting input --> those inputs are the only ones available when WNDWE =1.

Please let me know if you need further informations.

Regards,

Simon

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Simon,

Thanks for this response.

>sentence in the comparator chapter

Yes saw that.

Figure 23 led me to believe that there was a routing to COMP2 via AS14 and WNDWE, but seemingly WNDWE is a changeover switch (which isolates AS14 from COMP1) rather than a simple connection.

Unfortunately PD0 and PD1 are connected to GND under the STM8L151K6 so it will require a spin of the PCB.

Thanks anyway,

Richard