Serial Objects for SPIN Programming
Humanoido
Posts: 5,770
A List of Serial Objects for SPIN Programming
Tired of endlessly looking for the serial object you need? This list bypasses the limited OBEX-search function and lists the primary serial objects along with their specific links, authors, and information. Includes SPIN objects and one parallel object. Includes special serial objects, some customized, from posts which may not be in the OBEX.
Simple Serial by Chip Gracey - Parallax
http://obex.parallax.com/objects/183/
Bit-bang serial driver for low baud rate (~19.2K) devices. * This driver is designed to be method-compatible with the FullDuplex serial object, allowing it to be used when high speed comms or devoting an independent cog for serial I/O is not necessary. * Bi-directional communication on the same pin is also supported.
Faster Simple Serial with Parity by Marc Gebauer
http://forums.parallax.com/showthread.php?109781-Faster-Simple-Serial-with-Parity
I had·the use for a serial driver that would do 38400 BAUD, 8 bit, even·parity and would'nt use a cog. I didn't need full duplex operation, so I played around with Simple_Serial. Here it is. I call it Fast_Simple_Serial. I have tested send and receive·from 300·to 38400 BAUD with no-parity, even-parity, and odd-parity. Note, the receiver ignores the parity bit. I have added a Demo object that was written for the Propellor Demo Board·which sends and receives to and from the USB FTDI Serial Port and is intended to·connect·with Hyperterminal. Basically when you type on the keyboard in Hyperterminal, the keys are echo'd back.
Full Duplex Serial by Chip Gracey - Parallax
http://obex.parallax.com/objects/54/
Full duplex asynchronous serial object. It will do 115,200 and has 16 byte buffers.
Modified Tim Moore's 4 port driver By Juergen Buchmueller
http://forums.parallax.com/showthread.php?128184-Serial-Objects-for-SPIN-Programming&p=962912#post962912
See post #7 on this thread's page
supports only two ports but with bigger buffers - big enough for an xmodem packet. (64 bytes increased to 256 bytes).
Extended Full Duplex Serial by Martin Hebel
http://obex.parallax.com/objects/31/
Extends out FullDuplexSerial to allow reception of character strings that end in a carriage return for decimal, hexadecimal and alpha-numeric uses. Allows use of timeout values. This version also allows use of defined delimiter characters, and returning whole and fractional portions of a numeric string.
FullDuplexSerial_rr004 by Cluso99
http://obex.parallax.com/objects/570/
FullDuplexSerial object v1.2 with modification to allow easy resizing of buffers 8/16/32/64/128/256 by specifying size in CON section of code only. (Does not do 512)
FullDuplexParallel by Terry E Trapp, KE4PJW
http://obex.parallax.com/objects/644/
This is the FullDuplexParallel object v1.0. It is based on the FullDuplexSerial object v1.1 from the Propeller Tool's Library folder with modified documentation and methods for converting text strings into numeric values in several bases. It interfaces the propeller with the FTDI FT245 Parallel FIFO. The FTDI FT245 allows for high performance I/O to a PC.
FullDuplexSerial_mini.spin by Rkrasowski
Stuff commented out which is not used.
http://forums.parallax.com/showthread.php?129460-Not-enough-COGs
http://forums.parallax.com/attachment.php?attachmentid=78079&d=1297305158
Fast 250Kbps fullduplexserial obex object by Clock Loop
http://forums.parallax.com/showthread.php?120273-Inter-Propeller-communication
http://forums.parallax.com/showthread.php?p=820293
Full Duplex Serial Port Driver by Kwabena W. Agyeman
http://obex.parallax.com/objects/397/
A full duplex serial port driver that runs on one cog. The code has been fully optimized with a super simple spin interface for maximum speed and is also fully commented. Provides full support for: Receiving bytes, Receiving strings, Transmitting bytes, Transmitting strings, Baud Rate from 1 BPS to 250,000 BPS - Full Duplex. This driver has a 256 byte receiving FIFO buffer. This driver has a 256 byte transmitting FIFO buffer.
Full duplex 8.42 MegBaud output to parallax serial Terminal demo by Clock Loop. Thread here Download here You can force error packets if you lift the 10k resistor on the rx pin.
(14.5 Meg Baud) High Speed Prop-to-Prop Serial Communication by Beau
http://forums.parallax.com/showthread.php?99222-Propeller-DEMO-%2814.5-Meg-Baud%29-High-Speed-Prop-to-Prop-Serial-Communication
http://forums.parallax.com/showthread.php?p=694610
I have run this DEMO and tested over 100 Billion data Bits with no Transmission Errors over the distance of 10 feet from one Propeller to another Propeller. “14.5 Meg Baud Upgrade using 4 I/O Pins.... This is still work in progress.· Using only 1 COG for the Transmitter, and 1 COG for the Receiver, 14.5 Mega Baud Communication Packets can be achieved. With slight modification to the "Transmitter" (using 1 COG) and "Receiver" (using 2 COGs ; 180 deg out of phase) 29 Mega Baud communication packets should be achieved through the current implementation of 4 - I/O pins. The current demo sends pseudo random Packets with a length of 32768 bits in approximately 2.25mS (<-14.5Mega Baud) at a repetition rate of 174 Hz effectively providing a constant throughput of 5.7 Mega Baud.· Keep in mind that the 174 Hz is deterministic of the overhead required for the display and Packet confirmation.· Also, the demo provides a "real time" visual representation of the Transmitter's I/O state displayed on the·Receiver screen.
SerialMirror by Mirror
http://obex.parallax.com/objects/189/
A FullDuplexSerial enhancement that allows a single serial connection to be used from within multiple spin files. Primarily aimed as a debugging aid, this file also illustrates how to use the DAT section to make single-instance objects which may be called from multiple spin files. This objects allows relatively easy change of Rx and Tx buffer sizes to the various powers of 2.
MultiCogSerialDebug by Peter Verkaik
http://obex.parallax.com/objects/232/
Derived from SerialMirror V07.05.10 All printing (also from multiple COGs) is done using cprintf. Each cprintf call is a message. The more parameter in cprintf lets you prohibit that the message is interleaved with text from another COG. To keep output clear, end each (compound) message with a \r or \r\n. Receiving should be done by a single COG that can dispatch received messages. See the test program for detailed usage.
Multiple serial port driver by Tim Moore
http://obex.parallax.com/objects/340/
Supports upto 4 serial ports with 1 COG. Also supports hardware flow control on any of the ports.
Tim Moore's pcFullDuplexSerial4FC with larger rx buffer by Duane Degn
http://forums.parallax.com/showthread.php?129714-Tim-Moore-s-pcFullDuplexSerial4FC-with-larger-rx-buffer
pcFullDuplexSerial4FCex.spin uses one cog to control up to four serial ports. After studying the code for a while, I saw how Tim reused the variable space in the hub after the cog is launched. After tracking down which variables were used by both Spin and PASM and which ones were only used within the cog, I realized there was even more space that could be reclaimed. At the cost of three longs, I was able to double the rx buffer from 64 byte per port to 128 bytes per port.
JDCogSerial by Carl Jacobs
http://obex.parallax.com/objects/398/
A full duplex serial that has *ALL* the buffer memory stored in the COG. The VAR footprint is tiny at only 6 longs. The buffer pointers are fully automatic, which allows easy access from assembly as well as sub-objects. The buffer sizes may be set at any number of bytes (in multiples of 4) to the total spare capacity of the COG (a bit over 1300 bytes). Only mode 0 is supported, with baud rates to above 345600 for a 80MHz clock.
Parallax Serial Terminal by Jeff Martin - Parallax
http://obex.parallax.com/objects/457/
This object works with the Parallax Serial Terminal; see Propeller Downloads page or install Propeller Tool v1.2.6 (or newer). It includes handy methods for output/input (Char, CharIn, Str, StrIn, Dec, DecIn, Bin, BinIn, Hex, HexIn) and cursor positioning (Home, Position, NewLine, MoveLeft, MoveRight, etc.) as well as control character constants that match the function of the Parallax Serial Terminal. A demo and a "quick start" template are provided.
jm_irtxserial by Jon McPhalen
http://obex.parallax.com/objects/462/
Allows for serial transmission (up to 2400 baud) over an IR link. Compatible with output methods of simple_serial and fullduplexserial.
Half Duplex Serial Port Driver by Kwabena W. Agyeman
http://obex.parallax.com/objects/538/
A half duplex serial port driver. The code has been fully optimized with a super simple spin interface for maximum speed and is also fully commented. Provides full support for: Even parity bit generation, Even parity bit checking, Odd parity bit generation, Odd parity bit checking, Mark parity bit generation, Mark parity bit checking, Space parity bit generation, Space parity bit checking, Receiving bytes, Receiving strings, Transmitting bytes, Transmitting strings, Baud Rate from 1 BPS to 19,200 BPS - Half Duplex.
Serial Com by Aleks
obex.parallax.com/objects/356/
A communication routine loosely based on I2C with included demo programs to communicate between two Propeller IC's.
~note-> This has only been tested on the Spin Stamp, whereas this is the only propeller I have access to. It requires a CS, SDA, and CLK line to operate. I have had success communicating between the two stamps I used, and displaying the results on an LCD screen. My contact info is in the Readme.txt.
spin FD_Serial_Conf.spin by Andy
http://forums.parallax.com/showthread.php?111836-Custom-Serial&p=797716
http://forums.parallax.com/attachment.php?attachmentid=59874&d=1239071285
Here is a variation of the FullDuplexSerial object, which allows configuration of the datasize 7..9 bits, with an additional Parity bit. Also the Buffer size can easy be changed.
Fast Inter-Propeller Communication by Bobb Fwed
http://forums.parallax.com/showthread.php?117840-Fast-Inter-Propeller-Communication-Object
obex.parallax.com/objects/546/
http://forums.parallax.com/showthread.php?118076-Fast-Inter-Propeller-Communication-Features
I just tested it at 100MHz and got a throughput of 1.37MB/s (including all overhead). Also tested at 80MHz producing 1.10MB/s. It has been tested with over a meter of wiring between two Propellers, but i can't see why it wouldn't work with much longer wires.
[POC] single wire high speed serial link (updated 20101124) by kuroneko
http://forums.parallax.com/showthread.php?110325-POC-single-wire-high-speed-serial-link-%28updated-20101124%29
FastSerial by Peter Jakacki
http://forums.parallax.com/showthread.php?114492-Prop-Baudrates
Half-duplex high speed precision serial driver. Adapted from FullDuplexSerial, This driver dedicates a cog to either receiving or transmitting serial data in a half-duplex fashion. The aim is to have precise bit timing which is important at high-speeds at and above 115K baud. The transmit routines have been to tested to 1Mbit and the receive routines work at 1Mbit
HighSpeed Serial Tx (3Mbps) / Rx (2Mbps) + autobaud for FT232R/Prop GPL by Stephen Moraco
http://forums.parallax.com/showthread.php?102696-HighSpeed-Serial-Tx-%283Mbps%29-Rx-%282Mbps%29-autobaud-for-FT232R-Prop-GPL&p=720623
This is a set of block-send and block-receive routines.· That is they are designed to reduce communication between cogs by only transporting data between them on buffer-full or line-end events.
Other Communication Software & Techniques
Full-speed (12 Mb/s) bit-banging USB Host controller by Scanlime
http://forums.parallax.com/showthread.php?121321-Working-full-speed-%2812-Mb-s%29-bit-banging-USB-Host-controller
So far it supports Control, Bulk IN/OUT, and Interrupt IN transfers. There are a couple simple demos included: Device enumeration and descriptor parsing, a very simple HID demo, and an even simpler mass storage demo. As you'd expect, there is a huge list of caveats for something that pushes the limits of the Propeller and the USB spec to this extent.. It uses four cogs, requires overclocking the Prop to 96 MHz, and even though the line rate is 12 Mb/s the actual usable data throughput is significantly lower. But, this lets you talk to a lot of fun new peripherals that were previously unavailable to the Propeller. So it should be fun
XModem receive routine for use with CP/M by Mike Green
http://forums.parallax.com/showthread.php?114023-Sphinx%E2%80%94as-seen-at-UPEW!/page10
It uses a simple checksum even though there's a CRC variable. The return value is the length of the file received.
BS2 Functions Communications by Juffra
http://forums.parallax.com/showthread.php?120273-Inter-Propeller-communication
5Mbit/sec ASCII Streaming from/to Hub RAM by Pjv
http://forums.parallax.com/showthread.php?120125-5Mbit-sec-ASCII-streaming-from-to-Hub-RAM&p=882980
Inter cog communications in Spin by SRLM
http://forums.parallax.com/showthread.php?109427-Inter-Cog-Communication
Inter cog communications in Assembly by Mctrivia
http://forums.parallax.com/showthread.php?109427-Inter-Cog-Communication
Variable access across cogs by StefanL38
http://forums.parallax.com/showthread.php?109427-Inter-Cog-Communication
Faster Inter-Propeller Communication by Synapse
http://forums.parallax.com/showthread.php?128714-Fast-Inter-Propeller-Communication
Useful 1-Wire Routines by Cam Thompson
http://obex.parallax.com/objects/18/
Special Comments by Mike Green
http://forums.parallax.com/showthread.php?129357-BS2_Functions.spin-Timing-question
The routines in BS2_Functions.spin are written for the general case and are written completely in Spin without any use of assembly language. Spin is interpreted and while much faster than the BS2 equivalent operations, is much slower than assembly language. For example, a serial input/output routine completely written in Spin will operate up to 19.2KBps with an 80MHz Propeller system clock (5MHz crystal * 16 with the PLL multiplier). The equivalent using an assembly language low-level serial I/O routine (FullDuplexSerial) can go well over 230KBps at 80MHz. The same sort of thing is true for clocked serial I/O (SHIFTIN / SHIFTOUT), but more so. The Spin routines are comparable to the asynchronous serial versions, but, using assembly and some other features (like the cog counters), you can easily get 10MHz clock speeds. There have been some special purpose serial I/O routines written (for Prop to Prop communications) that operate at 20MHz with an 80MHz system clock.
Tweaks and Experiments by Lawson
http://forums.parallax.com/showthread.php?114492-Prop-Baudrates
jm_txrx_demo_tweeked.zip
termv19b.zip
Multiple Instances of Full Duplex Serial Interfacing
http://forums.parallax.com/showthread.php?129464-Multiple-instances-of-Full-Duplex-Serial-interacting
For C-Like Language functions Using Spin
cserial.spin As noted by Dave Hein
http://forums.parallax.com/showthread.php?121206-cserial
cserial.spin
cserial_test.spin
It's not written in C. It's written in Spin. It's part of the CLIB object, which provides C-like functions for Spin programs. However, cserial itself does not have any C attributes. This is part of the CLIB object in the OBEX. It is yet another modified version of FDS that does not use VAR variables, but either uses buffers that are defined in DAT or buffers that are provided by the calling program, in which case it uses a handle to reference them. The bufferes can be any power of 2 in size, and the rx and tx buffers can be different sizes. There is an additional feature where an instance can be protected by a lock to make it cog-safe. I included all of the old routines of FullDuplexSerial for compatibility, and I added new versions that require a device handle.· The new versions use the same name, but with a 1 added.· As an example, the new version of str is str1.
· - Multiple serial ports may be started from any object or cog
· - Any serial port is accessable from any object or cog using a device handle
· - Transmit and receiver buffers can be different sizes
· - Buffer sizes are defined by calling parameters
· - Mode bit 4 enables the use of a lock to make the transmit multi-cog safe
The cserial.spin object in CLib can handle multiple cogs.· You call it the same way you would call the FullDuplexSerial methods, except you set bit 4 in the mode flag to make it·cog-safe.· You would call the start·function as follows: fd.start(31, 30, %10000, 115200)
The·start method·should only be called once, normally from cog 0 in the top object.· Check out the test program in CLib.· I have several cogs waiting on the same flag, and then they all print at the same time.
You can download CLib from the OBEX at http://obex.parallax.com/objects/594/·.
http://forums.parallax.com/showthread.php?122169-Ho-to-reuse-FullDuplexSerial-from-multiple-COGs-RESOLVED-use-cserial
Send information to a computer using the FullDuplexSerial object
http://forums.parallax.com/showthread.php?129795-FullDuplexSerial-communication-problems
Thread by Mlanting
In order to do serial communication you need a clock calibrated more accurately than what the internal oscillator is. You need to use an external crystal.
rxSerialTest-bst-archive-110630-121933.zip by Tracey Allen
Remarkable lowest current drain (1mA) RX communications code
http://forums.parallax.com/showthread.php?128184-Serial-Objects-for-SPIN-Programming&p=1014074&viewfull=1#post1014074
I had need for receiving infrequent but unpredictable packets of data at 115200 baud, with the hitch that the system had to operate at low current. That means clkfreq=5MHz if possible. The attached program rxSerial_ta_10.spin works for this. It is receive-only with an intrinsic current drain of 1 mA. Other programs that I tried, even those that were not rx-only, would not reach 115200 for general purpose buffering to hub ram at clkfreq=5MHz. Most talk has been about high speed, not low current. The problem is really the same as receiving at 1.8 megabaud with an 80MHz clkfreq (I = 16 mA). The trick was to rearrange the stuff that has to happen during the 1.5 bit times between the middle of the last data bit and the end of the stop bit, 65 clock ticks at 5MHz/115200baud. I hope this will be useful to others, and of course constructive comments are welcome.
Modified rxSerialDemo-bst-archive-110630-191917.zip by Tracey Allen
http://forums.parallax.com/showthread.php?128184-Serial-Objects-for-SPIN-Programming&p=1014272&viewfull=1#post1014272
I modified the demo for my rxSerial_ta_10. Now it can run on a single prop, with one cog sending the test data to the receiving cog under test. The transmitter is dedicated to sending a fixed string of characters pulled from cog memory over and over at the selected baud rate and at a selected interval. You can try mismatched baud rates. The rx and tx pins on the Prop are tied together and the debugging data goes out the p31 system port. This tx routine transmits with very close to one stop bit without extra for pulling the next byte from memory, and easily does 115200 on a 5MHz clock. Routines that transmit a string from spin always add a little extra time between bytes, so they are not as challenging to the receiver. I've been testing also with a logic analyzer, to visualize the event positions. You can see the position of the ready-for-start pulse wander depending on how the routine hits the hub access. It has to stay within a margin of the stop bit. rsSerial_ta_10 cut off one hub access by storing the head pointer in the cog, writing but not reading it. (Transmit is easier than receive. Most of the pasm tx routines should reach pretty high baud rates. For example JonnyMac's JM_txserial.)
JM_txserial by JonnyMac
http://www.google.com/url?sa=t&source=web&cd=1&sqi=2&ved=0CBgQFjAA&url=http%3A%2F%2Fforums.parallax.com%2Fattachment.php%3Fattachmentid%3D70747%26d%3D1275281933&rct=j&q=jm_txserial&ei=NAcOToePN7LdiAK1pY2FDg&usg=AFQjCNFmwnnl_8u-otvk1NEjeUsr-TICTA&cad=rja
True mode serial transmit driver -- with buffer
Tired of endlessly looking for the serial object you need? This list bypasses the limited OBEX-search function and lists the primary serial objects along with their specific links, authors, and information. Includes SPIN objects and one parallel object. Includes special serial objects, some customized, from posts which may not be in the OBEX.
Simple Serial by Chip Gracey - Parallax
http://obex.parallax.com/objects/183/
Bit-bang serial driver for low baud rate (~19.2K) devices. * This driver is designed to be method-compatible with the FullDuplex serial object, allowing it to be used when high speed comms or devoting an independent cog for serial I/O is not necessary. * Bi-directional communication on the same pin is also supported.
Faster Simple Serial with Parity by Marc Gebauer
http://forums.parallax.com/showthread.php?109781-Faster-Simple-Serial-with-Parity
I had·the use for a serial driver that would do 38400 BAUD, 8 bit, even·parity and would'nt use a cog. I didn't need full duplex operation, so I played around with Simple_Serial. Here it is. I call it Fast_Simple_Serial. I have tested send and receive·from 300·to 38400 BAUD with no-parity, even-parity, and odd-parity. Note, the receiver ignores the parity bit. I have added a Demo object that was written for the Propellor Demo Board·which sends and receives to and from the USB FTDI Serial Port and is intended to·connect·with Hyperterminal. Basically when you type on the keyboard in Hyperterminal, the keys are echo'd back.
Full Duplex Serial by Chip Gracey - Parallax
http://obex.parallax.com/objects/54/
Full duplex asynchronous serial object. It will do 115,200 and has 16 byte buffers.
Modified Tim Moore's 4 port driver By Juergen Buchmueller
http://forums.parallax.com/showthread.php?128184-Serial-Objects-for-SPIN-Programming&p=962912#post962912
See post #7 on this thread's page
supports only two ports but with bigger buffers - big enough for an xmodem packet. (64 bytes increased to 256 bytes).
Extended Full Duplex Serial by Martin Hebel
http://obex.parallax.com/objects/31/
Extends out FullDuplexSerial to allow reception of character strings that end in a carriage return for decimal, hexadecimal and alpha-numeric uses. Allows use of timeout values. This version also allows use of defined delimiter characters, and returning whole and fractional portions of a numeric string.
FullDuplexSerial_rr004 by Cluso99
http://obex.parallax.com/objects/570/
FullDuplexSerial object v1.2 with modification to allow easy resizing of buffers 8/16/32/64/128/256 by specifying size in CON section of code only. (Does not do 512)
FullDuplexParallel by Terry E Trapp, KE4PJW
http://obex.parallax.com/objects/644/
This is the FullDuplexParallel object v1.0. It is based on the FullDuplexSerial object v1.1 from the Propeller Tool's Library folder with modified documentation and methods for converting text strings into numeric values in several bases. It interfaces the propeller with the FTDI FT245 Parallel FIFO. The FTDI FT245 allows for high performance I/O to a PC.
FullDuplexSerial_mini.spin by Rkrasowski
Stuff commented out which is not used.
http://forums.parallax.com/showthread.php?129460-Not-enough-COGs
http://forums.parallax.com/attachment.php?attachmentid=78079&d=1297305158
Fast 250Kbps fullduplexserial obex object by Clock Loop
http://forums.parallax.com/showthread.php?120273-Inter-Propeller-communication
http://forums.parallax.com/showthread.php?p=820293
Full Duplex Serial Port Driver by Kwabena W. Agyeman
http://obex.parallax.com/objects/397/
A full duplex serial port driver that runs on one cog. The code has been fully optimized with a super simple spin interface for maximum speed and is also fully commented. Provides full support for: Receiving bytes, Receiving strings, Transmitting bytes, Transmitting strings, Baud Rate from 1 BPS to 250,000 BPS - Full Duplex. This driver has a 256 byte receiving FIFO buffer. This driver has a 256 byte transmitting FIFO buffer.
Full duplex 8.42 MegBaud output to parallax serial Terminal demo by Clock Loop. Thread here Download here You can force error packets if you lift the 10k resistor on the rx pin.
(14.5 Meg Baud) High Speed Prop-to-Prop Serial Communication by Beau
http://forums.parallax.com/showthread.php?99222-Propeller-DEMO-%2814.5-Meg-Baud%29-High-Speed-Prop-to-Prop-Serial-Communication
http://forums.parallax.com/showthread.php?p=694610
I have run this DEMO and tested over 100 Billion data Bits with no Transmission Errors over the distance of 10 feet from one Propeller to another Propeller. “14.5 Meg Baud Upgrade using 4 I/O Pins.... This is still work in progress.· Using only 1 COG for the Transmitter, and 1 COG for the Receiver, 14.5 Mega Baud Communication Packets can be achieved. With slight modification to the "Transmitter" (using 1 COG) and "Receiver" (using 2 COGs ; 180 deg out of phase) 29 Mega Baud communication packets should be achieved through the current implementation of 4 - I/O pins. The current demo sends pseudo random Packets with a length of 32768 bits in approximately 2.25mS (<-14.5Mega Baud) at a repetition rate of 174 Hz effectively providing a constant throughput of 5.7 Mega Baud.· Keep in mind that the 174 Hz is deterministic of the overhead required for the display and Packet confirmation.· Also, the demo provides a "real time" visual representation of the Transmitter's I/O state displayed on the·Receiver screen.
SerialMirror by Mirror
http://obex.parallax.com/objects/189/
A FullDuplexSerial enhancement that allows a single serial connection to be used from within multiple spin files. Primarily aimed as a debugging aid, this file also illustrates how to use the DAT section to make single-instance objects which may be called from multiple spin files. This objects allows relatively easy change of Rx and Tx buffer sizes to the various powers of 2.
MultiCogSerialDebug by Peter Verkaik
http://obex.parallax.com/objects/232/
Derived from SerialMirror V07.05.10 All printing (also from multiple COGs) is done using cprintf. Each cprintf call is a message. The more parameter in cprintf lets you prohibit that the message is interleaved with text from another COG. To keep output clear, end each (compound) message with a \r or \r\n. Receiving should be done by a single COG that can dispatch received messages. See the test program for detailed usage.
Multiple serial port driver by Tim Moore
http://obex.parallax.com/objects/340/
Supports upto 4 serial ports with 1 COG. Also supports hardware flow control on any of the ports.
Tim Moore's pcFullDuplexSerial4FC with larger rx buffer by Duane Degn
http://forums.parallax.com/showthread.php?129714-Tim-Moore-s-pcFullDuplexSerial4FC-with-larger-rx-buffer
pcFullDuplexSerial4FCex.spin uses one cog to control up to four serial ports. After studying the code for a while, I saw how Tim reused the variable space in the hub after the cog is launched. After tracking down which variables were used by both Spin and PASM and which ones were only used within the cog, I realized there was even more space that could be reclaimed. At the cost of three longs, I was able to double the rx buffer from 64 byte per port to 128 bytes per port.
JDCogSerial by Carl Jacobs
http://obex.parallax.com/objects/398/
A full duplex serial that has *ALL* the buffer memory stored in the COG. The VAR footprint is tiny at only 6 longs. The buffer pointers are fully automatic, which allows easy access from assembly as well as sub-objects. The buffer sizes may be set at any number of bytes (in multiples of 4) to the total spare capacity of the COG (a bit over 1300 bytes). Only mode 0 is supported, with baud rates to above 345600 for a 80MHz clock.
Parallax Serial Terminal by Jeff Martin - Parallax
http://obex.parallax.com/objects/457/
This object works with the Parallax Serial Terminal; see Propeller Downloads page or install Propeller Tool v1.2.6 (or newer). It includes handy methods for output/input (Char, CharIn, Str, StrIn, Dec, DecIn, Bin, BinIn, Hex, HexIn) and cursor positioning (Home, Position, NewLine, MoveLeft, MoveRight, etc.) as well as control character constants that match the function of the Parallax Serial Terminal. A demo and a "quick start" template are provided.
jm_irtxserial by Jon McPhalen
http://obex.parallax.com/objects/462/
Allows for serial transmission (up to 2400 baud) over an IR link. Compatible with output methods of simple_serial and fullduplexserial.
Half Duplex Serial Port Driver by Kwabena W. Agyeman
http://obex.parallax.com/objects/538/
A half duplex serial port driver. The code has been fully optimized with a super simple spin interface for maximum speed and is also fully commented. Provides full support for: Even parity bit generation, Even parity bit checking, Odd parity bit generation, Odd parity bit checking, Mark parity bit generation, Mark parity bit checking, Space parity bit generation, Space parity bit checking, Receiving bytes, Receiving strings, Transmitting bytes, Transmitting strings, Baud Rate from 1 BPS to 19,200 BPS - Half Duplex.
Serial Com by Aleks
obex.parallax.com/objects/356/
A communication routine loosely based on I2C with included demo programs to communicate between two Propeller IC's.
~note-> This has only been tested on the Spin Stamp, whereas this is the only propeller I have access to. It requires a CS, SDA, and CLK line to operate. I have had success communicating between the two stamps I used, and displaying the results on an LCD screen. My contact info is in the Readme.txt.
spin FD_Serial_Conf.spin by Andy
http://forums.parallax.com/showthread.php?111836-Custom-Serial&p=797716
http://forums.parallax.com/attachment.php?attachmentid=59874&d=1239071285
Here is a variation of the FullDuplexSerial object, which allows configuration of the datasize 7..9 bits, with an additional Parity bit. Also the Buffer size can easy be changed.
Fast Inter-Propeller Communication by Bobb Fwed
http://forums.parallax.com/showthread.php?117840-Fast-Inter-Propeller-Communication-Object
obex.parallax.com/objects/546/
http://forums.parallax.com/showthread.php?118076-Fast-Inter-Propeller-Communication-Features
I just tested it at 100MHz and got a throughput of 1.37MB/s (including all overhead). Also tested at 80MHz producing 1.10MB/s. It has been tested with over a meter of wiring between two Propellers, but i can't see why it wouldn't work with much longer wires.
[POC] single wire high speed serial link (updated 20101124) by kuroneko
http://forums.parallax.com/showthread.php?110325-POC-single-wire-high-speed-serial-link-%28updated-20101124%29
FastSerial by Peter Jakacki
http://forums.parallax.com/showthread.php?114492-Prop-Baudrates
Half-duplex high speed precision serial driver. Adapted from FullDuplexSerial, This driver dedicates a cog to either receiving or transmitting serial data in a half-duplex fashion. The aim is to have precise bit timing which is important at high-speeds at and above 115K baud. The transmit routines have been to tested to 1Mbit and the receive routines work at 1Mbit
HighSpeed Serial Tx (3Mbps) / Rx (2Mbps) + autobaud for FT232R/Prop GPL by Stephen Moraco
http://forums.parallax.com/showthread.php?102696-HighSpeed-Serial-Tx-%283Mbps%29-Rx-%282Mbps%29-autobaud-for-FT232R-Prop-GPL&p=720623
This is a set of block-send and block-receive routines.· That is they are designed to reduce communication between cogs by only transporting data between them on buffer-full or line-end events.
Other Communication Software & Techniques
Full-speed (12 Mb/s) bit-banging USB Host controller by Scanlime
http://forums.parallax.com/showthread.php?121321-Working-full-speed-%2812-Mb-s%29-bit-banging-USB-Host-controller
So far it supports Control, Bulk IN/OUT, and Interrupt IN transfers. There are a couple simple demos included: Device enumeration and descriptor parsing, a very simple HID demo, and an even simpler mass storage demo. As you'd expect, there is a huge list of caveats for something that pushes the limits of the Propeller and the USB spec to this extent.. It uses four cogs, requires overclocking the Prop to 96 MHz, and even though the line rate is 12 Mb/s the actual usable data throughput is significantly lower. But, this lets you talk to a lot of fun new peripherals that were previously unavailable to the Propeller. So it should be fun
XModem receive routine for use with CP/M by Mike Green
http://forums.parallax.com/showthread.php?114023-Sphinx%E2%80%94as-seen-at-UPEW!/page10
It uses a simple checksum even though there's a CRC variable. The return value is the length of the file received.
BS2 Functions Communications by Juffra
http://forums.parallax.com/showthread.php?120273-Inter-Propeller-communication
5Mbit/sec ASCII Streaming from/to Hub RAM by Pjv
http://forums.parallax.com/showthread.php?120125-5Mbit-sec-ASCII-streaming-from-to-Hub-RAM&p=882980
Inter cog communications in Spin by SRLM
http://forums.parallax.com/showthread.php?109427-Inter-Cog-Communication
Inter cog communications in Assembly by Mctrivia
http://forums.parallax.com/showthread.php?109427-Inter-Cog-Communication
Variable access across cogs by StefanL38
http://forums.parallax.com/showthread.php?109427-Inter-Cog-Communication
Faster Inter-Propeller Communication by Synapse
http://forums.parallax.com/showthread.php?128714-Fast-Inter-Propeller-Communication
Useful 1-Wire Routines by Cam Thompson
http://obex.parallax.com/objects/18/
Special Comments by Mike Green
http://forums.parallax.com/showthread.php?129357-BS2_Functions.spin-Timing-question
The routines in BS2_Functions.spin are written for the general case and are written completely in Spin without any use of assembly language. Spin is interpreted and while much faster than the BS2 equivalent operations, is much slower than assembly language. For example, a serial input/output routine completely written in Spin will operate up to 19.2KBps with an 80MHz Propeller system clock (5MHz crystal * 16 with the PLL multiplier). The equivalent using an assembly language low-level serial I/O routine (FullDuplexSerial) can go well over 230KBps at 80MHz. The same sort of thing is true for clocked serial I/O (SHIFTIN / SHIFTOUT), but more so. The Spin routines are comparable to the asynchronous serial versions, but, using assembly and some other features (like the cog counters), you can easily get 10MHz clock speeds. There have been some special purpose serial I/O routines written (for Prop to Prop communications) that operate at 20MHz with an 80MHz system clock.
Tweaks and Experiments by Lawson
http://forums.parallax.com/showthread.php?114492-Prop-Baudrates
jm_txrx_demo_tweeked.zip
termv19b.zip
Multiple Instances of Full Duplex Serial Interfacing
http://forums.parallax.com/showthread.php?129464-Multiple-instances-of-Full-Duplex-Serial-interacting
For C-Like Language functions Using Spin
cserial.spin As noted by Dave Hein
http://forums.parallax.com/showthread.php?121206-cserial
cserial.spin
cserial_test.spin
It's not written in C. It's written in Spin. It's part of the CLIB object, which provides C-like functions for Spin programs. However, cserial itself does not have any C attributes. This is part of the CLIB object in the OBEX. It is yet another modified version of FDS that does not use VAR variables, but either uses buffers that are defined in DAT or buffers that are provided by the calling program, in which case it uses a handle to reference them. The bufferes can be any power of 2 in size, and the rx and tx buffers can be different sizes. There is an additional feature where an instance can be protected by a lock to make it cog-safe. I included all of the old routines of FullDuplexSerial for compatibility, and I added new versions that require a device handle.· The new versions use the same name, but with a 1 added.· As an example, the new version of str is str1.
· - Multiple serial ports may be started from any object or cog
· - Any serial port is accessable from any object or cog using a device handle
· - Transmit and receiver buffers can be different sizes
· - Buffer sizes are defined by calling parameters
· - Mode bit 4 enables the use of a lock to make the transmit multi-cog safe
The cserial.spin object in CLib can handle multiple cogs.· You call it the same way you would call the FullDuplexSerial methods, except you set bit 4 in the mode flag to make it·cog-safe.· You would call the start·function as follows: fd.start(31, 30, %10000, 115200)
The·start method·should only be called once, normally from cog 0 in the top object.· Check out the test program in CLib.· I have several cogs waiting on the same flag, and then they all print at the same time.
You can download CLib from the OBEX at http://obex.parallax.com/objects/594/·.
http://forums.parallax.com/showthread.php?122169-Ho-to-reuse-FullDuplexSerial-from-multiple-COGs-RESOLVED-use-cserial
Send information to a computer using the FullDuplexSerial object
http://forums.parallax.com/showthread.php?129795-FullDuplexSerial-communication-problems
Thread by Mlanting
In order to do serial communication you need a clock calibrated more accurately than what the internal oscillator is. You need to use an external crystal.
OBJ serial : "FullDuplexSerial" PUB Main serial.Start(31, 30, 0, 9600) repeat serial.str(string("test")) waitcnt(clkfreq + cnt)
rxSerialTest-bst-archive-110630-121933.zip by Tracey Allen
Remarkable lowest current drain (1mA) RX communications code
http://forums.parallax.com/showthread.php?128184-Serial-Objects-for-SPIN-Programming&p=1014074&viewfull=1#post1014074
I had need for receiving infrequent but unpredictable packets of data at 115200 baud, with the hitch that the system had to operate at low current. That means clkfreq=5MHz if possible. The attached program rxSerial_ta_10.spin works for this. It is receive-only with an intrinsic current drain of 1 mA. Other programs that I tried, even those that were not rx-only, would not reach 115200 for general purpose buffering to hub ram at clkfreq=5MHz. Most talk has been about high speed, not low current. The problem is really the same as receiving at 1.8 megabaud with an 80MHz clkfreq (I = 16 mA). The trick was to rearrange the stuff that has to happen during the 1.5 bit times between the middle of the last data bit and the end of the stop bit, 65 clock ticks at 5MHz/115200baud. I hope this will be useful to others, and of course constructive comments are welcome.
Modified rxSerialDemo-bst-archive-110630-191917.zip by Tracey Allen
http://forums.parallax.com/showthread.php?128184-Serial-Objects-for-SPIN-Programming&p=1014272&viewfull=1#post1014272
I modified the demo for my rxSerial_ta_10. Now it can run on a single prop, with one cog sending the test data to the receiving cog under test. The transmitter is dedicated to sending a fixed string of characters pulled from cog memory over and over at the selected baud rate and at a selected interval. You can try mismatched baud rates. The rx and tx pins on the Prop are tied together and the debugging data goes out the p31 system port. This tx routine transmits with very close to one stop bit without extra for pulling the next byte from memory, and easily does 115200 on a 5MHz clock. Routines that transmit a string from spin always add a little extra time between bytes, so they are not as challenging to the receiver. I've been testing also with a logic analyzer, to visualize the event positions. You can see the position of the ready-for-start pulse wander depending on how the routine hits the hub access. It has to stay within a margin of the stop bit. rsSerial_ta_10 cut off one hub access by storing the head pointer in the cog, writing but not reading it. (Transmit is easier than receive. Most of the pasm tx routines should reach pretty high baud rates. For example JonnyMac's JM_txserial.)
JM_txserial by JonnyMac
http://www.google.com/url?sa=t&source=web&cd=1&sqi=2&ved=0CBgQFjAA&url=http%3A%2F%2Fforums.parallax.com%2Fattachment.php%3Fattachmentid%3D70747%26d%3D1275281933&rct=j&q=jm_txserial&ei=NAcOToePN7LdiAK1pY2FDg&usg=AFQjCNFmwnnl_8u-otvk1NEjeUsr-TICTA&cad=rja
True mode serial transmit driver -- with buffer
Comments
Serial MegBaud. (8.42 megbaud)
http://forums.parallax.com/showthread.php?99222-Propeller-DEMO-%2814.5-Meg-Baud%29-High-Speed-Prop-to-Prop-Serial-Communication&highlight=megbaud
Simple Serial by Chip Gracey - Parallax
Faster Simple Serial with Parity by Marc Gebauer
Full Duplex Serial by Chip Gracey - Parallax
Extended Full Duplex Serial by Martin Hebel
FullDuplexSerial_rr004 by Cluso99
FullDuplexParallel by Terry E Trapp, KE4PJW
Full Duplex Serial Port Driver by Kwabena W. Agyeman
Full duplex 8.42 MegBaud output to parallax serial Terminal demo by Clock Loop
(14.5 Meg Baud) High Speed Prop-to-Prop Serial Communication by Beau
SerialMirror by Mirror
MultiCogSerialDebug by Peter Verkaik
Multiple serial port driver by Tim Moore
JDCogSerial by Carl Jacobs
Parallax Serial Terminal by Jeff Martin - Parallax
jm_irtxserial by Jon McPhalen
Serial Com by Aleks
Half Duplex Serial Port Driver by Kwabena W. Agyeman
spin FD_Serial_Conf.spin by Andy
By Juergen Buchmueller
Fast Inter-Propeller Communication by Bobb Fwed
XModem receive routine for use with CP/M by Mike Green
This is a nice post. It is good to be able to look at the available options from a glance.
Bruce
Another reason the prop is great!
As it stands, it only covers fullDuplexSerial v1.2, pcFullDuplexSerial4FC, and ParallaxSerialTerminal.
Multiple serial port driver by Tim Moore
http://obex.parallax.com/objects/340/
Supports up to 4 serial ports with 1 COG. Also supports hardware flow control on any of the ports.
One tiny issue has to do with the spin code for outputting decimal data and has to do with the maximum negative value (NEGX). This is an issue that bumped the original fullDuplexSerial from version 1.1 to 1.2. NEGX otherwise displays as zero. In the DECL(port,value) method, think about changing to
Having serial.out would allow most serial drivers to be quickly swapped with TV/VGA drivers.
"I'm sure Beau could give some tips on accomplishing this."
I'd have to get my head around it again, but one thought would still be to setup a defined master and a defined slave.
The master initially sends data while the slave receives, and then "since they are in sync" the slave becomes the transmitter on the same lines while the master listens. You could define an area of memory on each side (master and slave) that gets written to and read from. It may not be wise to share the same location for transmit or receive. The throughput would be half of the 14.5 Meg Baud, but you would in essence create a high speed bi-directional conduit between two props where data could be read or written with other cogs.
InterComm by Bruce Drummond
http://forums.parallax.com/showthread.php?129118-Looking-for-suggestions-pertaining-to-new-object
Prop to Prop custom message creation with parsing
Full-speed (12 Mb/s) bit-banging USB Host controller by Scanlime
So far it supports Control, Bulk IN/OUT, and Interrupt IN transfers. There are a couple simple demos included: Device enumeration and descriptor parsing, a very simple HID demo, and an even simpler mass storage demo. As you'd expect, there is a huge list of caveats for something that pushes the limits of the Propeller and the USB spec to this extent.. It uses four cogs, requires overclocking the Prop to 96 MHz, and even though the line rate is 12 Mb/s the actual usable data throughput is significantly lower. But, this lets you talk to a lot of fun new peripherals that were previously unavailable to the Propeller. So it should be fun
[POC] single wire high speed serial link (updated 20101124) by kuroneko
explaining the nature of serial spin vs serial assembly and
the effects of the two combined.
http://forums.parallax.com/showthrea...-to-new-object
Bruce Drummond removed all his attached code from all his posts. Therefore, the link is removed from this list as well.
http://forums.parallax.com/showthread.php?114492-Prop-Baudrates
jm_txrx_demo_tweeked.zip
termv19b.zip
I can get your "jm_rxserial" to receive garbage too at 2_000_000 baud and 2 stop bits. With some small tweeks though I've been able to get the code working at 1_500_000 baud and 2 stop bits. (commented out a waitcnt after the ASM byte receive loop, and boosted the RX buffer)
The attached serial terminal is something I found on the 'net to let me send and receive binary bytes over rs232 without having to resort to programming. When I set it to a custom baud rate of 2_000_000 baud, type something into the transmit text box and hit send, garbage sometimes comes back. This terminal program won't do this when I tell it to "send file". My best guess is that whatever text is in the send box is dumped into the TX buffer of the FTDI chip in one block so the FTDI outputs RS232 bytes with no gaps. (setting 2 stop bits helps but won't fix this)
FullDuplexSerial_mini.spin by Rkrasowski
Multiple Instances of Full Duplex Serial Interfacing
and
cserial.spin