Skip to main content
Associate II
March 20, 2025
Question

STM32H503RBT6 - Is it okay to continuously change a specific port function ?

  • March 20, 2025
  • 1 reply
  • 407 views

Hello!

In STM32H503RBT6, PIN 16 (PA2) can take the role of a UART or ADC.

In my application, hardware-wise, it would be ok continuously change their role (every 500ms).

What about firmware?

I'd like to set it to 1-wire UART, do some communication for around 500ms, then change the port role to ADC, take some samples for around 500ms, and then back to UART.

I don't see any problem about this but I figured I might ask anyway.

So, could a problem arise because of this constant port role change (strictly looking at the firmware side only) ?

 

1 reply

Andrew Neil
Super User
March 20, 2025

No problem as far as the STM32 port is concerned.

Maybe challenging to have the same external connection doing both serial comms and analogue, though ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
mpiresAuthor
Associate II
March 20, 2025

Thanks for the answer!

The ADC is a simple NTC.

The pullup resistor on this line is going to be used in UART communication (when a device UART capable is connected to this pin) and as a voltage divider when an NTC is connected.

 

edit: Oh, I just noticed that I forgot to provide a crucial information: this is a 1-wire UART communication. I've added this to the main post.