Shop OBEX P1 Docs P2 Docs Learn Events
Improved Serial Driver — Parallax Forums

Improved Serial Driver

KyeKye Posts: 2,200
edited 2012-06-09 22:46 in Propeller 1
I can't seem to find a thread that flew by a while ago about making a serial driver without jitter on the serial port. I was going to post this there. Anyway...

I'm posting here today because I think I have a nice solution to the serial port driver jitter problem. I've updated my full duplex serial driver found here, http://obex.parallax.com/objects/397/, to run at 250,000 BPS using a 96 MHz clock. It has the added feature that it always changes the state of the TX pin aligned to the baud rate. So, it has no output jitter! Additionally, the driver is full duplex and can receive at 250,000 BPS at the same time. Finally, you can dynamically stop and start the driver while sending data and it will never corrupt any bytes being transmitted. The driver also has 256 byte transmit and receive FIFO buffers for easy serial operation.

Let me know what you think!

Thanks,

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-06-09 11:38
    I'm not sure if this if the thread you're referring to or not, but it's the one that comes to mind when thinking of a serial driver without jitter.

    I look forward to trying your new driver.
  • KyeKye Posts: 2,200
    edited 2012-06-09 12:09
    No, someone had a problem with the regular full duplex serial driver and there was a long thread about and how to make the bit timings more precise.

    Thanks,
  • max72max72 Posts: 1,155
    edited 2012-06-09 12:30
  • KyeKye Posts: 2,200
    edited 2012-06-09 12:57
    Yeah, that's the one. Thanks!

    Anyway, with my new driver, if you look at the ASM code, it always changes the bit on the tx line within 4 cycles of completing a waitcnt. The TX output is locked to the system timer.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-06-09 21:18
    That's clever, Kye, the way you've locked to 1/4 the baud rate and set up the dispatcher via your "buffer" variable. At 250kbaud that allows 1 microsecond per 1/4 bit time, and with a 96MHz clkfreq, it looks like the longest code segment takes something like 0.6 µs--good job!

    Phil's PBnJ object in that other thread you were looking for synchronizes with waitcnts at 1/6 bit-time intervals--there was a reason for 1/6--and it achieves essentially zero jitter for baud rates up something above 115200 with clkfreq=80MHz. When I get a chance I'll test yours too for timing statistics.
  • KyeKye Posts: 2,200
    edited 2012-06-09 22:46
    The longest code segment takes 92 cycles out of a maximum of 96 cycles @ 250K baud. It barely works. But... that's life.
Sign In or Register to comment.