Skip to main content
s54mtb
Associate II
August 19, 2022
Solved

Multiple on-the-fly changeable pinout configurations for single periphery

  • August 19, 2022
  • 3 replies
  • 1976 views

Hi. Is it possible to generate code with CubeMX for multiple configurations, which can be initialized on-the-fly?

Example:

I have only one UART available, e.g. UART1, which can be connecrted directly via RS232 voltage translator, or when USB VBUS voltage is detected, I would like to route UART1 to (external) USB/UART bridge. To spare glue logic I would like to use different pin mapping. Within CubeMX I can configure only one pinout for UART1. Is there any option to configure single periphery (UART1) to more than one pinout configuration?

Thanks.

Marko

This topic has been closed for replies.
Best answer by Peter BENSCH

Yes, of course. CubeMX can't do that because it can't cover special cases that occur later in the application. But you can change the configuration at any time in the running programme if the respective STM32 offers the possibility to route UART1 to other GPIOs.

Regards

/Peter

3 replies

Peter BENSCH
Technical Moderator
August 19, 2022

Yes, of course. CubeMX can't do that because it can't cover special cases that occur later in the application. But you can change the configuration at any time in the running programme if the respective STM32 offers the possibility to route UART1 to other GPIOs.

Regards

/Peter

In order 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.
waclawek.jan
Super User
August 19, 2022

>> Is it possible to generate code with CubeMX

> Yes, of course. CubeMX can't do that

Isn't this the classic case of "Not, of course", then? ;)

JW

Peter BENSCH
Technical Moderator
August 19, 2022

Got me - you're right. :beaming_face_with_smiling_eyes:

In order 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.
s54mtb
s54mtbAuthor
Associate II
August 19, 2022

Thanks.

Usually, I only include HAL/LL library and initialize periphery manually. Now I am preparing some small hands-on for local school and just checking if there is some "automation" for such cases.