Skip to main content
Visitor II
May 28, 2024
Solved

Can overlapping IN\OUT pins be used to internally route peripherals on STM32G4?

  • May 28, 2024
  • 1 reply
  • 2471 views

I’m using CubeIDE and I want to internally connect peripherals to the comparators. This doesn’t appear to be supported by CubeIDE, but I’m wondering if its still supported by hardware somehow.

I’m using an STM32G4 and I see that COMP6 INP lands on PB11, which is the same pin as OPAMP6 OUT. Can a pin overlap like this enable internal routing of OPAMP6 to COMP6?

I can also see that OPAMP outputs can be mapped to ADC inputs that also fall on external pins that overlap with COMP comparator inputs. PA2 doubles as COMP2 OUT and ADC1 IN3, which can map internally to OPAMP2_VOUT. Would this work?

Similarly, I want to drive a USART RX with comparators routed internally. I see that COMP6 OUT can land on the same pin as USART1 RX. Can I make the COMP drive the USART like this?

    This topic has been closed for replies.
    Best answer by AScha.3

    more interesting question is about comparator and UART... and i bet it is possible too ... 

    I just tried, on F303 :

    AScha3_0-1716902404973.png

    Cube allows only comp6 output on pin PA10, usart1 rx then on pin PB7; need wire to connect.

    And from rm see possible internal connections:

    AScha3_1-1716902675313.png

    -> no internal connection to any uart - so not possible by internal mux .

    Now try to set "manually" the connection comp6 output on pin PA10 and usart1 rx :

    from ds -> af settings:

    AScha3_2-1716903264082.png

    and sett to port register:

    AScha3_3-1716903315548.png

    Decide yourself : how to set AFR10 to 7 and 8 at same time ?

    So Cube is "right" here, only one position of internal pin mux possible.

    And you lost the bet...  :)

    1 reply

    Super User
    May 28, 2024

    Try to set it in Cube, then you see : possible - or not.

    You can set maybe two input mux on same pin, lets say two ADCs on same pin.

    Or set a pin as COMP output and ...

    AScha3_0-1716883818136.png

    see table in ds.  PA2 :

    AScha3_1-1716884035946.png

     

    KHarb.1Author
    Visitor II
    May 28, 2024

    Cube won't allow it...but I'm informed it doesn't let you do everything. I'm too new to know if it an be done outside Cube.

    Super User
    May 28, 2024

    So read in rm , what you can set on the registers...then you see, whats possible and if there is any combination, that you cannot set in Cube. (Usually you can set everything in Cube, thats possible.)

    >but I'm informed it doesn't let you do everything.

    Right, for example you cannot "overclock" the core - Cube only allows settings according to datasheet  rating.