cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L1 connection from PC3 through COMP1_SW1 to COMP1+

berendi
Principal
Posted on December 16, 2015 at 16:05

Hello,

There are apparently some inconsistencies concerning COMP1_SW1 in the RM0038 Reference Manual (Rev 13).

  • Starting at Page 195, Section 8.3.1, it says COMP1_SW1 is available in Cat.4, Cat.5 and Cat.6 devices.
  • However, Page 342 in Section 14.9.1 says the enable bit for COMP1_SW1 is available in Cat.4 devices only. Moreover, the text states that the switch connects to the negative input of COMP1, but all the drawings show it is connected to the positive one.
  • Figures 26 and 27 in Section 8.2 show a direct connection from PC3/ADC_IN13 to COMP1_SW1 for Cat.3 through Cat.6 devices.
  • However, on Figure 64 in Section 14.4 this connection is missing.

Which controllers do actually have this switch and the connection, and if they are present, does it mean that one can use PC3 as a more direct input to COMP1, bypassing the ADC switch matrix?

#comparator #stm32l1
5 REPLIES 5
berendi
Principal
Posted on December 17, 2015 at 12:02

OK, I've tested it with a STM32L151VCT6A, which is a mere Cat.3 device, it looks like COMP1_SW1 is there. Enabled the clocks, set PC3 to analog, then set

COMP->CSR = COMP_CSR_CMP1EN|COMP_CSR_SW1;

connected an adjustable voltage source to PC3, and it just worked, the comparison result available inCOMP->CSR&COMP_CSR_CMP1OUT Now, it would be nice to see it properly documented.
Amel NASRI
ST Employee
Posted on December 17, 2015 at 12:17

Hi berendi.peter,

It seems that the cause of the confusion is the OPAMP3 which is available only on Cat4.

I agree with you that documentation needs to be cleaned in order to provide the exact information.

I check this deeply and then I will keep you informed.

-Mayla-

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.

Amel NASRI
ST Employee
Posted on December 17, 2015 at 16:31

  • Starting at Page 195, Section 8.3.1, it says COMP1_SW1 is available in Cat.4, Cat.5 and Cat.6 devices.

==> OPAMP3 connection with COMP1_SW1 is available only in Cat1. The RM0038 will be aupdated accordingly.

  • However, Page 342 in Section 14.9.1 says the enable bit for COMP1_SW1 is available in Cat.4 devices only. Moreover, the text states that the switch connects to the negative input of COMP1, but all the drawings show it is connected to the positive one.

==> COMP1_SW1 is connected to the positive input as described in the figures. So the text will be corrected.

  • Figures 26 and 27 in Section 8.2 show a direct connection from PC3/ADC_IN13 to COMP1_SW1 for Cat.3 through Cat.6 devices.
  • However, on Figure 64 in Section 14.4 this connection is missing.
==> It is difficult to manage all exceptions in the figures. SO you find a figure for various Catx then you have to refer to datasheet to know exactly available peripherals (For example: OPAMP3 available only on Cat4. So the connection to COMP1_SW1 is applicable only in Cat4).

-Mayla-

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.

berendi
Principal
Posted on December 18, 2015 at 10:13

Thank you very much. There remains but one question, whether the connection from PC3 to COMP1+ through COMP1_SW1 is definitely present in Cat.3 / Cat.5, or it has just worked for me, but I should treat it as an undocumented feature that might disappear in the next chip revision?

The opamps do not interest me, I just want to be sure that a particular input signal is definitely above a voltage threshold. COMP2 input pins are already taken, and I'd like to do it as simple and fast as possible.

berendi
Principal
Posted on December 18, 2015 at 11:33

Did one more test (with the code above) on a 32L152CDISCOVERY board, which is equipped with STM32L152RCT6 (without the -A suffix), and it did not work. That actually makes sense, because the -xCT6A are actually dumbed-down Cat.4 devices labeled as Cat.3, but the ones without -A are meant to be Cat.3 by design.