ondrej1024
Posts: 151
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Connecting official 7''" RPi display to custom board

Tue Oct 23, 2018 4:21 pm

Hi,
we have developed a custom board for the CM3 with a connector for the official 7" RPi display. The connections to the CM3 are as follows:
touch-display-connector.png
touch-display-connector.png (16.39 KiB) Viewed 3815 times
The board will be connected to the display via the standard flat cable provided with the display.

SCL0 and SDA0 are connected to GPIO28/29. Then I added the following to my existing dt-blob.dts:

Code: Select all

            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
            pin_define@DISPLAY_I2C_PORT {
               type="internal";
               number=<0>;
             };

Unfortunately the display is not showing any signs of life yet.
Is this the right way to do it? Do I miss something?

Thanks, Ondrej
The Telegea.org project: https://www.telegea.org

aBUGSworstnightmare
Posts: 1282
Joined: Tue Jun 30, 2015 1:35 pm

Re: Connecting official 7''" RPi display to custom board

Tue Oct 23, 2018 6:17 pm

Do you have a CMIO at hands for testing your dt-blob.bin? Sometimes easier as on custom board.

And: you're supplying 5V to the screen, right?
And: i2C pins are also defined in your blob?

ondrej1024
Posts: 151
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Connecting official 7''" RPi display to custom board

Wed Oct 24, 2018 9:31 am

aBUGSworstnightmare wrote: Do you have a CMIO at hands for testing your dt-blob.bin? Sometimes easier as on custom board.
I have the CMIO but not the 22W to 15W display adaptor. Might need to buy it.
aBUGSworstnightmare wrote: And: you're supplying 5V to the screen, right?
Yes, I am ;)
aBUGSworstnightmare wrote: And: i2C pins are also defined in your blob?
Do they need to be defined? They are not defined in the official DTS file from here

The CM3 part in this file looks like this:

Code: Select all

      pins_cm3 { // Pi 3 CM3
         pin_config {
            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin
            pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
            pin@p46 { function = "input";   termination = "pull_up";    }; // SMPS_SCL
            pin@p47 { function = "input";   termination = "pull_up";    }; // SMPS_SDA
            pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
            pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
            pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
            pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
            pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
            pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
            pin@p128 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
            pin@p129 { function = "output"; termination = "no_pulling"; polarity = "active_low"; }; // EMMC_ENABLE_N
         }; // pin_config

         pin_defines {
            pin_define@HDMI_CONTROL_ATTACHED {
               type = "external";
               number = <0>;
            };
            pin_define@EMMC_ENABLE {
               type = "external";
               number = <1>;
            };
            pin_define@NUM_CAMERAS {
               type = "internal";
               number = <0>;
            };
            pin_define@POWER_LOW {
               type = "absent";
            };
            pin_define@LEDS_DISK_ACTIVITY {
               type = "absent";
            };
            pin_define@LAN_RUN {
               type = "absent";
            };
            pin_define@SMPS_SDA {
               type = "internal";
               number = <46>;
            };
            pin_define@SMPS_SCL {
               type = "internal";
               number = <47>;
            };
            pin_define@ETH_CLK {
               type = "absent";
            };
            pin_define@WL_LPO_CLK {
               type = "absent";
            };
            pin_define@USB_LIMIT_1A2 {
               type = "absent";
            };
            pin_define@SIO_1V8_SEL {
               type = "absent";
            };
            pin_define@PWML {
               type = "absent";
            };
            pin_define@PWMR {
               type = "absent";
            };
            pin_define@SAFE_MODE {
               type = "absent";
            };
            pin_define@SD_CARD_DETECT {
               type = "absent";
            };
            pin_define@ID_SDA {
               type = "absent";
            };
            pin_define@ID_SCL {
               type = "absent";
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <0>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <1>;
            };
            pin_define@DISPLAY_I2C_PORT {
               type="internal";
               number=<0>;
             };
         }; // pin_defines
      }; // pins
The Telegea.org project: https://www.telegea.org

aBUGSworstnightmare
Posts: 1282
Joined: Tue Jun 30, 2015 1:35 pm

Re: Connecting official 7''" RPi display to custom board

Thu Oct 25, 2018 5:24 am

ondrej1024 wrote: Do they need to be defined? They are not defined in the official DTS file from here
Up to you! I prefer to define them in pin section too, avoids the problem one tries to use a GPIO which is already in use.

As you are using I2C0 from GPIO28/29, I would like to know how you told the SOC to look for the display there?
Have you added

Code: Select all

dtoverlay=i2c0-bcm2708,pins_28_29
to your 'config.txt' (commenting any reference to I2C0 which might be there)?

What is the result of 'raspi-gpio get'? Does I2C0 show up correctly (and only on GPIO28/29)?

Last question: don't see any pull-up's on the I2C signal lines; are they in place (i.e. 1,8kOhm)?

ondrej1024
Posts: 151
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Connecting official 7''" RPi display to custom board

Thu Oct 25, 2018 7:08 am

aBUGSworstnightmare wrote: Up to you! I prefer to define them in pin section too, avoids the problem one tries to use a GPIO which is already in use.
Now I have added this to the dt-blob:

Code: Select all

            
            pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
            pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
aBUGSworstnightmare wrote: As you are using I2C0 from GPIO28/29, I would like to know how you told the SOC to look for the display there?
Have you added

Code: Select all

dtoverlay=i2c0-bcm2708,pins_28_29
to your 'config.txt' (commenting any reference to I2C0 which might be there)?
I have tried this too, is this an alternative to defining the pins in the dt-blob? It gives the same result (GPIO28/29 configured as I2C0).

This is actually confusing me. I checked on the RPi3 with a stock Raspbian OS and it has GPIO lines44/45 configured as I2C0 but there is no dt-blob.bin and no dtoverlay in config.txt? So how does it configure these GPIOs?
aBUGSworstnightmare wrote: What is the result of 'raspi-gpio get'? Does I2C0 show up correctly (and only on GPIO28/29)?
I don't have the printout here right now but yes, I2C0 shows up correctly on GPIO28/29 only.
aBUGSworstnightmare wrote: Last question: don't see any pull-up's on the I2C signal lines; are they in place (i.e. 1,8kOhm)?
You really got a point here. This might be the actual problem. There are no pull-ups. Shouldn't they be 10kOhm?

Thanks for you help.
The Telegea.org project: https://www.telegea.org

aBUGSworstnightmare
Posts: 1282
Joined: Tue Jun 30, 2015 1:35 pm

Re: Connecting official 7''" RPi display to custom board

Thu Oct 25, 2018 9:15 am

ondrej1024 wrote: Code: Select all

dtoverlay=i2c0-bcm2708,pins_28_29
to your 'config.txt' (commenting any reference to I2C0 which might be there)?
I have tried this too, is this an alternative to defining the pins in the dt-blob? It gives the same result (GPIO28/29 configured as I2C0).
Yes, alternative which reliefes you from the pain of having a custom dt-blob.bin.
ondrej1024 wrote: aBUGSworstnightmare wrote:
Last question: don't see any pull-up's on the I2C signal lines; are they in place (i.e. 1,8kOhm)?
You really got a point here. This might be the actual problem. There are no pull-ups. Shouldn't they be 10kOhm?
They need to be as large/small as needed. On the RPi they are 1,8kOhms (CMIO, as well as on standard PI's); that's why I used this value as reference. On the CMIO schematic pull-ups can be found at the camera connector.

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

Re: Connecting official 7''" RPi display to custom board

Thu Oct 25, 2018 12:12 pm

The VPU will automatically adjust the pinmuxing based on the pins that it has been told the relevant I2C device is connected to. That is why by default none of 0/1, 28/29, 44/45 are defined as having the i2c alt function in dt-blob.bin. It knows which other pins can potentially be muxed to the same i2c peripheral and will reset them back to inputs if something else has messed with the settings.
"dtoverlay=i2c0-bcm2708,pins_28_29" will therefore have no real effect, nor does adding "pin@p28 { function = "i2c0";"....
(dtoverlay=i2c0-bcm2708 potentially has a bad negative effect by telling the ARM it can access i2c0 and therefore have conflicts with the VPU use).

There is a compiled copy of dt-blob.dts embedded in the firmware image. In the absence of a dt-blob.bin on the boot device the firmware uses this version.

No I2C pullups will cause issues. They are R13 & R14 for CAM0/DISP0 and R16 & R17 for CAM1/DISP1 on the CMIO3. All 1k8 pulling to 3V3.
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.

ondrej1024
Posts: 151
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Connecting official 7''" RPi display to custom board

Thu Oct 25, 2018 1:13 pm

6by9 wrote:
Thu Oct 25, 2018 12:12 pm
The VPU will automatically adjust the pinmuxing based on the pins that it has been told the relevant I2C device is connected to. That is why by default none of 0/1, 28/29, 44/45 are defined as having the i2c alt function in dt-blob.bin. It knows which other pins can potentially be muxed to the same i2c peripheral and will reset them back to inputs if something else has messed with the settings.
Thanks for the explanation. But still I don't understand how the display driver knows what GPIOs my board uses for the I2C connection to the display. And why is the display driver loaded anyway? It doesn't seem to be necessary to load an overlay for this. Can you please shed some light on this?
The Telegea.org project: https://www.telegea.org

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

Re: Connecting official 7''" RPi display to custom board

Thu Oct 25, 2018 1:41 pm

ondrej1024 wrote:
Thu Oct 25, 2018 1:13 pm
6by9 wrote:
Thu Oct 25, 2018 12:12 pm
The VPU will automatically adjust the pinmuxing based on the pins that it has been told the relevant I2C device is connected to. That is why by default none of 0/1, 28/29, 44/45 are defined as having the i2c alt function in dt-blob.bin. It knows which other pins can potentially be muxed to the same i2c peripheral and will reset them back to inputs if something else has messed with the settings.
Thanks for the explanation. But still I don't understand how the display driver knows what GPIOs my board uses for the I2C connection to the display. And why is the display driver loaded anyway? It doesn't seem to be necessary to load an overlay for this. Can you please shed some light on this?
You quoted it yourself

Code: Select all

            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
in dt-blob.bin.
There is no overlay required for the display. The partial exception being the touchscreen driver which is automatically enabled via DT should the VPU find the display.
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.

ondrej1024
Posts: 151
Joined: Thu Dec 05, 2013 3:09 pm
Contact: Website

Re: Connecting official 7''" RPi display to custom board

Fri Oct 26, 2018 2:37 pm

Just to let you know that I got the display and touch screen working. Turned out the display connector we mount on our board has the contacts which connect to the flat cable on the wrong side, so I had to use a different flat cable (with the contacts on the same side of the cable on both ends). Now it works even without the pull ups on the I2C lines. Seems to be reliable.

Thanks for your support.
The Telegea.org project: https://www.telegea.org

Return to “Compute Module”