Shop Learn P1 Docs P2 Docs
FourSerial for P2? — Parallax Forums

FourSerial for P2?

Is there a port of Tim Moore's excellent FourSerial module for the Prop2 yet? Is there any reason it can't be done?

In P2_OBEX_220501.ZIP, I see jm_serial and jm_full_duplex_serial, but nothing that looks like a four serial or multiserial. Trying to compile FourSerial.spin as spin2 fails on if_never, movd, and other P1 specific PASM codes.

My P1 code uses four heavily modified FullDuplexSerial cogs for syntax aware device communications and one standard FourSerial cog for host commo, barcode input and printer output. I assumed that architecture would work on P2. I just today got my first P2 board going and am ready to recompile all my code. Is the community waiting for someone to port FourSerial?


  • I used the Four Port Serial drivers all the time on the P1, but on the P2 you don't need it at much because of the smartpins and interrupts.

    Thanks to the smartpins, you could probably do 32-port serial on all 64 pins simultaneously at around 115200 baud with a single cog (that's 20 instructions per half-channel @ 300MHz), but I'm not aware that anyone's done this yet.

  • Here's a link to my version of a four port driver. The linked comment includes a link to another thread on the topic.

  • Thanks for the pointers, guys. I am hoping to get my P1 code running on P2 fairly quickly, then start using new P2 features incrementally. So I'll probably start with Duane's link today. Reading the forums last night, I found Ken Gracey's "Multiple Serial Port (8 UART – 16 Tx/Rx) Object" mentioned in this post, so that will take me to Dude's solution in the longer term. Much appreciated.

  • Duane, your Frankenstein version of the multiport serial driver is working. It took about 4 hours to assimilate into my old code, from download to a good command/reply sequence. Thank you!

    For anyone reading this later, the code in Duane's link above handles anything up to 8 bidirectional ports, and uses smartpins as Electrodude recommended, but mostly replicates the original FourSerial API.

Sign In or Register to comment.