|
Edited by t0k3-0 at 2016-3-21 07:23
Hey OrangePi community!
So, I don't know very much about SPI, i2c etc., but recently bought myself an OPi-PC. I've been a programmer for a while and been working with C and C++ in my spare time.
I couldn't get SPI or i2c working (using gpio readall) with my Armbian image installed (in february or earlier I believe) from the official Armbian site for my board, but I did get the usual IO pins to read and write data via the C library wiringPi.
I also ordered an 8x8 led matrix which came with the chip MAX7219, which I put together and tried to hook up. I believe this device should use SPI but decided to "bitbang" it since that seemed like a simpler solution for me.
Said and done I hooked it up to the 5v, ground, gpio 7 (DIN), gpio 8 (CS) and gpio 10 (CLK). I then tried to modify some code built for the MAX7219 with Raspberry Pi specifically, but cannot seem to get it to work.
As I do "gpio readall" it does read them all and they change while the program is running, so there's no question that I'm using the right pins in my code.
Also, on an earlier occasion I got the lights going, when I by mistake hooked it up in the wrong way (I think).. Now they don't do anything at all. Maybe I broke it? Ground and 5v have always been connected to the same pins though.
Here is my code: http://pastebin.com/RvDtNnnH
Compiles with: "gcc -o test thisfile.c -lwiringPi"
I would really appreciate it if someone with more knowledge would look over it quickly, or give me some insight on how to use SPI and/or i2c. I have looked for the info all over the forums for hours, but am obviously not looking hard enough (?).
Regards
|
|