Page 1 of 1

GPIO issue

Posted: Fri Sep 27, 2019 8:17 pm
by Karivian
I was trying to get a Pimoroni EnviroPHAT to work with the StereoPi board. It doesn't seem to recognize that anything is connected. I swapped the SD to a pi zero and everything tests out fine, the EnviroPHAT fully works. Put everything back on the StereoPi and attempting to access the EnviroPHAT results in IO Errors. I've made sure to verify that my connections have flipped the 180 required from the StereoPi layout.

I am running Debian Buster lite from the raspberrypi.org download page. Is there a specific package that I need to make sure is installed to access the GPIO on the StereoPi?

Re: GPIO issue

Posted: Sat Sep 28, 2019 5:04 am
by stereomaton
I did not know this extension before, but it likely not use bare GPIO, but rather the peripherals such as I2C bus which are also available on the GPIO extension connector.
There might be peripherals and drivers to enable, which is generally done through the device-tree or device-tree overlay mechanism, unless it uses userland programs with generic drivers, but it would be quite stupid for the kind of sensors on this board (however there are some strange montages sometimes in the raspberry-pi world due to lack of knowledge)
But these device-tree things are located in the BOOT partition of the SD, so if it works on the normal raspberry-pi with the same SD, it should work on the stereopi too, as far as I understand, because the hardware is extremely close and identical for this part.
I would have think of the 180 uturn of the connector, but you checked it too.

Perhaps you can elaborate about how you see it does not work (the commands you type and errors you get) so that we can help to find ways to investigate.

Re: GPIO issue

Posted: Mon Sep 30, 2019 7:31 am
by Realizator
Stereomaton, thank you for your answer.
You are right, the issue is in device tree.
Actually, StereoPi is 100% compatible with the Raspberry Pi. But when you connect second camera, it uses one more I2C.
1. According to EnviroPHAT pinout, it uses I2C for connection.
2. StereoPi has a special file 'dt-blob.bin' in /BOOT partition. It explains to system, that we have 2 cameras, and second camera uses I2C.
3. This 'dt-blob.bin' is loaded ONLY when Compute Module is detected. So in Pi Zero this file will not be loaded, and I2C is free.

Karivian, could you please do a simple experiment.
Insert your micro SD card in to cardreader and connect to the computer. Rename 'dt-blob.bin' to 'dt-blob1.bin', save and eject card correctly.
After that try to check, if your hat is working on StereoPi.

If it is Ok, we'll try to find a way to do I2C available for you (as mentioned in this thread on Raspberry Pi forum). I have no I2C hats right now to test it, but will do my best to find one.

Re: GPIO issue

Posted: Thu Oct 10, 2019 8:44 pm
by Karivian
Sorry for the long delay in my response.

I tested renaming the dt-blob.bin and the EnviroPHAT worked.

However, after re-analyzing my project and requirements, I realized that the inclusion of the EnviroPHAT was being wasteful as I wasn't using it to it's full extent. I am now using individual DHT11 and BMP180 sensors and both cameras with no problems whatsoever.

Thanks for your assistance.

Re: GPIO issue

Posted: Mon Nov 11, 2019 6:08 pm
by bssackma
Thanks for this thread - just seeking a bit of additional clarification. When running 2 cameras on the StereoPi is it still possible to interface with additional sensors via the standard I2C bus/pins? From the discussion it seems that the second camera may use the standard I2C pins, thereby restricting the use of the I2C bus for other sensors. Is this indeed the case? If possible I would like to use 2 cameras with this I2C board from SparkFun (https://www.sparkfun.com/products/14459) to connect my StereoPi to some simple environmental sensors. Any help would be appreciated.

Re: GPIO issue

Posted: Tue Nov 12, 2019 7:33 am
by Realizator
Actually you can use I2C with 2 cams (look at this thread on RPi Forum as an example).
If you'll look inside CM datasheet (pages 19 and 20), you may find that I2Cs are potentially available at:
GPIO 0, 1 (ALT 0)
GPIO 2, 3 (ALT 0)
GPIO 28, 29 (ALT 0)
GPIO 44, 45 (ALT1 and ALT 2)

Also in our dt-blob.dts (source of dt-blob.bin) you can find our pins assignment (please be sure you're looking into the second part of dt-blob, section for "pins_cm3").

I think you can, for example, rearrange pins 44 and 45 for I2C, and assign other unused pins as camera shutdown pins.