It's Holiday Sale Weekend at Adafruit - use the code ADATY to get 15% off items storewide! Some restrictions apply.
0

Adafruit_BBIO problems
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Adafruit_BBIO problems

by silver2row on Tue Aug 14, 2018 8:32 pm

Hello,

Okay...what error codes are you getting? Oh and did you ever make up your mind on the library and sharing it?

Seth

P.S. Look here for Adafruit_BBIO stuff: https://github.com/adafruit/adafruit-be ... -io-python. That github.com site has updated versions of ideas and new release info, too.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by denys on Tue Aug 14, 2018 11:00 pm

Hi Seth.
As I've said before a couple of times. I followed the Adafruit info at... https://learn.adafruit.com/setting-up-i ... k/overview
Whatever libraries that installed is what I have tried.
And I have just followed this site https://github.com/adafruit/adafruit-be ... -io-python
And it still does..
debian@beaglebone:~$ sudo ntpdate pool.ntp.org
sudo: ntpdate: command not found

Then, following the rest of the install,
Results are..

(the version 10 file is the same as the 9A one but I copied it so as not to break the working one while playing around)

debian@beaglebone:~$ python -u OMCB_IO_10.py
Traceback (most recent call last):
File "OMCB_IO_10.py", line 9, in <module>
ADC.setup()
RuntimeError: Unable to setup ADC system. Possible causes are:
- A cape with a conflicting pin mapping is loaded
- A device tree object is loaded that uses the same name for a fragment: helper
debian@beaglebone:~$


The cape error message is new since the latest Linux was installed.

But if I comment the ADC out,
And change ....
#import Adafruit_I2C as Adafruit_I2C
#mcp = Adafruit_I2C(0x3f)
to....
import Adafruit_GPIO.I2C as Adafruit_GPIO.I2C
mcp = Adafruit_GPIO.I2C(0x3f)


I get..
debian@beaglebone:~$ python -u OMCB_IO_10_NoADC.py
File "OMCB_IO_10_NoADC.py", line 16
import Adafruit_GPIO.I2C as Adafruit_GPIO.I2C
^

I have no clue what that all indicates.
Why has the ADC and I2C been changed???

Have you found ANY code that reads the Beagle Bone Black ADC, drives the PWM and talks to I2C in Python?
If I could find code that I can modify that would be ok. But I cannot get any Python code to work following the Adafruit links now.

denys
 
Posts: 50
Joined: Fri Aug 10, 2018 1:08 am

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 12:07 am

Hello,

If you are not aware of the config-pin utility, please see it here: https://github.com/beagleboard/bb.org-o ... iversal-io.

The config-pin utility helps solve a past issue of pin-muxing. If you connect your Cape via i2c or UART, you can set up the config-pin utility to make sure your BBB and Cape communicate easily. Please see the link.

So, your pins P9_19 and P9_20 should be your connectors for your Cape, right? Those are the two pins that are specially designed to work w/ Capes (if I am not misinterpreting what I learned).

So...

If you are to make your Cape work, use config-pin w/ this cmd: sudo config-pin P9.19 uart && sudo config-pin P9.20 uart. That should do it.

But..

If you are importing a specific set of instructions from a C/C++ library or a Python module, w/:

Code: Select all | TOGGLE FULL SIZE
from mcp23xxx import MCP23017


Then...

You will need to know about that library/module. For instance, please look at this Cape idea: https://github.com/silver2row/bbg/blob/ ... rBridge.py. The MotorBridge.py library is from a person/people who knew how to conduct libraries/modules for their Cape, the Motor Bridge Cape.

So...

Since there is a co-processor on the Cape, the BBB/BBG needs to understand how to communicate when typing up software to run on the BBB while using the Cape.

I thought since you had a co-processor on your Cape, you had a library typed up in Python or a C/C++ library. You are using from and import keywords. I figured since you were importing a module or library, you had one.

Seth

P.S. I guess I was mistaken. But if you are using a module/library/whatever, try the config-pin utility.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by denys on Wed Aug 15, 2018 12:31 am

Thanks Seth.
I did not have to do anything like that originally.
Now I think I'm completely lost. My old brain cannot understand it all now.
It is looking like an Arduino is the way to go to test my board. The Beagle Bone Black is now just too hard for me to figure out.
Thanks again for trying to help me Seth.

Denys.

denys
 
Posts: 50
Joined: Fri Aug 10, 2018 1:08 am

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 12:41 am

Try config-pin!

Seth

P.S. Try it and see if it works first.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by denys on Wed Aug 15, 2018 2:09 am

Sorry Seth.
i do not understand that config-pin site, or what do with it.

And I tried loading the MotorBridge.py ......

debian@beaglebone:~/adafruit-beaglebone-io-python$ nano MotorBridge.py
Then after the program from that site was saved...

debian@beaglebone:~/adafruit-beaglebone-io-python$ python MotorBridge.py

and got the same sort of error as I do with my code....

Traceback (most recent call last):
File "MotorBridge.py", line 34, in <module>
import Adafruit_BBIO.GPIO as GPIO
ImportError: No module named GPIO

Have you a BeagleBone Black there?
If so, can you load the MotorBridge.py or my OMCB_IO_9A.py code to see if it will compile to run?

it it will try to run without the cape, it should just return a write error.

After my playing around, the BASH script to test the MCP23017 no longer runs either.
I may reflash the SD card and start again.

I think it is coffee time!
Denys.

denys
 
Posts: 50
Joined: Fri Aug 10, 2018 1:08 am

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 8:42 pm

Hello,

I was not trying to get you to install the library. That specific library, the MotorBridge.py library, is for the Motor Bridge Cape. I do not think it is something that will work for you.

To communicate w/ the BBB, since you have a Cape, use the config-pin utility.

For instance...

Code: Select all | TOGGLE FULL SIZE
sudo config-pin P9.19 uart


and...

Code: Select all | TOGGLE FULL SIZE
sudo config-pin P9.20 uart


These two cmds will help you make your BBB and Cape communicate via uart. Okay so, do not worry about that install you made. If you want, you can erase it. You can remove that library. I just wanted you to review it.

And yes...

I have a BBB and tried to run your software. The only reason I am receiving errors is b/c of this line:

Code: Select all | TOGGLE FULL SIZE
from mcp23xxx import MCP23017


I do not have the library mcp23xxx. So, I cannot import MCP23017 from the library mcp23xxx. The main reason I wanted to show you that library, the MotorBridge.py library, was to let you know about libraries. From that library, the MotorBridge.py library, you can run some software that you have typed up or that other people have typed up.

See here: https://github.com/Seeed-Studio/MotorBr ... torTest.py.

That software is for the MotorBridge.py library I was showing you in one of my last example ideas. So...

...

To reiterate, I ran the software w/ the cmd: sudo python <file_name.py>. I got everything to work except for the line that calls the library mcp23xxx. Read up on making libraries and if you are not using a library, use the software you provided w/out that line. THIS LINE!

Code: Select all | TOGGLE FULL SIZE
from mcp23xxx import MCP23017


This line refers to a library and you are importing from that library. Since there is not a library, this line is irrelevant.

Use config-pin and Adafruit_BBIO 1.0.3. I know you are racking your brain on this effort. I think your Cape is nice. I am not trying to harass you.

Seth

P.S. Again...erase that line, downgrade you Adafruit_BBIO library, and then use config-pin. Oh and, yes and, we can move on from that point. If you do not want to downgrade your Adafruit_BBIO library, you will have to install other libraries to make it work. See here: https://github.com/adafruit/Adafruit_Py ... 67b7601253. That is an idea that may help you on your journey. I cannot make a 100% solution to your issue yet b/c of the line that calls a library but that last link could give you some insight.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 9:02 pm

Hello denys,

Seth here once more. Hey! Do you have this on your Cape: https://www.microchip.com/wwwproducts/en/MCP23017?

Seth

P.S. Here is the datasheet: http://ww1.microchip.com/downloads/en/D ... 01952C.pdf. I am pretty sure your MCP23017 communicates via i2c (if you have this on your Cape). You might even have to power the Cape alternatively w/ another power supply. I also noticed on the spec sheet that there was no ADC on this chip. Did you add your own for your Cape?

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by denys on Wed Aug 15, 2018 9:23 pm

Good morning Seth.
Well, I tried your pin mode...

Desktop adafruit-beaglebone-io-python bin
debian@beaglebone:~$ sudo config-pin P9.19 uart
Pin is not modifyable: P9_19 i2c2_scl
debian@beaglebone:~$ sudo config-pin P9.20 uart
Pin is not modifyable: P9_20 i2c2_sda
debian@beaglebone:~$


And yes, I am using a library, and that is from Adafruit, as per the links. I don't know enough programming to make a library, and I have looked at some libraries but do not understand how they work at all. Almost all sites have instructions written in pseudo-code or mnemonics and not real world actual working code. That is ok if one understands the language, but I don't really. After all these years I should, having used assembler, Forth and Arduino C++ but I do not program regularly so forget how to write the code.
And yes, I too get library errors now. That is the problem!
Some one has changed something and now the libraries no longer work.
I've hunted in a lot of places to find some real code that works for the BeagleBone Black and the MCP23017 but have not found any.
I need a site that has a script or very basic steps to install code that actually works. All the site I have found assume an understanding of programming that I lack.
I know this must be frustrating for you that I am so thick, and I do thank you for your help so far.

All I really just know it used to work so well, but now does not. And I realize it is beyond my ability to fix it. So I have not tested my new boards or made any more after the first 2.

If I could find out how I did it originally and go back to that I would be so happy!
Denys.

denys
 
Posts: 50
Joined: Fri Aug 10, 2018 1:08 am

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 9:29 pm

denys,

Seth here. I am glad you replied. Try to downgrade your Adafruit_BBIO. Do you remember how to do it? Please hold. I know this is not real-time chat. I thought that would be funny. Please hold.

I am going to erase the ADC section b/c I do not think you are using an Analog to Digital converter on the Cape or w/ your BBB. I am going to erase some other sections.

Seth

P.S. I will get right back to this online posting thing.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 9:56 pm

Hello,

Okay. Please do not call yourself names. Thick, yuck, or icky is too much to take. I know you know things already. You basically made an entire Cape from scratch. You typed up a bunch of software that once worked and things have changed. Okay! Now that we are over that issue, we can move forward.

So...

There is a module in Python called Adafruit_PureIO.smbus. I do not yet know where to get this library. I am off to look it up.

Seth

P.S. I am getting closer. Okay...I found it: https://github.com/adafruit/Adafruit_Python_PureIO. So, we may have to work on this idea and drop in ideas to their repo to get your idea and Cape working or we can try to revert everything back to 1.0.3 but I am not completely sure if this will work now that I found out more info.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 10:05 pm

Hey Sir,

Please let me know how your Cape communicates w/ the BBB. Are you using i2c or UART?

Seth

P.S. i2c right! Anyway, I just wanted to know since I am nosey but you are right. The modules in Python have changed and things are different now. There is one thing I do not understand about your Cape and communication...why are we calling import Adafruit_BBIO.ADC as ADC if there is not ADC intervention on your Cape?

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 10:35 pm

Hello Once More,

Okay...I think I get what you are trying to do but it will not work b/c the library, MCP230xx.py, does not exist yet. At least, not from Adafruit_BBIO, Adafruit_GPIO, and not from Adafruit_Python_PureIO either. I typed this out to let you know that they are working at it part-time or something or full-time and they, these Adafruit.com people, have not gotten to it yet. So, either we can jump on board, us two, and try or we can fall back and wait until someone else does it.

...

Just to let you know how complicated this gets, read the co-processor ideas online.

Seth

P.S. This is unfinished business. The module does exist but I am getting error codes that the module does not exist. I have tried to place it in directories where it may be found w/ ease w/ no luck. So, stumped is I and poof. Just like that, we are back to square one. I am sorry.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: Adafruit_BBIO problems

by denys on Wed Aug 15, 2018 10:58 pm

Hi again Seth.
I'll try to keep my chin up ;)

I use a bit of the BeagleBoneBlack as follows...

P9(14) = PWM1 to motor
P9(16) = PWM2 to motor

P9(37) = Read Supply Volts
P9(38) =Read Motor Current
P9(39) = Read 4-20mA input 1
P9(40) = Read 4-20mA input 2

P9(19) = I2C SCL to MCP23017 (Addressed at 0x27)
P9(20) = I2C SDA to MCP23017

P9(24) = CAN Network-RXD
P9(26) = CAN Network-TXD

P9(15) = RS485 Network T/RX Control
P9(21) = RS485 Network TXD
P9(22) = RS485 Network RXD

P9(11) = ESP8266 RXD
P9(13) = ESP8266 TXD

So I do need the PWM and analog in as well.
I have not implemented the ESP8266-01 and may not.
Also, my code has not tested the RS485 or CAN networks.


My basic BASH test script is working so I know I can talk to the MCP23017 chip ok.

enter the Test1 program...
root@beaglebone:~# nano MCP23017Test1

Code: Select all | TOGGLE FULL SIZE
i2cset -y 2  0x27 0x00 0x00
i2cset -y 2  0x27 0x00 0x00
i2cset -y 2  0x27 0x10 0x00
i2cset -y 2  0x27 0x10 0x00
COUNTER=0
while [ $COUNTER -lt 100000 ]; do
i2cset -y 2  0x27 0x0a 0xff
i2cset -y 2  0x27 0x1a 0xff
sleep .1
i2cset -y 2  0x27 0x1a 0x00
sleep .1
i2cset -y 2  0x27 0x0a 0x00
sleep .1
i2cset -y 2  0x27 0x1a 0xff
sleep .1
i2cset -y 2  0x27 0x0a 0xff
sleep .1
i2cset -y 2  0x27 0x1a 0x00
sleep .1
i2cset -y 2  0x27 0x0a 0x00
sleep .1
i2cset -y 2  0x27 0x1a 0xff
sleep .1
i2cset -y 2  0x27 0x0a 0xff
sleep .1
i2cset -y 2  0x27 0x1a 0x01
sleep .1
i2cset -y 2  0x27 0x1a 0x02
sleep .1
i2cset -y 2  0x27 0x1a 0x04
sleep .1
i2cset -y 2  0x27 0x1a 0x08
sleep .1
i2cset -y 2  0x27 0x1a 0x10
sleep .1
i2cset -y 2  0x27 0x1a 0x20
sleep .1
i2cset -y 2  0x27 0x1a 0x40
sleep .1
i2cset -y 2  0x27 0x1a 0x80
sleep .1
i2cset -y 2  0x27 0x0a 0x01
sleep .1
i2cset -y 2  0x27 0x0a 0x02
sleep .1
i2cset -y 2  0x27 0x0a 0x04
sleep .1
i2cset -y 2  0x27 0x0a 0x08
sleep .1
i2cset -y 2  0x27 0x0a 0x10
sleep .1
i2cset -y 2  0x27 0x0a 0x20
sleep .1
i2cset -y 2  0x27 0x0a 0x40
sleep .1
i2cset -y 2  0x27 0x0a 0x80
sleep .1
i2cset -y 2  0x27 0x1a 0x00
sleep .1
i2cset -y 2  0x27 0x0a 0x00
sleep .1
i2cset -y 2  0x27 0x1a 0xff
sleep .1
i2cset -y 2  0x27 0x0a 0xff
sleep .1
done



Make it executable...
root@beaglebone:~# chmod a=r+w+x MCP23017Test1
to test running all as outputs...
root@beaglebone:~# ./MCP23017Test1


My son helped me with this.

Denys.

denys
 
Posts: 50
Joined: Fri Aug 10, 2018 1:08 am

Re: Adafruit_BBIO problems

by silver2row on Wed Aug 15, 2018 11:03 pm

Hello,

I just made some headway. I can import the module, i.e. MCP230xx.py now.

...

I just cannot use the name mcp23017.

I will get back to you.

Seth

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Please be positive and constructive with your questions and comments.