cancel
Showing results for 
Search instead for 
Did you mean: 

UART not receiving data when sent through putty

rahul7515
Associate III

i am using stm3210e-eval board which has stm32f103zgt6 mcu and i trying to send data on its uart but i am not able to receive any. i am trying to receiving it through blocking mode 

 

 

uint8_t rx[10];
HAL_UART_Receive(&huart2,rx,1,HAL_MAX_DELAY);
HAL_Delay(1000);

 

 

now this is the code and i have put the breakpoint on HAL_Delay so that as soon as data is received it will next stop on HAL_Delay but it does not break it stays stuck into uart function there and is not data getting received. I am using FL232RL to send data from putty to mcu pins of uart i can ensure that data is being sent from putty because when i hit enter onto putty i can see the green led getting blinked with each send of data but i am not getting anything over there but i can send data from mcu to putty i can see that clearly so what is happening

PS: i have double checked the baud rate it correctly set and the uart is transmit and receive mode i have tried changing it to receive mode only but that doesn't help 

image of putty configuration for sending the data

Screenshot 2024-06-19 091954.png

27 REPLIES 27

@SofLit wrote:

It's a very basic concept in digital electronics: don't connect two outputs directly together.


Indeed. And not just digital electronics - connecting analogue outputs together is the same!

 


@SofLit wrote:

you don't have any solution than disconnecting ST3232C 


Or use a USB-to-RS232, and connect to the DE9 connectors

 

EDIT:

Or perhaps you can use different MCU pins for the UART ?


@Andrew Neil wrote:

Are there not any links or solder bridges to disconnect them?

You can't just connect the FL232RL output - because it will be shorted to the ST3232C output!


The same applies to Nucleo and Discovery boards, where a UART is connected to the ST-Link's VCP; eg,

https://community.st.com/t5/stm32-mcus-products/uart-in-stm32-l432kc/m-p/687848/highlight/true#M252756

And, indeed, those boards do have links or solder bridges to disconnect the VCP.

 

You also have the same on Arduinos, where a UART is connected a VCP.


@rahul7515 wrote:

well i can't just desolder those miniature smd resistors


Just put a blob of molten tin on the resistor to cover both pads and wipe it off the board using the soldering iron. You don't need to use fancy soldering tweezers (though if you have them I recommend using them). You can even cut the trace with a knife if you want to avoid using a soldering iron. Or use different pins. The board has tons of pins. Just use STM32CubeMX to identify UART RX pins and check in the schematic which of them don't have outputs connected to them.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

okay i neither have the skills nor  the required tools to do the disoldering and i have tried using the usb to rs232 converter in that case also i am able to transmit data to putty but still not able to receive data from putty

PS: i am using MOXA uport 1110 converter for conversion still facing the same problem transmission of data successfully but reception not i can see the rx led lit up when i hit enter on putty but not receiving anything.


@rahul7515 wrote:

okay i neither have the skills nor  the required tools to do the disoldering and i have tried using the usb to rs232 converter


Have you tried cutting the trace like I wrote? Have you tried different pins like I wrote?
Can you share your code + ioc file?

Do you process UART errors?

Are you using a debugger? You might want to check registers and see if UART is in error.

Have you checked with a logic analyzer?

Is your clock running correctly? If baudrate is too high or too low you may not reliably communicate. It may be the case that sending works and receiving doesn't.

When using STM32 UART I recommend using DMA for receiving to prevent missing data. Interrupts are fine too, but there is a possibility of not handling the interrupt in time.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

yes i have tried other pins still same result and i cannot cut the trace i have finally started using the moxa converter uport 1110 and i am checking the output at the converter ic apparently i am getting the expected result when checked on scope but the voltage level are very low about 200mV maybe that is why my program is not halting at the brake point after receive function cause it's not considering that low voltage as output


@rahul7515 wrote:

i am getting the expected result when checked on scope but the voltage level are very low about 200mV


What result is expected? You receive data? Only when you connect the scope? Maybe you have a grounding issue. A scope ground is generally connected to PE.

What voltage is 200mv? RS232 should be at least positive and negative 5 Volts. TTL level should be 0-3.3V. Have you checked unloaded output? Have you measured RX input impedance with Ohm meter? There may be a short.


If your MCU has proper supply voltage, UART peripheral is configured correctly, clock is running correctly and you get the correct voltage levels and timing on the RX pin and you handle receiving correctly in your code you should receive data. Unless you have a damaged MCU, but that is very unlikely.

If this doesn't help I recommend you upload a drawing of how you have everything wired up (including scope) and also upload code + ioc file and screenshots from your oscilloscope. Without this we are just speculating what might be wrong.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

the rs232 socket is connected to  ST3232ECTR and it's output is given to mcu not result is whatever i am typing on the putty and sending now on the female socket of rs232 that is connected male socket on board there i have checked through scope though it is some else data but the voltage levels are 14v vpp now the next i am checking data on the output of ST3232ECTR where i am getting the data which i originally wrote on putty only problem is it is of 200mv

You are on your own from now on. You refuse to upload any schematics, code, configuration files, photos, screenshots, plots etc. You don't have basic equipment such as a multimeter and soldering iron. And now you even refuse to use punctuation, capitalization and whitespace. I can't help you this way. And certainly not for free. Good luck.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

For two serial inputs into a single pin there are diode and AND Gate methods, where the idle state is normally high. Will garble when both try to signal at the same time, but won't be electrically contentious.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..