2024-01-13 07:37 PM
I saw on NUCLEO-U5A5 schematics - there is a level shifter for signal T_VCP_TX:
a bit obvious: if MCU jumper is set to run on 1V8 VDD - an external UART receiver (e.g. CP2102N) would not get anymore correct UART_TX signals (yes, it does not anymore with 1V8 logic on TX).
Wouldn't it be enough to use an Open Drain signal on MCU (for UART_TX) and an external pull-up to 3V3?
The UART_RX should be OK, even MCU on 1V8 MCU VDD, but assuming RX is 5V tolerant.
Here what I mean - and it works!
Just configure the UART_TX as GPIO_MODE_AF_OD and it should work also without a need for a level shifter (with external pull-up).
Solved! Go to Solution.
2024-01-14 01:43 PM
You are right, it is correct what you have pointed out.
Open Drain and Pull-Up creates an RC circuit (C from cable and input capacitance on Rx side) and a low-pass filter.
The waveform can look "ugly" (esp. the charging phase, the raising edge is "rounded" and not a sharp edge anymore).
It works fine on UART as: 1K4 pull-up and 1843200 as baudrate (1.8 MHz). It works also fine on I2C (which are Open Drain) up to 4 MHz - but the faster the frequency the smaller the pull-up (e.g. 300R for 4 MHz I2C).
This can draw too much current from a GPIO Open Drain output pin and the minimum size of a pull-up is limited by it.
Totally right: a push-poll and level shifter is better,, safer and faster. Push-poll pins have an almost zero resistance (and therefore much higher frequency).
For my feeling: the main reason to use a level shifter instead of this "open drain trick" is:
when users do NOT configure as Open Drain but there is a pull-up (to 3V3) but MCU runs on 1V8 - it creates a risk to damage the pin (or chip) because now you are driving 3V3 into a 1V8 MCU.
Level shifters are always better, totally agreed.
2024-01-14 12:04 AM
An open-drain output needs a pull-up to reach Hi level, but this forms a low-pass filter with the subsequent line and input capacitance and therefore suppresses high frequencies. For this reason, open-drain outputs are rarely used for frequencies above a few kHz.
Therefore level shifters are always necessary for higher pulse frequencies.
Regards
/Peter
2024-01-14 01:43 PM
You are right, it is correct what you have pointed out.
Open Drain and Pull-Up creates an RC circuit (C from cable and input capacitance on Rx side) and a low-pass filter.
The waveform can look "ugly" (esp. the charging phase, the raising edge is "rounded" and not a sharp edge anymore).
It works fine on UART as: 1K4 pull-up and 1843200 as baudrate (1.8 MHz). It works also fine on I2C (which are Open Drain) up to 4 MHz - but the faster the frequency the smaller the pull-up (e.g. 300R for 4 MHz I2C).
This can draw too much current from a GPIO Open Drain output pin and the minimum size of a pull-up is limited by it.
Totally right: a push-poll and level shifter is better,, safer and faster. Push-poll pins have an almost zero resistance (and therefore much higher frequency).
For my feeling: the main reason to use a level shifter instead of this "open drain trick" is:
when users do NOT configure as Open Drain but there is a pull-up (to 3V3) but MCU runs on 1V8 - it creates a risk to damage the pin (or chip) because now you are driving 3V3 into a 1V8 MCU.
Level shifters are always better, totally agreed.