Beaglebone Black and MCP23017 in C?

Thread Starter

dendad

Joined Feb 20, 2016
4,142
Well, as my other post has not resulted in any answers, here now is a "C" question.
https://forum.allaboutcircuits.com/threads/beaglebboneblack-mcp23017-code-no-longer-working.148883/
It has my Python code there.
So does anyone out there have "C" code to run on a BeagleBone Black, driving an MCP23017?
I have spent many hours trying to find example that I can understand, but to no avail.
It is looking like I will have to make an adapter so I can plug my board into a Dreaded Arduino to test it.
I think I can manage the Arduino version. It is a pity as I would have liked to get it going on the BBB.
This is so frustrating as I had it all working well until letting the magic Smoke out. Actually, there was no smoke, but you get the idea.
Here is the board I want to test.
OMCB_1_TopS.jpg
I swapped the two 2 pin plugs to the right and popped the BBB :(
 

Ian Rogers

Joined Dec 12, 2012
993
The code is very similar to the ds1307 RTC code... It would probably take 10mins or so to change it to suit..

I tend to use the SPI version, so I've never bothered.. When I get home tonight, I'll give it a bash..
 

Thread Starter

dendad

Joined Feb 20, 2016
4,142
The code is very similar to the ds1307 RTC code... It would probably take 10mins or so to change it to suit..

I tend to use the SPI version, so I've never bothered.. When I get home tonight, I'll give it a bash..
Thank you for your reply :)
It is probably a library problem and I just can't figure out how to drive them.
I was so pleased with myself getting the original Python one going that I actually emailed a couple of friends to tell them. Then I blew it up...
Oh, I have not managed yet to get the Arduino one running either. I should stick to "solder" as my programming language of choice!

FYI, the motor drive H bridge used on this board is the A4950
https://www.allegromicro.com/en/Pro...terface-ICs/Brush-DC-Motor-Drivers/A4950.aspx
I'm really impressed with it. A 40V 3.5A driver in a SMT 8 pin pack.
Well worth a look I reckon!
 
Last edited:

Ian Rogers

Joined Dec 12, 2012
993
I lied... It took almost 1/2 an hour... You'll need someone to change the registers as I use Pic's

mcp23.h and mcp23.c are attached..

Sorry!! I forgot to comment it.. I'll do it tonight!!
 

Attachments

Last edited:

Thread Starter

dendad

Joined Feb 20, 2016
4,142
Thanks :)
I'll have a play a bit later.

EDIT: 4 hours later...
Hmm. No good.
I think libraries are one of my downfalls....
"xc.h: No such file or directory" Found one,
then "c_config.h: No such file or directory"
then "xc_funcs.h: No such file or directory"
then a lot more errors...
Really, I need a file with no includes.
I think I will give up. I don't know enough to fix this. Thanks for the try to help.
 
Last edited:
Top