Shop OBEX P1 Docs P2 Docs Learn Events
Baudrate limititaion for BS2Px — Parallax Forums

Baudrate limititaion for BS2Px

pathikgohil85pathikgohil85 Posts: 21
edited 2011-10-15 10:04 in BASIC Stamp
Hello Folks,

I am working on application which is using 9600 and 19200 baudrate. I am planning to expand my application 3 times what it is right now. I have few question at my mind before I start further.

Can I have information about baud limits for BS2Px?
What is the max serial out baud rate a BS2p can handle?
Is 19200 max baudrate for BA2Px?

Pathik Gohil

Comments

  • PublisonPublison Posts: 12,366
    edited 2011-10-14 12:57
    Yes, 19.2k is the max for BS2PX.

    Propeller will do 115K easily.

    Jim
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-14 13:44
    A BS2p will receive up to 9600 Baud. It can transmit at 19200 Baud. You have to keep in mind that all of the BS2 series devices are unbuffered. They cannot receive while they're executing other statements. If data comes in when the Stamp is not executing a SERIN (or DEBUGIN) statement, that data is ignored. The Propeller's behavior is determined by the I/O software that's running. Most Propeller serial I/O is buffered with one of the cogs doing the receiving (into a buffer) while another is executing the rest of the program.
  • pathikgohil85pathikgohil85 Posts: 21
    edited 2011-10-14 14:00
    I was going through previous forums where I have read about using BS2 controller up to 115k by using special formatters like SPSTR. Am I right or It was for propeller?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-14 14:04
    The BS2 is the original model. The BS2sx and the BS2p series are faster. The BS2 is quite marginal at 9600 Baud for receiving. None of the Stamps can handle 115K Baud, but the Propeller can handle in excess of 1 MegaBaud. with appropriate I/O drivers.
  • pathikgohil85pathikgohil85 Posts: 21
    edited 2011-10-14 14:07
    So what will be my baudrate limitation if I am using BS2P40?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-14 14:22
    9600 Baud for receiving and 19200 Baud for transmitting. You may be able to receive a little bit faster than that depending on the specifics of the SERIN statement, but you'll have to experiment. Similarly, you may be transmit a little faster depending on the details of what you're trying to do.

    As I mentioned before, all of the Stamps are unbuffered and the actual receive Baud that can practically be handled depends on the details of your program.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2011-10-15 10:04
    Any Stamp can transmit individual bytes quite fast, although at higher baud rates the precision of the rate is off. There are formulas in the manual. For example, for the BS2px, the formula is
    baud = 4000000/(baudmode + 20)
    so a baudmode of 84 give 38461 baud, which works ok with most 38400 baud systems. And a baudmode of 14 gives 117647, which is close enough to 115kbaud to work with most receivers. That is not to say that the throughput occur at that rate. The Stamp will insert a delay between bytes that amounts to an extension of the stop bit. That depends on the way that the data is formatted, but on the original BS2 it is 150 microseconds minimum, which is an extra 1.5 stop bits at 9600 baud. In a PBASIC loop, that extra time between bytes extends out to milliseconds.

    For reception, the stamp can receive at those speeds only if it is sitting on the SERIN command ready for a start bit when that start bit occurs. Then once it receives a byte it takes some time to process the data before it can be ready and sitting there again waiting for the next start bit. Workarounds use extra stop bits or pacing on the transmitting end, or the flow control pins. It can be done to achieve higher baud rates if you have programmatic control at both ends of the process, for example, a BASIC Stamp talking to another BASIC Stamp.

    I have some suggestions at this link.
Sign In or Register to comment.