Skip to main content
SGonz.2
Associate III
June 9, 2022
Solved

UART reconnection issue

  • June 9, 2022
  • 3 replies
  • 2553 views

Hello!

I'm receving data in UART rx, using DMA and ring buffer with idle detection, but when I disconnect and reconnect the cable in Rx the communication stops and my buffer fills up with '\0'. So, I need to resume the UART communication, how can I do this?

I tried to execute the UART init fuctions, but it didn't work. Now I wonder if the cause of this is the no pull-up resistors in Rx. What do you think? I would try this, but CubeMx doesn't let me configure this.

0693W00000NrXpyQAF.png

This topic has been closed for replies.
Best answer by gbm

By writing data to a register?

#define GPIO_PUPDR_PU 1u

GPIOA->PUPDR |= GPIO_PUPDR_PU << (2 * 10);

3 replies

SGonz.2
SGonz.2Author
Associate III
June 9, 2022

In my case UART Rx needs a pull up resistor.

But CubeMx doesn't allow me to change this, how can I do it?

gbm
gbmAnswer
Principal
June 10, 2022

By writing data to a register?

#define GPIO_PUPDR_PU 1u

GPIOA->PUPDR |= GPIO_PUPDR_PU << (2 * 10);

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
SGonz.2
SGonz.2Author
Associate III
June 10, 2022

I wasn't sure if I could do that, but I tried and it works. Thank you!

Bob S
Super User
June 10, 2022

I may be a bit late to the game here, but you SHOULD be able to change this in CubeMX. From the image you posted, click on the RX pin line and there should be a configuration window down below. Unfortunately, that is often displayed below the viewable part of the window, so scroll down. You should see lines to change "GPIO mode", "GPIO Pull-up/Pull-down", "Maximum output speed" and "User Label".

SGonz.2
SGonz.2Author
Associate III
June 10, 2022

You are right! Just checked and after going down a wide blank space, the GPIO configurations appears. Thank you!