cancel
Showing results for 
Search instead for 
Did you mean: 

Error Sending data to Arduino through UART Communication

Malre.1
Associate

Hi,

I would like to send a data from my STM32F401CC to Arduino.

I have connected Tx to Rx and successfully upload the code to stm32 and Arduino Uno.

I don't get the values right, only first four readings, then all the values become random.

This is my stm32 code:

0693W000007DOgyQAG.png 

and this is the results:

0693W000007DOgGQAW.png 

the Arduino Uno code:

0693W000007DOifQAG.png 

I configured both clocks to be the same 16Mhz.

Please, Any IDEAs?

3 REPLIES 3

Issue at Arduino end?

Try looking at STM32 output with scope or USB to CMOS Serial dongle.

Try increasing delay from 1ms to 250 or 1000.

Software Serial?​

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

Yes.

If I connect the UART to usb serial port through (FTDI converter) I would get a perfect results in the serial monitor.

Which means, If I connect the stm32 directly to the serial port it is working, but If I send a data to the Arduino then display it from the Arduino end using its serial port, it doesn't work.

( I just want to implement the UART to UART protocol)

tried to increase the delay, same problem.

LCice.2
Associate II

Hello malre.1,

hello everyone,

in the Arduino code,

in the callback function : "Serial Event ()" why did you put a "potentially infinite loop" ?

if "SerialEvent () is really a callback function, in my opinion you should process 1, 5 or ten bytes, and then let the function exit.

Instead, doing your way, the SerialEvent() could potentially never return if the serial port is flooded with bytes.

(But... I do don know anything about the Arduino platform :).

Please, try to process at most 4 bytes, or at most 10 bytes, and let us know...