Skip to main content
McClean
Associate
Jul 24, 2020 1:12 PM UTC
Solved

STM32F303CCT - UART in Single Wire mode not working. Im using current stm32cubeide with HAL

I made a simple test program, transmitting a string using stm32cubeide. If i switch to async mode it works. In Single Wire mode the output is not correct (invalid random chars). Testing LL does not help

This topic has been closed for replies.
McClean
McCleanBest answer
Associate
Jul 28, 2020 1:14 PM UTC

Wow, im really surprised. Your completely right. I used my logic analyzer with uart protocol analysis and it showes the data right - but on putty the input was wrong. So it was clear. I added a 10k resistor and all was right. Stange, it definitly works with without this additional resistor (one is in the usb interface) with f1, l0 and g0 series.

Thank you very much!

8 replies

waclawek.jan
Super User
Jul 24, 2020 7:01 PM UTC

Try without Cube first. UART is simple enough to write register-based initialization and polled transmit.

JW

McClean
McCleanAuthor
Associate
Jul 26, 2020 1:34 PM UTC

Im a windows developer, im able to write efficient microcontroller code, but i dont have experience in writing lowlevel code. Im need to use cube to do this

Steffen

KnarfB
Super User
Jul 26, 2020 2:48 PM UTC

The reference manual says

"The TX pin is always released when no data is transmitted. Thus, it acts as a standard

I/O in idle or in reception. It means that the I/O must be configured so that TX is

configured as alternate function open-drain with an external pull-up."

I don't see that in your .ioc. Maybe thats the issue.

McClean
McCleanAuthor
Associate
Jul 27, 2020 5:38 PM UTC

In th ioc the uart port is defined as Alternate Function Open Drain

KnarfB
Super User
Jul 27, 2020 6:20 PM UTC

But the pull-up part is missing. If you stop sending, the TX line is floating unless you have external components. Are you really using single-wire half-duplex or would asynchronous transmit-only do?

Are both, USART1 and USART2 affected?

McClean
McCleanAuthor
Associate
Jul 28, 2020 2:09 AM UTC

The pullup is implemented in the pc uart interface. I need half duplex, im sending and receiving data. Generally this is working fine, im using half duplex uart since years with stm32f103 and stm32l041 stm32g031.

I wanted to exchange stm32f103 with stm32f303 in an existing design to boost performance because its pin compatible. All is working fine, execpt of the uarts.

At the moment uart on a2 outputs random chars, a9 is outputting noting

McClean
McCleanAuthorBest answer
Associate
Jul 28, 2020 1:14 PM UTC

Wow, im really surprised. Your completely right. I used my logic analyzer with uart protocol analysis and it showes the data right - but on putty the input was wrong. So it was clear. I added a 10k resistor and all was right. Stange, it definitly works with without this additional resistor (one is in the usb interface) with f1, l0 and g0 series.

Thank you very much!