Shop OBEX P1 Docs P2 Docs Learn Events
UNICOM - New universal asynchronous serial communications object proposal — Parallax Forums

UNICOM - New universal asynchronous serial communications object proposal

Peter JakackiPeter Jakacki Posts: 10,193
edited 2011-02-02 05:21 in Propeller 1
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*

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2009-12-24 07:13
    Peter: FYI here is a modified version of FDX that I use (variable size buffer and fdx.rxavail)

    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
  • pacmanpacman Posts: 327
    edited 2009-12-24 22:03
    Peter Jakacki said...
    br>
    Features:
    * RS-485 support (combo rx/tx or independent pins)
    * Parity generation and detection
    * 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
    -

    Ohh..release soon ,Please....

    Modbus RTU .....

    yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    =================
    The future is in our hands.
    Which way to the future?
    =================
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-04-01 15:41
    Hi Peter,

    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
    Peter Jakacki said...
    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
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-04-01 20:06
    I included your first item in cserial.spin, but I don't think I have any of the other features you listed.· A few other features that might be useful are:

    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.
  • simonlsimonl Posts: 866
    edited 2010-04-01 23:40
    @Peter: This is just EXCELLENT yeah.gif Me wants it now please!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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.
  • computer guycomputer guy Posts: 1,113
    edited 2010-04-29 11:52
    @peter

    I too would like this. Please release it soon. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "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
  • BTXBTX Posts: 674
    edited 2010-04-29 17:01
    Hi Peter.
    Impressive characteristics !!! I want it now !!!
    Well done.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-04-30 00:29
    Alberto, you always want it now smile.gif

    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*
  • william chanwilliam chan Posts: 1,326
    edited 2010-04-30 00:35
    Would having so many features make the object bloated?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-04-30 01:08
    Once you have dedicated a cog to PASM it doesn't matter really whether the cog is only using 10% or 100% of it's memory. There is the DAT image in HUB memory which I would like to structure using BST in such a way that it can be reclaimed, but this is something that is common with all PASM objects. Anyway, a design well done will always be simple and functional, never bloated (as in a lot of wind).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • BTXBTX Posts: 674
    edited 2010-04-30 01:12
    Peter, yes I always want all now, and yet haha... lol.gif
    Be carrefully, with your PUPPY prop module you'll send me to bankrupt too smile.gif Looks really great, and your suggested price is impossible.
    How do you do that ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • James NewmanJames Newman Posts: 133
    edited 2010-04-30 01:13
    I could really use the modbus support... so I'm another eagerly awaiting member. [noparse]:)[/noparse]
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-04-30 02:09
    BTX said...
    Peter, yes I always want all now, and yet haha... lol.gif
    Be carrefully, with your PUPPY prop module you'll send me to bankrupt too smile.gif Looks really great, and your suggested price is impossible.
    How do you do that ?

    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 smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-05-31 18:01
    Hi Peter,

    Any news on your comm object?

    Regards,

    Bill
    Peter Jakacki said...
    BTX said...
    Peter, yes I always want all now, and yet haha... lol.gif
    Be carrefully, with your PUPPY prop module you'll send me to bankrupt too smile.gif Looks really great, and your suggested price is impossible.
    How do you do that ?

    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 smile.gif
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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 JakackiPeter Jakacki Posts: 10,193
    edited 2010-05-31 21:57
    I have a whole list of objects and projects that I "intend" to work on active both in my browser and in BST. So far the intention is good but I will make sure I devote some time to it this week to post something functional. Is there any particular feature that you are really after Bill?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-05-31 22:15
    LOL I *KNOW* that feeling...

    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]
    Peter Jakacki said...
    I have a whole list of objects and projects that I "intend" to work on active both in my browser and in BST. So far the intention is good but I will make sure I devote some time to it this week to post something functional. Is there any particular feature that you are really after 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

    Post Edited (Bill Henning) : 5/31/2010 10:55:09 PM GMT
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-09-29 16:00
    Hi Peter!

    Any progress with UNICOM?

    Thanks,

    Bill
    I have a whole list of objects and projects that I 'intend' to work on active both in my browser and in BST. So far the intention is good but I will make sure I devote some time to it this week to post something functional. Is there any particular feature that you are really after Bill?

    *Peter*
  • Heater.Heater. Posts: 21,230
    edited 2010-09-29 20:57
    Peter Jakacki

    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.
  • Dave MatthewsDave Matthews Posts: 93
    edited 2010-10-03 09:26
    Any propeller MODBUS support objects yet?

    "- MODBUS RTU support - Automatic start of frame and checksum"

    Thanks,
    Dave
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-10-06 22:48
    Update:

    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 MatthewsDave Matthews Posts: 93
    edited 2010-10-13 05:08
    My application requires writing position values to the slave's MODBUS registers, reading speed and other values from the slave's MODBUS registers, and finally reading and writing various 'coils' in the slave. I'm prepared to write the routines required, but if you are close to releasing something I can wait.
    Dave

    Update:

    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.
  • electromanjelectromanj Posts: 270
    edited 2010-10-26 06:34
    Hello! Just wondering how your coming along with unicom.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-10-29 02:31
    Hello! Just wondering how your coming along with unicom.

    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.
  • ghost2ghost2 Posts: 9
    edited 2011-02-02 05:21
    Apologies for bouncing this thread, but I am really curious about any progress.

    Best regards,

    ghost
Sign In or Register to comment.