cancel
Showing results for 
Search instead for 
Did you mean: 

uart communication in stm32

manoj23
Associate II
Posted on April 04, 2013 at 12:50

Hi,

I am getting problem while using uart of controller with my wireless module. Actually what is happening is my wireless module receiving data very fast and consumption of that data from controller side is slower than wireless module. So how can i manage this to synchronize receiving and transmitting part? Since controller consumption of data is slower than wireless module so i am missing some data and because of that i am not able perform further task. Suggest me the solution on this.

#flow-control
11 REPLIES 11
Posted on April 04, 2013 at 13:12

Exactly how fast?

In bound data can be placed in a reasonably large ring buffer under interrupt, or a constant stream could utilize DMA.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Chief III
Posted on April 04, 2013 at 19:46

''controller consumption of data is slower than wireless module so i am missing some data''

 

 

Ever heard of

Flow Control

...?
manoj23
Associate II
Posted on April 05, 2013 at 06:47

Hi clive1,

I forgot to give you the details of UART configuration.

Baudrate 115200

Stop bit 1

Parity None

Hardware flow control none

Data lenght 8 bit

How fast it is even i cant explain you but ya it is wireless modules' receiving data is faster than controllers' consumption of that data. I just want to control that receiving part which my wireless module is doing to synchronize consumption and receiving part.

Andrew Neil
Chief III
Posted on April 05, 2013 at 08:26

''Hardware flow control

none

''

So how about using hardware flow control, then?

''wireless module''

 

 

What ''wireless module'', exactly, are you using?

Are you using any protocol for your data transfer?

manoj23
Associate II
Posted on April 05, 2013 at 09:08

Hi neil,

I am using wifi module. This wifi module having two modes one is command mode and another one is auto work mode. In command mode i can connect my wireless module to any access point and at the same time it provides me hardware flow control none. In case of auto work mode my wireless module can connect to the only one network which i have to mention using command though it provide me hardware flow control with RTS and CTS. But i am using command mode in my case.

For this wireless module i am not using protocol like SPI or I2C. It is just simple transmission and reception using UART.

crt2
Associate II
Posted on April 05, 2013 at 09:51

There is one more thing you should be thinking - how do you know it is transmitting faster than controller is receiving? Is data corrupted or missing? Does it work if you set speed to lower?

If you set both (module and stm32) to 115200 (which I am using as well without hardware flow control), then there is no way something is too slow

except

if you are having a huge interrupt routine.
manoj23
Associate II
Posted on April 05, 2013 at 10:24

Hi crt,

''how do you know it is transmitting faster than controller is receiving?''

I am just putting break point in my program in the interrupt of receiving part in which i am using read, write pointer which is getting incrementing when in receive the data. But reading from controller side is incomplete. That mean module in writing in receive buffer immediately just before finishing read part by controller of that received data. And causes to missing data.

crt2
Associate II
Posted on April 05, 2013 at 12:54

Uh, can you rewrite what are you doing?

So you are basically interrupting receiving and checking memory with debugger if ok data is in receive buffer? How long are you letting it ''read'' before you do that? Breakpoint makes me wonder that it breaks at every receive?

manoj23
Associate II
Posted on April 05, 2013 at 13:10

Hi crt,

Yes you are right i am checking my receive buffer whether i am getting ok or not. And not exactly breakpoint sorry for that, i am watching all the parameter like write and read pointer as i mentioned before in live watch window. So i can watch those parameters while program is running.