one cog doing multiple UARTs
rich314
Posts: 1
Is is resonable to have one cog doing multiple UARTs concurently?
That is init a COG to setup UART0 for output on pin-x and UART1 on pin-y.
Next send bytes to the UART COG from another COG, for for either UART to send or recieve, and UART COG takes care of both seial stream setting flags when ready/busy.
Does one COG have enough perfomance to run multiple UARTS?
Is there a way to signal ready/busy/done between COGs?
Thank you for your time.
Obviously i am COG ignorant.
cheer,
rich
Post Edited By Moderator (Chris Savage (Parallax)) : 9/26/2006 10:37:49 PM GMT
That is init a COG to setup UART0 for output on pin-x and UART1 on pin-y.
Next send bytes to the UART COG from another COG, for for either UART to send or recieve, and UART COG takes care of both seial stream setting flags when ready/busy.
Does one COG have enough perfomance to run multiple UARTS?
Is there a way to signal ready/busy/done between COGs?
Thank you for your time.
Obviously i am COG ignorant.
cheer,
rich
Post Edited By Moderator (Chris Savage (Parallax)) : 9/26/2006 10:37:49 PM GMT
Comments
Yes, absolutely. It would probably need to be done in assembly to be fast enough. But as long as each input can be sampled regularly at some reasonable multiple of the baud rate (3x being the minimum), and each output serviced at the baud rate, it will work.
The handshaking between cogs can be done with pointers into the I/O buffers, which will reside in hub memory.
-Phil
P.S. You may want to edit your original post with a title, so the subject matter appears on the forum page.
Running a cog at 80Mhz, gives you 20MIPs in Assembler.
At 20MIPs, 2080 instructions can be performed in the span of 1 bit.
A typical hardware UART has a clock 16x the baud rate for sampling the data.
At that, you still perform 161 instuctions between each sample (if you even want to worry about sampling that much)
I'd say there's sufficient time there to get at least a few UARTS in one cog, though dealing with multiple streams will get a little tricky.
Depending how you use your I/O, you can always dedicate some line for inter-cog signalling. A slower way is to use a global variable in shared RAM, but then you have to deal with the Hubs timing.
-my 2 cents
Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Personal Links with plenty of BASIC Stamp info
StampPlot - Graphical Data Acquisition and Control
AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
I don't recommend doing multiple serial channels this way unless it can't be done reasonably any other way. It's so much easier to do it when you devote a single COG to the task and the code already exists in both SPIN and assembly.
-Phil