Shop OBEX P1 Docs P2 Docs Learn Events
has the fullduplexserial object got a fifo? — Parallax Forums

has the fullduplexserial object got a fifo?

Lee MarshallLee Marshall Posts: 106
edited 2008-10-29 04:41 in Propeller 1
what happens if a byte is received and the rx routine hasn't been called?
does the last received byte disappear, and get replaced, or does the new byte go into a queue.
im asking because my application needs to receive about 25 bytes one-after-the-other, wait 50ms, then receive another 25.

now my other question: how fast is SPIN code executed, are we talking about 1 instruction per millisecond or 1 per microsecond? i just need a ballpark figure.

here is my math i am using to decide whether or not to worry:
1/19200(baud rate) = 52us(per bit)
10 bits in standard UART transmission, so that's 520us per byte.
520us to process the byte and be ready for the next one.
so, 520us/0.05us(instruction time) = 10400.
theoretically, i can carry out 10400 normal instructions in that time.
or 520us/0.275us(worst case hub instruction time) = 1891 hub instructions

this is little help, though, if i don't know how long SPIN directives take.
100 cycles? 1000 cycles??????? 30??


i have tested this, and found it to work properly, but i wish to increase my baud rate to, say, 115200, which could prove problematic without a fifo on the uart if im using SPIN code, which the fullduplexserial object needs.


Any help would be great
Lee.

Post Edited (Lee Marshall) : 10/29/2008 3:59:54 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-29 03:55
    1) FullDuplexSerial has a buffer for receive and a buffer for transmit. By default, they're 16 bytes. They can be expanded to any power of two up to 512 bytes and there are several modified versions of FullDuplexSerial that use buffers larger than 16. These could be made larger than 512 bytes, but require further minor coding changes

    2) The execution speed of Spin statements depends on the complexity of the statements involved because they're compiled into byte codes and individual byte code interpretive instructions take on the order of microseconds.

    3) FullDuplexSerial is certainly capable of handling 230KBps. You probably want a larger buffer in that case.

    Post Edited (Mike Green) : 10/29/2008 4:01:02 AM GMT
  • Lee MarshallLee Marshall Posts: 106
    edited 2008-10-29 04:15
    thanks for the reply, mike, it seems like im not going to have a problem after all.
    if i really cranked everything up, framerate, baud rate to what i would call perfect, i would still have 8ms after all reception was complete to do processing.

    so what do i change to make it a 32-byte buffer? is simply the size of the rx_buffer array, or is there some other number which needs to change.
  • Lee MarshallLee Marshall Posts: 106
    edited 2008-10-29 04:32
    it's ok, ive read the code, and understand it.

    i find prop asm very readable for some reason.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-29 04:41
    There's a bitmask used to cause the buffer pointer to wraparound. There's also an offset between the transmit buffer and the receive buffer.

    I recommend using the Multiple Port Serial Driver from the Propeller Object Exchange. This provides for a 64 byte buffer and supports up to 4 serial ports with the maximum Baud depending on the number of ports initialized. With two ports in use, the maximum Baud is 230KBps. It also supports the optional use of RTS and CTS.
Sign In or Register to comment.