Skip to main content
Visitor II
April 16, 2023
Question

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

  • April 16, 2023
  • 1 reply
  • 1082 views

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

    This topic has been closed for replies.

    1 reply

    ST Employee
    April 17, 2023

    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

    REdmo.1Author
    Visitor II
    April 17, 2023

    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