Multi port serial object in multiple cogs question
Hi all,
I'm using the multi cog serial object. It seems I can start the object in one cog and use some of the ports in another cog. It works, but I am wondering if I am asking for trouble. Should this be OK, or am I setting myself up for problems down the road?
Thanks!
Jonathan
I'm using the multi cog serial object. It seems I can start the object in one cog and use some of the ports in another cog. It works, but I am wondering if I am asking for trouble. Should this be OK, or am I setting myself up for problems down the road?
Thanks!
Jonathan
Comments
e.g.
...should be fine, I think.
Nope, not quite what I mean. I am using the "psFullDuplexSerial4c" object. It can handle up to 4 serial ports at a time. I am starting the object from one cog, but using some of the ports in other cogs. It works, but I'm wondering if it is a bad idea waiting to bite me.
Thanks!
Jonathan
You can run into trouble with multiple cogs if you try to access the same serial port simultaneously, resulting in interleaved buffer insertions and therefore mangled messages on the port. That can be solved with a semaphore (lock bit), but if you never have multiple cogs trying to access the same port at the same time, this'll never be an issue.
Jonathan
Duane