About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

IO Pi Plus, Issue with two programs accessing?

1831 Views - Created 04/01/2016

04/01/2016

Posted by:
kenb

Users Avatar

I have successfully completed my first IO Pi Plus project using 14-channels for an outdoor Christmas Tree display.  I have 12-channels for each "clock" position, each with a a strand of lights, one for a star, and one to turn off lights around the tree for an "attention" mode.  I created several patterns to run the tree...quite amazing!

I'm gearing up for next year with running 2 or more displays.  I copied my Python3 program and changed the channels.  Each IO pin is mapped to a single channel referenced in my program.  I was sure to NOT overlap the channels on my second program.  When I run the two programs at the same time, everything works without errors...almost.  No errors, but there is a major issue.  I don't have anything connected other than relay boards for the second display.  I noticed that the timing on the first display is held constant, but I get several partial on/off flickerings.  I checked the ps and top stats, and the cpu's are barely doing anything (less than 3%).  I'm wondering if having two almost identical programs trying to access one IO Pi is the problem?  Do I need to do something special?  My program mimics the tutorial1a.py example, but uses bus.write_pin commands instead of the entire port.  The two programs will write to the same buses and ports but on different pins as the channel maps are distributed across (4) 8-port relay boards...all 32-channels in use on one IO Pi+.

04/01/2016

Posted by:
admin

Users Avatar

Users Website  

It isn't possible to have more than one script accessing the SMBus on the raspberry pi without having timing and connection issues which would explain the flickering problems.

Is it possible for you to have the the code from both scripts in a single file? This will resolve the SMBus connection issues.

04/01/2016

Posted by:
kenb

Users Avatar

Thanks for your quick reply admin.  My plans for a second display would run independently, so I don't see collapsing into one program.  Would it work if I dedicated a bus to each program?  E.g., bus1 (0x20) for program-1, and bus2 (0x21) for program-2?

05/01/2016

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

It may be more reliable if you use each bus on a seperate program.  The problem could be that if you have two scripts accessing the same bus at the same time each script would have its own instance of the python library running each with its own configuration settings so with two different configuations trying to access the same IO chip there may be occasional conflicts.  Seperating each script onto a seperate bus should hopefully solve this problem.

AB Electronics UK Tech Support

07/01/2016

Posted by:
kenb

Users Avatar

Success!  It works fine as long as I dedicate a bus to each program running concurrently.  I imagine that I can buy additional IO Pi+'s if I need more buses.  Thanks for your help!

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.