Skip to content

How can I tell what U(S)ART is used with setTx() and setRx() when more than one is possible? #2319

Closed Answered by fpistm
PerennialNovice asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MasteringTheMess
You can find the information in the PeripheralPins.c, all possible value are referenced here:

{PA_2, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
{PA_2_ALT1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},

To choose the right instance you can use the _ALTx notation.
Example to use USART2

mySerial.setTx(PA2_ALT1);
mySerial.setRx(PA3_ALT1);

while using:

mySerial.setTx(PA2);
mySerial.setRx(PA3);

will use LPUART1.

Note that the PeripheralPins.c reference the PinName (PY_n). Arduino API …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by PerennialNovice
Comment options

You must be logged in to vote
4 replies
@fpistm
Comment options

@PerennialNovice
Comment options

@fpistm
Comment options

@PerennialNovice
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants