edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Wed Jul 28, 2021 10:33 am

Hi,

I need some help getting a Raspberry Pi Compute Module 4 working with a SenseHat and Camera.

Here's how I have things setup: The CM4 is connected to a CM4 IO Board, which itself is connected to the SenseHat via the usual GPIO header. There is one camera (version 2.1) connected to CAM1.

In order to enable the camera I have downloaded the binary blob required:

Code: Select all

sudo wget https://datasheets.raspberrypi.org/cmio/dt-blob-cam1.bin -O /boot/dt-blob.bin
With this file in place, the SenseHat does not work.

Usually, when the Pi boots, the SenseHat LEDs will light until the boot process is complete, at which point they will be cleared. (Turned off.)

With the binary blob file in place, the SenseHat LEDs remain turned on. Further to this, python scripts are not able to initialize the SenseHat, and an error is produced stating that communication between the Pi and SenseHat is not working / the sense hat cannot be detected.

When I move this binary blob file and reboot, and remove the camera module, the SenseHat resumes working as normal.

I don't fully understand the device tree configurations, but my guess would be that putting the binary blob in place re-configures the IO in such a way that the GPIO no longer works, or at least the parts of the GPIO which are required for communication with the SenseHat, are disabled / re-routed.

Is there any way to fix this issue? Does it require creating a custom binary blob / device tree configuration? If so, is anyone able to guide me as to how I should do this?

User avatar
Gavinmc42
Posts: 6050
Joined: Wed Aug 28, 2013 3:31 am

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 6:45 am

Have you tried talking to the Sensehat without the blob?
Just enable i2c and run "i2cdetect -y 1"

Then try again with Camera enabled.
i2c is used for Camera setting and device tree is confusing.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 8:25 am

Gavinmc42 wrote:
Fri Jul 30, 2021 6:45 am
Have you tried talking to the Sensehat without the blob?
Yes - it works fine if I remove / delete / move the binary blob file such that it is not loaded on boot.
Just enable i2c and run "i2cdetect -y 1"
I went into the Raspi Config and changed the i2c radiobutton from disabled to enabled.

I will copy and paste the output of this command with and without the binary blob in place in a moment.
Then try again with Camera enabled.
i2c is used for Camera setting and device tree is confusing.
It might be useful information? I tried also with a R-Pi 3 (just the normal board) and it worked fine. However this device only has one camera interface. I don't know how the CM4 + IO Board is wired up electrically.

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 8:50 am

Code: Select all

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- 46 -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- 5f 
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- -- 
70: -- -- -- -- -- -- -- --           
This is with the binary blob in place.

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 8:54 am

Code: Select all

$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- 5f 
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- -- 
70: -- -- -- -- -- -- -- --
This is without the binary blob in place.

I don't understand how to interpret this output or understand what information it is telling me. I will try and find a man page for `i2cdetect`

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 9:08 am

Without a binary blob or a sense hat, the output is blank. Makes sense, as there are no i2c devices.

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 9:13 am

Well this is a bit strange. With the binary blob in place but no sense hat, the output is also blank. The camera is functioning as I tested it.

Code: Select all

$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11625
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 10:19 am

The base dt-blob has changed to enable reading HAT EEPROMs on CM4, but the camera variants haven't.

Code: Select all

            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
wget https://datasheets.raspberrypi.org/cmio ... b-cam1.dts
Open the file in an editor and find the pins_cm4 section (line 1866)
Replace

Code: Select all

            pin_define@ID_SDA {
               type = "absent";
            };
            pin_define@ID_SCL {
               type = "absent";
            };
with the above.
sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-cam1.dts
Reboot

Or manually add "dtoverlay=rpi-sense" to /boot/config.txt.

I'll look at getting the files updated.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 11:01 am

6by9 wrote:
Fri Jul 30, 2021 10:19 am
The base dt-blob has changed to enable reading HAT EEPROMs on CM4, but the camera variants haven't.

Code: Select all

            pin_define@ID_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@ID_SCL {
               type = "internal";
               number = <1>;
            };
wget https://datasheets.raspberrypi.org/cmio ... b-cam1.dts
Open the file in an editor and find the pins_cm4 section (line 1866)
Replace

Code: Select all

            pin_define@ID_SDA {
               type = "absent";
            };
            pin_define@ID_SCL {
               type = "absent";
            };
with the above.
sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-cam1.dts
Reboot

Or manually add "dtoverlay=rpi-sense" to /boot/config.txt.

I'll look at getting the files updated.
Hi and thank you for your detailed reply. I'm interested to know more about this so that I can understand in a bit more detail what the changes mean and why this works.

Are you able to give a bit of a further explanation? For example, how does the reading of the hat EEPROMs work, and what changes does the camera binary blob make so that this no longer works. (Or does work? I'm not sure exactly which way round it is.)

I will make the changes you suggest and report back soon. Thank you for your reply it is much appreciated.

edbird
Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 12:03 pm

Hi, reporting back this seems to work and fix the problems.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11625
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Compute Module 4, IO Board, SenseHat and Camera - SenseHat does not work when camera enabled

Fri Jul 30, 2021 1:11 pm

edbird wrote:
Fri Jul 30, 2021 11:01 am
Hi and thank you for your detailed reply. I'm interested to know more about this so that I can understand in a bit more detail what the changes mean and why this works.

Are you able to give a bit of a further explanation? For example, how does the reading of the hat EEPROMs work, and what changes does the camera binary blob make so that this no longer works. (Or does work? I'm not sure exactly which way round it is.)

I will make the changes you suggest and report back soon. Thank you for your reply it is much appreciated.
The dt-blob file configures the firmware functions. It is not applicable for any function that is part of the Linux kernel.

Reading HAT EEPROMs needs to know the GPIOs that the EEPROM will be connected to, which is what ID_SDA and ID_SCL entries in it define. HATs aren't applicable on the very early boards, nor are they configured on CM1 or CM3 boards where the breakout was a generic pin header instead of the "standard" 40 pin GPIO header.
CM4 initially had reading HAT EEPROMs disabled as the logic followed the CM1/3 route, but seeing as it does have a 40pin GPIO header that could accept HATs that decision was changed. The master blob file was updated, but the camera/display ones got missed.
I've just sent off files to update datasheets.raspberrypi.org.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “General discussion”