Shop OBEX P1 Docs P2 Docs Learn Events
Max Baud Rate for Serout — Parallax Forums

Max Baud Rate for Serout

heroldherold Posts: 66
edited 2005-08-07 16:36 in General Discussion
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 WilliamsJon Williams Posts: 6,491
    edited 2005-08-03 08:59
    You don't have to do the baud rate calculation, the compiler will handle that for you -- so yes, you can use a custom baud rate. The maximum speed will depend on your clock speed. What clock speed are you running? And have you sorted out the receive issues with your PC program? (this seems to be yet another new thread on an issue that's been around a while).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • heroldherold Posts: 66
    edited 2005-08-03 18:15
    Hello Jon,

    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 WilliamsJon Williams Posts: 6,491
    edited 2005-08-03 18:28
    I, too, did some testing today and found I could run 921600 on SEROUT when using 50 MHz. Version 1.4 (we'll release this week) makes some improvements to the speed and handling of SERIN/SEROUT, and will flag an error if you specify a bau rate that is too fast. For SEROUT the theoretical max is about FREQ / 10.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • heroldherold Posts: 66
    edited 2005-08-03 18:49
    Hello Jon,

    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 WilliamsJon Williams Posts: 6,491
    edited 2005-08-03 19:27
    Yes -- I just tried it with version 1.40; you can download it now (see to of this forum).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • heroldherold Posts: 66
    edited 2005-08-03 20:52
    Hello Jon,

    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?
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-08-03 21:26
    Herold,

    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
  • heroldherold Posts: 66
    edited 2005-08-03 21:51
    Hello Guenther,

    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.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-08-03 21:51
    I calculated max baud for freq 50MHz

    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 NewtonJames Newton Posts: 329
    edited 2005-08-04 20:27
    http://www.sxlist.com/techref/scenix/isrcalc.asp may be of assistance in finding possible baudrates.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    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!



  • heroldherold Posts: 66
    edited 2005-08-05 05:23
    I have achieved 120 KB per second transfer rate to the USB input on my PC. I used 1500000 as baud rate. Higher rates were possible (up to 160 KB) but not without loss of data.
  • pjvpjv Posts: 1,903
    edited 2005-08-05 16:26
    Hi All;

    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
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-08-06 16:46
    Are you driving those speeds over any distance [noparse][[/noparse]with a RS-485 interface]?

    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
  • kjennejohnkjennejohn Posts: 171
    edited 2005-08-06 19:34
    RS-422 (push-pull) and RS-485 (RS-422 with multi-drop networking) are the way to go if you have already gone to the expense of installing RS-4xx on your PC. RS232-RS4xx adapters are available from blackbox.com, starting around $110. If there is no PC involved, then so much the better.
    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
  • pjvpjv Posts: 1,903
    edited 2005-08-06 19:45
    Hi Kramer;

    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
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-08-07 07:14
    Thanks, The RS-422/RS-485 certainly offers more. I can actually get into learning Network software and multiple stations.

    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
  • pjvpjv Posts: 1,903
    edited 2005-08-07 16:36
    Hi Kramer;

    Well, at that age you are a relative youngster....I'm just an old f@rt, losing my turbo speed!

    Cheers,

    Peter (pjv)
Sign In or Register to comment.