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 Thu Sep 06, 2018 10:57 pm

denys,

Please do not give up yet, man. You did all that work and tried w/ all that effort. I would hate to see you give in as of now but if it is really what you want, Arduino!

Seth

P.S. Oh and denys, there are some new Capes coming out and/or are already out. Oh and this book may help: https://www.cengage.com/c/programming-a ... By=Student. It is basics but helpful for starter people like me.

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

Re: Adafruit_BBIO problems

by denys on Fri Sep 07, 2018 12:43 am

debian@beaglebone:/$ i2cdetect -r -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

:)
It looks like that was the problem.

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

Re: Adafruit_BBIO problems

by denys on Fri Sep 07, 2018 1:08 am

Hi again. i'm still trying after all.

A question or two...

In the following from your example.....
mcp.output(8, GPIO.HIGH)
mcp.setup(9, GPIO.IN)
mcp.pullup(9, True)
print (mcp.input(9))

They all look to be bit operations.
How do I write and read to the port?
Also, does this library have PWM and ADC code?
Is there an example of all the commands somewhere?

Thanks.
Denys.

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

Re: Adafruit_BBIO problems

by denys on Fri Sep 07, 2018 5:24 am

Should this toggle the output 15?

Code: Select all | TOGGLE FULL SIZE
import time
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.MCP230xx as MCP

# P9.17 = I2C1_SCL
# P9.18 = I2C1_SDA
# Alternatively you can initialize the MCP device on another I2C address or $
mcp = MCP.MCP23017(0x27, busnum=2)

mcp.setup(8, GPIO.OUT)
mcp.output(8, GPIO.HIGH)
time.sleep(0.5)
mcp.output(8, GPIO.LOW)
time.sleep(0.5)
mcp.output(8, GPIO.HIGH)

mcp.setup(9, GPIO.IN)
mcp.pullup(9, True)
print (mcp.input(9))
mcp.setup(15, GPIO.OUT)
for j in range(1000000):  # a loop counter
        mcp.output(15, GPIO.HIGH)
        time.sleep(1)
        mcp.output(15, GPIO.LOW)
        time.sleep(1)
Last edited by denys on Fri Sep 07, 2018 9:52 am, edited 1 time in total.

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

Re: Adafruit_BBIO problems

by denys on Fri Sep 07, 2018 9:51 am

This makes the port pins go low, but not high again.
But I do not see all the port pins running. As I am in the house and watching the board via video in my workshop, it is a bit hard to see what pins are running.
I may get more time tomorrow but it is almost midnight so I'm off to bed.

Code: Select all | TOGGLE FULL SIZE
import time
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.MCP230xx as MCP

# P9.17 = I2C1_SCL
# P9.18 = I2C1_SDA
# Alternatively you can initialize the MCP device on another I2C address or $
mcp = MCP.MCP23017(0x27, busnum=2)


for x in range(0, 15):
        mcp.setup(x, GPIO.OUT)
        mcp.output(x, GPIO.HIGH)
        time.sleep(.1)
        mcp.output(x, GPIO.LOW)
        time.sleep(.1) 


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

Re: Adafruit_BBIO problems

by silver2row on Fri Sep 07, 2018 10:59 pm

Hello and Yea Boy!

Way to go, denys. I am glad you made the right choice. BBB!

Seth

P.S. I hope you two can figure it out until I get a chip like this one at some point. I will look more into it later or not at all. I have not decided b/c of how things have transpired. But, do not fret. I just may have some helpful clues one day.

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

Re: Adafruit_BBIO problems

by denys on Sat Sep 08, 2018 12:39 am

Yes, Seth.
But is is still only about 25% working, if that. There are many questions that need to be answered.
Arduino sounds like the easiest option for my tester as the BBB code base is still broken I think.
All I wanted, and still do, is for my original code, or an equivalent, to run as it did for a year until I killed my board.
I still do not understand why I can't get it working again. I've gone down a number of paths but no one seems to be able to help fully. I do appreciate the help I've been given but my original problem is far from being solved.
It would be great to just download an iso that has all the code in it working!

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

Re: Adafruit_BBIO problems

by silver2row on Sat Sep 08, 2018 7:16 pm

Hello and You Are Right,

Easy is better at times. I am sure what we, esp. the other fellow, walk you through may or may not help but I cannot promise that the Arduino way will work explicitly.

Seth

P.S. Keep asking and I will keep trying at times. We only have time!

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

Re: Adafruit_BBIO problems

by drewfustini on Sun Sep 09, 2018 11:57 pm

Denys: please post a photo of how the MCP23017 is wired to the BeagleBone. I will try to reproduce with my BeagleBone and run the code that you posted.

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: Adafruit_BBIO problems

by denys on Mon Sep 10, 2018 8:06 am

Hello Drew.
I'm just back from Melbourne so sorry for the delayed reply.
Here is the appropriate part of the circuit.
This is the board I've designed and built. There are extra things on the board, like opto-isolation and pullup resistors for signals to another board that are not connected to the BBB at all. Those that are include analog inputs and a DC motor drive bridge. So I need to know how to use analog in and PWM out. Also, RS485 and CAN interfaces are implemented. This is a pretty neat little board I think, and I am really happy with the way is runs, when the code works ;)
Attachments
MCP23017Board1.png
part schematic
MCP23017Board1.png (322.61 KiB) Viewed 247 times
MCP23017Board1.jpg
MCP23017 Board Top View
MCP23017Board1.jpg (559.5 KiB) Viewed 247 times
MCP23017Board2.jpg
MCP23017 Board bottom view
MCP23017Board2.jpg (574.99 KiB) Viewed 249 times

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

Re: Adafruit_BBIO problems

by drewfustini on Tue Sep 11, 2018 3:52 am

denys wrote:This makes the port pins go low, but not high again.
But I do not see all the port pins running. As I am in the house and watching the board via video in my workshop, it is a bit hard to see what pins are running.
I may get more time tomorrow but it is almost midnight so I'm off to bed.

Code: Select all | TOGGLE FULL SIZE
for x in range(0, 15):
        mcp.setup(x, GPIO.OUT)
        mcp.output(x, GPIO.HIGH)
        time.sleep(.1)
        mcp.output(x, GPIO.LOW)
        time.sleep(.1) 


Denys: you wrote that the above program "makes the port pins go low, but not high again".

How are you observing that state of the pins?

I see in your diagram that you the LEDs are connected to 3.3V. Therefore, the pins on the MCP23017 need to go low for the LED to turn on.

Is that correct?

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: Adafruit_BBIO problems

by drewfustini on Tue Sep 11, 2018 4:46 am

Since the LEDs in your schematic are active low, try changing the order of HIGH and LOW.

I wired LEDs from 3.3V to the MCP23017 pins.

Please try this code which causes the ative-low LEDs turn on and then off:
Code: Select all | TOGGLE FULL SIZE
import time
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.MCP230xx as MCP

# P9.17 = I2C1_SCL
# P9.18 = I2C1_SDA
# Alternatively you can initialize the MCP device on another I2C address or $
mcp = MCP.MCP23017(0x27, busnum=1)

for x in range(0, 15):
    print(x)
    mcp.setup(x, GPIO.OUT)
    mcp.output(x, GPIO.LOW)
    time.sleep(.5)
    mcp.output(x, GPIO.HIGH)
    time.sleep(.5)

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: Adafruit_BBIO problems

by denys on Tue Sep 11, 2018 5:06 am

Hi Drew.
Yes, the LEDS are on when low, so I need to swap the test polarity around. They may have been working after all.
I'll try to get it working later.
Still, this is just a small part of the whole application. And I am getting tired of this battle. Can you explain to me why my original code that was working well now does not? All I want is it to work again.
As I mentioned before, I'd love an iso of the full SD card to just work!
I am tired.
I have developed a great dislike for the beagle Bone Black now. It is so hard to drive.
You can probably see I am discouraged.
I think I will go and get a coffee!

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

Re: Adafruit_BBIO problems

by denys on Tue Sep 11, 2018 8:56 am

Oh, gee!
It just gets harder.
I have a second BBB system here and was trying that one. It has the internal flash with an operating system on it but I can't log is as it has a different password that I've forgotten.
So, the SD card out of the other one was tried, and a completely newly flashed on as well. But with both of them, the BBB does not appear on my home network. (it does ok on the internal flash).
Tomorrow I'll have a go at a serial terminal connection if I can get the energy.

EDIT: ssh root@192.168.10.117 with a blank password worked :)

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

Re: Adafruit_BBIO problems

by drewfustini on Tue Sep 11, 2018 3:45 pm

denys wrote:Hi Drew.
Still, this is just a small part of the whole application. And I am getting tired of this battle. Can you explain to me why my original code that was working well now does not? All I want is it to work again.


It is hard to me to understand why the program is not working without me being able to reproduce on my BeagleBone.

Since I do not have the exact custom hardware that you have, I was trying to create the equivalent circuits to test Python code for specific functionality (LEDs, PWM, etc).

In the case of the LEDs, you would want to end any toggling sequence with HIGH for the LED to turn off (since it is active low).

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.