Main Site Documentation

Maximum Speed of a Serial Port


#1

The STM32F family can do 10Mbps UART speed. The Xbee device that I’m using (S6B) can handle 6Mbps, however these are non standard speeds.

What is the max advisable speed that the Cerb Devices should do?


#2

It depends a lot on what you’re doing with the data. If you’re spending significant time processing the data, or reacting to it, then the speeds you can expect to handle will drop dramatically.

I found at least one post claiming ~1mbps over the UART without issues. I found a lot more where people were having overruns at 115kbps. It really depends a lot on what you’re doing.


#3

I’m processing alot of HTTP requests and TCP packet data.

I suppose that counts as alot.


#4

I think he was referring to processing of the data that comes from the serial port.


#5

Yea, that’s the data. I have to process it from a frame into some actionable command. In this case I’m just trying to obtain a web page as a demonstration, and its already overloading the Cerbuino Bee. I’m going to try using byte arrays in stead of queues to store data to reduce the memory overhead however I think my problem is that the device is receiving the data too quickly and is dropping parts.


#6

I have run my Cerb40 at 460800 baud without error, no RTS/CTS. However, there was plenty of delay between transmissions, so processing the received data had little impact on communications.


#7

Well, I’ve tried everything down to 1Mbps, which seems to run. Wish I could use SPI though, since I’m pretty sure I can get 6Mbps out of that port.
Sigh


#8

@ Mr. John Smith -

I used 1 ALFAT OEM as a salve and one STM32 as master.
=> 3Mbs is good, very good
=> 4Mbs => still good but not a deep test!

But ALFAT has to do something in interrupt, if there is just get and return data, the speed can be better!

I don’t remember exactly it was failed at 5 or 6Mbs. But that is in native side.
In netMF, I was done at 460800 but never pass 921600.

This is not a confirmation about the speed, just share what I did. it may someone else got better value than me.


#9

UART/USART is a hardware peripheral, SPI is a protocol that uses that hardware peripheral. I’m skeptical that you could get much if any more using SPI, because the speeds you’re getting have much more to do with how busy the CPU is running your code (vs feeding data into and out of the peripheral) than how fast the peripheral is.


#10

@ Dat, Hey a new GHI person! Hi

@ Dat, I was getting it to run at 921600 just fine, but I wanted more speed because the module operates at 72Mbps, and I didn’t want to full up it’s receive buffer too much.

What would affect the speed the most in UART? Signaling Noise, or software implementation?


#11

@ godefroi, Ah, so the cpu might be too busy to process the UART signals? Therefore, the more efficient my program is = the faster I can push the UART?


#12

Yes, exactly.

If you’re getting overruns, then you’re not moving data out of the receive buffer quickly enough, because the CPU is too busy. If you’re getting underruns, it’s because you’re not moving data into the send buffer quickly enough to keep up.

Hardware handshaking can manage this (RTS/CTS, by effectively saying, “hey, hold up for a second, I’m busy”), but I don’t think it’ll increase your overall throughput.


#13

@ Dat -
Hi Dad,
do you know what the size of the UART internal buffer is for the different mainboards? I think that I can achieve a higher data rate if I transfer the incoming data in larger chunks. Is that right? If NETMF gives me a time-slice of 20 ms to shuffle the data away from the buffer, I can do this max. 50 times /second and my maximal data rate is 50 x buffersize (or chunksize).


#14

@ RoSchmi -

[quote]
do you know what the size of the UART internal buffer is for the different mainboards? [/quote]

I don’t think ALFAT and Cerb family are different about UART internal buffer, because SMTF32F2 is almost same with STM32F4. But not sure because, yes, they are not 100% same.


#15

@ Dat -
thank you, but what is the size? 4kbyte? 8 kbyte? 64 kbyte?


#16

I tried sending 1400 bytes out the UART and got a Serial Port Exception TX buffer full. So I don’t think it’s 4K.


#17

Aha, thank you. Send-Buffer and Receive buffer may be different?


#18

@ RoSchmi -

4K,8K or 64K is too big for internal buffer, actually it should be called fifo, I think. If you are having any document that talks about internal buffer beside fifo on STMF32F2x, STM32F4x, please share it with us.
For me it is really hard to calculate the max speed with your way if that is fifo buffer. But still, may I am wrong. :slight_smile:

and, I think what we are talking about is wrong thread.


#19

This is buffer in NETMF,
256 for TX
1024 for RX


#20

@ Dat -
This allows you to have up to 64KB buffer as part of RAM
http://www.stm32circle.com/forum/viewtopic.php?id=1077