UNICOM - New universal asynchronous serial communications object proposal
Peter Jakacki
Posts: 10,193
I have been meaning to place some of my serial comms methods into the obex but having time to play and tidy up code is usually way down on the list. However at the moment I have some time and in tidying up one object for RS485 use I decided to unify the serial comms routines I use into one universal object. Of course nothing is ever universal but this one covers all that I need to do which is usually a lot more than most forum members require. Most of these features have been implemented and some have to be finalized and tested but all have to be massaged into a simple and sensible object interface. If you think that it would be nice for some other feature to be included or modified then let me know.
The aim of this object is to encapsulate the methods in such a way that the object itself does not need to be tweaked, that is, the user program supplies the compile-time switches and run-time parameters. This object is designed for the extra functions that BST provides so it won't run in it's original form on the Propeller Tool. Besides, BST is a multiplatform IDE and penguins rule here as my computers run Linux as the main O/S. If the OBEX is picky about this then maybe we should have a location for objects and examples in general. I have just setup a group to collect all those odd files that are not part of the obex at Google and Yahoo, any opinions ? Rough setup for evaluation at groups.google.com.au/group/propfiles and tech.groups.yahoo.com/group/propfiles/
By default if only the "start" method is used the object will behave just like the FullDuplexSerial object with it's own buffers etc. Using a compile time switch the user may specify external buffers and sizes. Constants cannot be passed to an object at compile time so the buffer pointers and sizes are initialized at run-time by the user program if desired. Setting databits to more than 8 bits will cause the driver to assign multiple bytes to each "character" which will be read and written as one word.
I will probably do an first release and then keep testing and adding additional features. I know some have released serial drivers but I'm not sure what features they have and besides trying locate the original threads again is a pain.
Here's a very quick overview:
UNICOM ASYNCH - Universal Asynchronous Serial Communications Object (Compiles under BST)
Features:
* Object method to set buffer sizes with user supplied buffers (defaults to internal buffers)
* Variable data bits up to 32 bits
* Variable transmit stop bits (default 1) - can also be used for pacing characters - receive only expects one stop bit.
* Full/Half-duplex modes
* Operation to in excess of 1Mbit (half-duplex)
* High-speed mode 10Mbit mode (half-duplex) - modified version of Brandon Nimon's code integrated into driver.
* RTS/CTS control or XON/XOFF control with configurable triggers (default none)
* RS-485 support (combo rx/tx or independent pins)
* Parity generation and detection
* Break generation and detection action (reboot etc)
* Command sequence detection and action (gap...sequence...gap) - This allows the serial cog to perform an action independently of the main program
* Packet support
- Gap detection and action (Start frame, signal end-of-frame etc)
- Checksum and CRC generation and reception
- MODBUS RTU support - Automatic start of frame and checksum
- 9-bit mode address wakeup
* ANSI drawing and general commands (PLAIN, REVERSE, BOLD, FG, BG, RECT, LINE, large BLOCK characters, etc)
* Object access methods include access to control and status registers and read features & version
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
The aim of this object is to encapsulate the methods in such a way that the object itself does not need to be tweaked, that is, the user program supplies the compile-time switches and run-time parameters. This object is designed for the extra functions that BST provides so it won't run in it's original form on the Propeller Tool. Besides, BST is a multiplatform IDE and penguins rule here as my computers run Linux as the main O/S. If the OBEX is picky about this then maybe we should have a location for objects and examples in general. I have just setup a group to collect all those odd files that are not part of the obex at Google and Yahoo, any opinions ? Rough setup for evaluation at groups.google.com.au/group/propfiles and tech.groups.yahoo.com/group/propfiles/
By default if only the "start" method is used the object will behave just like the FullDuplexSerial object with it's own buffers etc. Using a compile time switch the user may specify external buffers and sizes. Constants cannot be passed to an object at compile time so the buffer pointers and sizes are initialized at run-time by the user program if desired. Setting databits to more than 8 bits will cause the driver to assign multiple bytes to each "character" which will be read and written as one word.
I will probably do an first release and then keep testing and adding additional features. I know some have released serial drivers but I'm not sure what features they have and besides trying locate the original threads again is a pain.
Here's a very quick overview:
UNICOM ASYNCH - Universal Asynchronous Serial Communications Object (Compiles under BST)
Features:
* Object method to set buffer sizes with user supplied buffers (defaults to internal buffers)
* Variable data bits up to 32 bits
* Variable transmit stop bits (default 1) - can also be used for pacing characters - receive only expects one stop bit.
* Full/Half-duplex modes
* Operation to in excess of 1Mbit (half-duplex)
* High-speed mode 10Mbit mode (half-duplex) - modified version of Brandon Nimon's code integrated into driver.
* RTS/CTS control or XON/XOFF control with configurable triggers (default none)
* RS-485 support (combo rx/tx or independent pins)
* Parity generation and detection
* Break generation and detection action (reboot etc)
* Command sequence detection and action (gap...sequence...gap) - This allows the serial cog to perform an action independently of the main program
* Packet support
- Gap detection and action (Start frame, signal end-of-frame etc)
- Checksum and CRC generation and reception
- MODBUS RTU support - Automatic start of frame and checksum
- 9-bit mode address wakeup
* ANSI drawing and general commands (PLAIN, REVERSE, BOLD, FG, BG, RECT, LINE, large BLOCK characters, etc)
* Object access methods include access to control and status registers and read features & version
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Comments
One of the annoying things I find is that I would like to be able to substitute the object from keyboard/video to serial and back again easily. For example, fdx.tx vs tv.out
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Ohh..release soon ,Please....
Modbus RTU .....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=================
The future is in our hands.
Which way to the future?
=================
You made me drool over UNICOM in my PropCade thread... and now I find it even has Modbus support! I used to work with Modbus, Modbus+ and Modbus/TCP a LOT.
I quickly jumped over to the two groups you mentioned to look for the files... alas, they are MIA.
Please release this soon!
(Excellent work, btw)
Thanks,
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com 5.0" VGA LCD in stock!
Morpheus dual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory/IO kit $89.95, both kits $189.95 SerPlug $9.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler Largos - upcoming nano operating system
1. Echo back the received character
2. A received backspace character removes the previously received character and send BS, SP, BS to output
3. Enable multiple serial ports per cog with an aggragate TX/RX rate of 500 kbps
4. Optional use of a lock for multi-cog access
Items 1 and 2 are useful for console I/O.· Item 3 would allow several low rate serial ports in one cog.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.com
Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
I too would like this. Please release it soon.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"powered by Propeller" domed stickers $1.50 - Find them here
Check out my Design and Technology project for my Higher School Certificate www.ecosureblog.net
The Sarah Myatt Fund - Help Sarah and Her Family Fight Quadriplegia HERE
Impressive characteristics !!! I want it now !!!
Well done.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
I meant to finish it this month but I have been sidetracked this past week doing my new PUPPY Prop module. Some of those serial functions could be handled nicely by the PPC on the module and I am quite tempted to do so but we still need an object for stand-alone Props too (back to the real world). I will try to get the object polished and tested in the next week or two.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Be carrefully, with your PUPPY prop module you'll send me to bankrupt too Looks really great, and your suggested price is impossible.
How do you do that ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
How do I do it? Not easy, the price is really low and my margin is really slim but choosing the right components in the right quantities makes it easier. I want to try to keep it low though. The Silabs chip has bumped up my cost a little and just now I have done some more research and found an AT XMEGA A4 chip which is almost half the price and I think it's a lot better.....what to do? Oh, the humanity!
I want all this stuff now too, only trouble is I have to get up and put my nose to the grindstone to get it
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Any news on your comm object?
Regards,
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com
My products: Morpheus / Mem+ / PropCade / FlexMem / VMCOG / Propteus / Proteus / SerPlug
and 6.250MHz Crystals to run Propellers at 100MHz & 5.0" OEM TFT VGA LCD modules
Las - Large model assembler Largos - upcoming nano operating system
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Yes, two features in particular:
RS485 with combined rx/tx
Modbus RTU
I have four products with RS485 chips coming out at UPEW... PropCade, 485Plug, and a surprise or two [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com
My products: Morpheus / Mem+ / PropCade / FlexMem / VMCOG / Propteus / Proteus / SerPlug
and 6.250MHz Crystals to run Propellers at 100MHz & 5.0" OEM TFT VGA LCD modules
Las - Large model assembler Largos - upcoming nano operating system
Post Edited (Bill Henning) : 5/31/2010 10:55:09 PM GMT
Any progress with UNICOM?
Thanks,
Bill
UNICOM sounds really neat.
There is one important thing I would like to see. The possibility to use the compiled PASM code, as extracted with BSTL without any dependence on Spin. That is to say that all parameters go in to PASM via PAR and when running the only interaction with the outside application is through a given memory area. Plus there would be no "poking" of parameter LONGs into the DAT section prior to loading it to COG.
This kind of interface is required such that an object can be used with languages other than Spin. In my case C or C++ running under the Zog interpreter. But this kind of interface has been discussed a few times on the forum by others, for example in connection with reusing objects with PropBASIC or Catalina.
"- MODBUS RTU support - Automatic start of frame and checksum"
Thanks,
Dave
I have been playing with other micros lately and haven't had that much time to spend on the Prop However, just the other day I updated my serial drivers as I needed some high-speed serial and precise bit-timing (start bit, sampling offset etc). By using self-modifying PASM code I was able to run over 2M baud easily although at this speed the driver splits this onto dedicated cogs (oh well).
I will look into optimizing this a little bit more and taking in some of the suggestions and requests as I integrate these routines into UNICOM. So sometime in the next week I will be able to post an object.
Any suggestions on how users would like to talk to MODBUS devices from the application? I have implemented several custom methods which also involve master/slave and MODBUS over Ethernet but they aren't really for general use.
Dave
Well.............just prioritizing my work but I have been working on various components especially high-speed serial. I have been playing with a new logic analyzer that can view timing information in various formats including serial data. What I am working on now is improving the throughput at high speeds as although some objects may work at high speeds they may not be able to do so under a sustained load. This means back-to-back character reception and transmission which means buffering in the cog's memory and using simple memory access for Spin etc.
Thanks for the interest, I will post some code soon.
Best regards,
ghost