Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

IO Pi Plus, Issue with two programs accessing?

The IO Pi Plus is a 32 channel MCP23017 GPIO expander for the Raspberry Pi

04/01/2016

Posted by:
kenb

kenb 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

admin Avatar

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

kenb 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

andrew Avatar

It may be more reliable if you use each bus on a separate 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 configurations trying to access the same IO chip there may be occasional conflicts. Separating each script onto a separate bus should hopefully solve this problem.

07/01/2016

Posted by:
kenb

kenb 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!

Sign in to post your reply


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.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout