Skip to main content
McClean
Associate
July 24, 2020
Solved

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

  • July 24, 2020
  • 8 replies
  • 2520 views

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.
Best answer by McClean

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
July 24, 2020

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

JW

McClean
McCleanAuthor
Associate
July 26, 2020

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
July 26, 2020

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
July 27, 2020

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

KnarfB
Super User
July 27, 2020

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
July 28, 2020

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
July 28, 2020

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!