cancel
Showing results for 
Search instead for 
Did you mean: 

UART reconnection issue

SGonz.2
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
gbm
Lead III

By writing data to a register?

#define GPIO_PUPDR_PU 1u

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

View solution in original post

5 REPLIES 5
SGonz.2
Associate II

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
Lead III

By writing data to a register?

#define GPIO_PUPDR_PU 1u

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

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

Bob S
Principal

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".

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