08-26-2016, 03:58 AM (This post was last modified: 08-26-2016, 03:59 AM by pfeerick.)
(08-26-2016, 02:58 AM)KnReLe Wrote:
(08-26-2016, 01:11 AM)pfeerick Wrote:
(08-25-2016, 08:53 PM)MarkHaysHarris777 Wrote: i can see from your print-out of the i2c registers that it is not detecting the address of the LCD. How are you powering it? Double check your connections. Make sure its on the correct bus...
Mark, I think you need to have a another look at the first post, specifically the picture... you can clearly see the LCD is on a Adafruit LCD Pi Plate, meaning it is i2c, with all comms and power comming from the pi bus. Plus, there is no room for incorrect wiring as assembly is as simply as place LCD here and solder connectors, etc.
My question here would be does I2C work out of the box with a particular debian or ubuntu image, and if not, what configuration is needed to get it up and running?
Although that question might not have been directed at me -- I have one data-point's worth of answer to it.
i2c on the bus in question here, TWI-1 or /dev/i2c-1 as it appears in the Linux file system, does have all necessary support bits in place on the Debian 3.10.102-3-pine64-longsleep kernel. (I had it working with the previous -1- and -2- ones as well, but those are obsolete.) These are ready for use, though one will want to install the i2c-tools and libi2c-dev (and whatever other similar packages apply to python) to be able to use them for anything interesting. Reading and writing to simple devices will be the same.
So much for the software side. Hardware-wise, we have to have something connected of course, and if the i2c-capable device or board connected was originally designed for Raspberry Pi, the good news is that there is a good chance of it working, and the less-than perfectly good news is that we have to add the pull-up resistors to the two i2c lines since they are not present from before.
Thanks for that KnReLe. I just wanted to know if I2C actually worked (at all, or if it needed configuring), after the comments earlier about things not being compatible. I was in the middle of wiring up a MCP23017 (as is used on the Adafruit LCD Pi Plate) to see what was involved in getting it working, and thought after those comments that I was probably wasting my time.
So, after finishing up wiring the MCP23017 chip, adding the 2k pullups to the I2C buss (pulling 3 & 5 up to 3.3v), the chip was detected as I indicated in the edit to my earlier post. I then proceeded to add LEDs to five of the eight Port A I/O pins on the expander, and wrote up some code to see if it all worked. The result... pretty blinky lights! It's alive!
You can see a video of the results here (apologies for the slight shakiness of it the footage... is getting a bit nippy here at night time now!). The code used is here. And the wiring was based on this guide. So in a nutshell, all that should be needed to get the I2C bus up and running for mypineme's board is the addition of the 2k resistors. Then it's just a matter of seeing how compatible Adafruits library and code is for this is, since it was intended for the Rpi, not the pine. Fingers cross for you on that one! It will be really good if it does work!
08-26-2016, 07:36 AM (This post was last modified: 08-26-2016, 07:42 AM by KnReLe.
Edit Reason: added the attachment
)
(08-26-2016, 03:58 AM)pfeerick Wrote:
(08-26-2016, 02:58 AM)KnReLe Wrote:
(08-26-2016, 01:11 AM)pfeerick Wrote:
(08-25-2016, 08:53 PM)MarkHaysHarris777 Wrote: i can see from your print-out of the i2c registers that it is not detecting the address of the LCD. How are you powering it? Double check your connections. Make sure its on the correct bus...
Mark, I think you need to have a another look at the first post, specifically the picture... you can clearly see the LCD is on a Adafruit LCD Pi Plate, meaning it is i2c, with all comms and power comming from the pi bus. Plus, there is no room for incorrect wiring as assembly is as simply as place LCD here and solder connectors, etc.
My question here would be does I2C work out of the box with a particular debian or ubuntu image, and if not, what configuration is needed to get it up and running?
Although that question might not have been directed at me -- I have one data-point's worth of answer to it.
i2c on the bus in question here, TWI-1 or /dev/i2c-1 as it appears in the Linux file system, does have all necessary support bits in place on the Debian 3.10.102-3-pine64-longsleep kernel. (I had it working with the previous -1- and -2- ones as well, but those are obsolete.) These are ready for use, though one will want to install the i2c-tools and libi2c-dev (and whatever other similar packages apply to python) to be able to use them for anything interesting. Reading and writing to simple devices will be the same.
So much for the software side. Hardware-wise, we have to have something connected of course, and if the i2c-capable device or board connected was originally designed for Raspberry Pi, the good news is that there is a good chance of it working, and the less-than perfectly good news is that we have to add the pull-up resistors to the two i2c lines since they are not present from before.
Thanks for that KnReLe. I just wanted to know if I2C actually worked (at all, or if it needed configuring), after the comments earlier about things not being compatible. I was in the middle of wiring up a MCP23017 (as is used on the Adafruit LCD Pi Plate) to see what was involved in getting it working, and thought after those comments that I was probably wasting my time.
So, after finishing up wiring the MCP23017 chip, adding the 2k pullups to the I2C buss (pulling 3 & 5 up to 3.3v), the chip was detected as I indicated in the edit to my earlier post. I then proceeded to add LEDs to five of the eight Port A I/O pins on the expander, and wrote up some code to see if it all worked. The result... pretty blinky lights! It's alive!
You can see a video of the results here (apologies for the slight shakiness of it the footage... is getting a bit nippy here at night time now!). The code used is here. And the wiring was based on this guide. So in a nutshell, all that should be needed to get the I2C bus up and running for mypineme's board is the addition of the 2k resistors. Then it's just a matter of seeing how compatible Adafruits library and code is for this is, since it was intended for the Rpi, not the pine. Fingers cross for you on that one! It will be really good if it does work!
Great video -- blinkenlights and stuff that works is always great to see.
As I actually had one of these display units lying around here from when I bought it back in 2013 sometime, I hooked it up with the pull-up resistors in place. Then I found the test C programs for it that I had made back then and that code compiled and ran without changes, and gave me some text on the screen. (Should anyone be interested, I did attach a tarball with the code in it.)
I had a look at the Adafruit library, it seems to want to encompass all sorts of LCD interfacing, including direct via GPIOs so it wants to use device-specific libraries such as Rpi.GPIO or a Beaglebone equivalent, Adafruit_BBIO. So it looks like what may be needed is some kind of «Pine.GPIO» variation of this.
I also did try the Adafruit library but it said it «could not detemine platform», which is fair i suppose -- as it hasn't been told that there are such things as PineA64...
08-26-2016, 05:20 PM (This post was last modified: 08-27-2016, 02:45 AM by pfeerick.
Edit Reason: added link, a bit later than I expected!
)
(08-26-2016, 07:36 AM)KnReLe Wrote: As I actually had one of these display units lying around here from when I bought it back in 2013 sometime, I hooked it up with the pull-up resistors in place. Then I found the test C programs for it that I had made back then and that code compiled and ran without changes, and gave me some text on the screen. (Should anyone be interested, I did attach a tarball with the code in it.)
I had a look at the Adafruit library, it seems to want to encompass all sorts of LCD interfacing, including direct via GPIOs so it wants to use device-specific libraries such as Rpi.GPIO or a Beaglebone equivalent, Adafruit_BBIO. So it looks like what may be needed is some kind of «Pine.GPIO» variation of this.
I also did try the Adafruit library but it said it «could not detemine platform», which is fair i suppose -- as it hasn't been told that there are such things as PineA64...
Thanks for that! Videos are always handy in showing something working... and who doesn't like blinky leds!! I'm sure the OP will be glad to know that merely wth the addition of the two pullups, either to the pine64 or the display board, it will work one way or another.
Since I can't be bothered getting SMD resistors and populating the two spots for them, I'll probably just add them to the bottom of the board with standard 1/8 resistors, since that will then make the I2C RPi compliant for any expansion boards I use.
There is a Pine64 port of the Rpi.GPIO library for Python. It works well for the brief tests I've done so far... mainly just turning I/O pins on and off. Only failure so far was related to the pine64 configuration, not the library, and is a known probem.
Ohh man, I want to thank all of you for actualy taking the time to help me out with this (especially @KnReLe) . I'm so exited to try this on my P64. Unfortunately I wont be able to play with it for the next couple of days, but when I do get to play with it, I will report back with an update. THIS IS AWESOME!!!