Max Baud Rate for Serout
herold
Posts: 66
What is the max. baud rate for the Basic Serout command? Is it possible to use custom baus rates, if yes how do I calculate them?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Yes, the receive issue has been resolved, thanks to your help. The chip is running at 50 Mhz and I am using 921600 as baud rate right now on both sides, which gives me a speed of about 80 Kb per second. My PC program is able to receive data faster.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
So I could use "1200000" as a baud rate for example? I am able to have custom baud rates on the PC side as well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I tried some baud rates with the compiler version 1.4 but with most of my test it slows more down than it speeds up.
- 1200000 less speed
- 1152000 more speed
Did you made some tests with higher baud rates?
you are beating the poor SX very hard. In one of my applications, I'm using 115200 Baud with an SX clocked @ 50 MHz, doing the UART code in assembly. I found out that especially the receive part did not always work reliably with the settings for 115200 Baud published together with the "standard" SX UART VP which are
BaudBit = 1
StartDelay = 3
IntPeriod = 217
I changed the settings to the following values to have the RxD line sampled twice as fast, and in all my tests, I never encountered receive errors since:
BaudBit = 2
StartDelay = 6
IntPeriod = 108
Please note that with these settings, the ISR is invoked about twice as often, i.e. the the total possible cycle count in the ISR is cut down by 50%.
Yes, I know this is ASM stuff but I doubt that SB/B-generated code can be more efficient, so IMO, 115200 baud is close to the limit for an SX @ 50 MHz.
BTW, although you can generate custom baud rates with SX/B, or in Assembly, I have no clue if there is an easy method to define such custom baud rates on the PC. Maybe, someone bails in here, who konws more about the COM port implementation in Windows, and the features of the UART chips used in a PC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Thank for the answer and sharing your experience. I don't uset he com port as it is too slow. I am using a DDL that is provided from the FTDIchip company, which is producing the chip on Parallax USB2SER device.
I have found that the SX can do 'T921600' without transmission errors. But this is only with using the DLL I mentioned.
With T921600 I get about 80-85 kB per second. I will do some more tests soon and post my results here.
int_period = 54 ( = 50_000_000/921600)
uartfs = 921600 ( = 50_000_000 / 54)
maxbaud = 460800 (2x sampling at maxbaud)
divide = 2 ( = minimum divide value, as Gunther mentioned)
This maybe just enough to sample a single uart.
No cycles left to do much else inside isr.
So I agree with Gunther, 115200 is probably most usable topspeed @50MHz
(you could run outside isr, with nothing done inside isr, for higher speeds.)
regards peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
High speed comms is an issue dear to my heart.
Although I'm unsure of the particulars on the maximum capability the SEROUT instruction, I can provide som insight on assembly created serial comms.
With a 50 MHz resonator, the practical maximum I have been able to use is short bursts (16 or 32 bytes), SX to SX, at 10 Megabits per second, one direction at a time. Under these conditions the processor is virtually 100 dedicated while the comms are in process. After the burst, the next group is prepared and subsequently sent (or received).
Similarly I have been able to stream 5 Megabits per second continuously in one direction at a time from one SX to another SX, while the processors still have some time to do other things. This rate also inludes clocking the source stream out of one serial FRAM at the "transmitting" SX, and clocking the stream into a FRAM at the "receiving" SX.
In·both cases, the throughput has been 100% reliable.
Based on my experience, I would believe that at 921600 a full duplex (both directions simultaneously) UART could be coded up to give 100% reliable communication. But again, there might not be a lot left for other things.
At 115200 it should be a piece of cake with tons of time for other things.
So, again, I'm not sure how this relates to SEROUT as I'm unsure of what its restrictions might be, but with assembler coding these are my experiences.
Cheers,
Peter (pjv)
Post Edited (pjv) : 8/5/2005 4:29:09 PM GMT
I am looking at the SN74176 chip and wondering why I should bother with the cost of an RS-232 chip when this runs faster, further, and with less noise. Additionally, you don't have to go up to +/- 12 volts to reach the standard and can have multiple hookups on one bus [noparse][[/noparse]32 or so].
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
G. Herzog in Taiwan
I recommend you use the LTC485 or LTC1481. These have superior ESD protection. The LTC485 is available at Digikey.com for $2.50 each, DIP-8, in bulk. The LTC1481 is $2.75 to $3.38.
We use an Intel protocol, called BitBus, AKA IEEE1118. This is RS-485, with a master and over 200 slaves. Address 0 is the master. Addresses 1 through F(15), and FF(255), are reserved. This leaves you with 239 addresses for slaves. Communications speeds are 64k, 375k, and 1.2meg bits/sec.Even cheap twisted pair, unshielded, will work over a couple hundred feet.
Now: do you want synchronous with that? If yes, you have to supply another RS-4xx circuit to carry the clock. If you have to put repeaters in the loop anywhere, you have to supply yet another circuit to control direction.
'Luck!
kenjj
Yes, in one of the 10 Megabit/sec designs where one card rack communicates with another card rack, the driver/receiver is 485, and I can reliably run a few hundred feet.
I also use 10 Megabit/sec on the card rack backplane itself, and there it is straight CMOS in/out from the SX.
To summarize the setup, I have a 10 Mbit/s bi-directional serial backplane bus connecting 16 SX's to an SX backplane controller, and 5 of these rack controllers' SX driven 485 interfaces through a few hundred feet of twisted pair to a central SX orchestrating all communications.
So all together; 80 SX based I/O cards CMOS interfaced to 5 SX controllers connected via 485 to 1 SX host, all happily chugging at 10 Mbits/sec.
To accomplish that, I·have developed·a proprietary self-synchronizing protocol that lets me keep all the communications, and timings in the I/O cards synchronized to one instruction; 20 nano seconds·with·a·50 Mhz SX clock. That protocol really is the essence of making this high speed work reliably.
Typically I don't use 232 unless I must connect to a device having only that interface available.
Hope that clears things up.
Peter (pjv)
Post Edited (pjv) : 8/6/2005 7:51:30 PM GMT
Please forgive me if it all seems a bit naive. I am a 57 year old amatur. Still, I purchased several SX 48/52 protoboards and this seems the way to tie them together. The RS-422/485 driver is just an 8-pin dip and leaves a lot of room for other features.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
G. Herzog in Taiwan
Well, at that age you are a relative youngster....I'm just an old f@rt, losing my turbo speed!
Cheers,
Peter (pjv)