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

Best (recommended) way to configure CM3Lite

Tue Feb 14, 2017 8:50 am

Hi,
started working on my first project using a CM3Lite. I'm now asking myself what is the best - or recommended way - to configure the GPIO.

I need to have peripherals initialised as early as possible, that's why I first thought of having my custom dt-blob.bin file.
In addition, I'm looking for an easy way to configure (enable/disable) some of the peripherals why I think overlays will be suited best for this.
So, here's what I intend to use:
24-bit DPI-Interface (ALT2 mode on GPIO 0 - 27) --> own blob or 24-bit overlay can be used
SD1 (ALT3 mode on GPIO 34 - 39) for WiFi module --> default overlay (sdio-overlay.dts) can't be used since it's configuring the wrong GPIO --> modify this for custom overlay or is there another one doing the same?
both UARTs (UART0 = ALT3 on GPIO31+32, UART1=ALT5 on GPIO40+41) --> is there an overlay for this and is it still UART1 that can be enabled/disabled via raspi-config? Which of them will be used for SSH in case this is enabled?
I2C (SDx0 on GPIO28+29) --> is there an overlay?
In addition some of the remaining GPIO are used for controlling ofter HW (enable signals, reset, PWM, etc). How to deal with them - overlay of device tree blob?
DPI1, CAM0 will be treated similiar to RPi3B initialization, only one USB port will be there.

Thank's for your feedback, rgds
Joerg

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 14, 2017 10:00 am

aBUGSworstnightmare wrote:Hi,
started working on my first project using a CM3Lite. I'm now asking myself what is the best - or recommended way - to configure the GPIO.

I need to have peripherals initialised as early as possible, that's why I first thought of having my custom dt-blob.bin file.
You're not initialising the peripherals any sooner, just the GPIO configuration.
aBUGSworstnightmare wrote:In addition, I'm looking for an easy way to configure (enable/disable) some of the peripherals why I think overlays will be suited best for this.
So, here's what I intend to use:
24-bit DPI-Interface (ALT2 mode on GPIO 0 - 27) --> own blob or 24-bit overlay can be used
SD1 (ALT3 mode on GPIO 34 - 39) for WiFi module --> default overlay (sdio-overlay.dts) can't be used since it's configuring the wrong GPIO --> modify this for custom overlay or is there another one doing the same?
both UARTs (UART0 = ALT3 on GPIO31+32, UART1=ALT5 on GPIO40+41) --> is there an overlay for this and is it still UART1 that can be enabled/disabled via raspi-config? Which of them will be used for SSH in case this is enabled?
https://github.com/raspberrypi/firmware ... ADME#L1297

Code: Select all

Name:   uart1
Info:   Enable uart1 in place of uart0
Load:   dtoverlay=uart1,<param>=<val>
Params: txd1_pin                GPIO pin for TXD1 (14, 32 or 40 - default 14)
rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15)
There doesn't appear to be an equivalent overlay for uart0.
I wouldn't recommend mixing and matching using raspi-config and setting up your own overlays - you will end up with strangeness when the raspi-config scripts get confused due to extra parameters.
Neither will get used for SSH. One will get used for the serial console, and that is whichever is registered as serial0 unless you alter /boot/cmdline.txt.
aBUGSworstnightmare wrote:I2C (SDx0 on GPIO28+29) --> is there an overlay?
https://github.com/raspberrypi/firmware ... EADME#L550

Code: Select all

Name:   i2c0-bcm2708
Info:   Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations
        are usable on all platforms.
Load:   dtoverlay=i2c0-bcm2708,<param>=<val>
Params: sda0_pin                GPIO pin for SDA0 (deprecated - use pins_*)
        scl0_pin                GPIO pin for SCL0 (deprecated - use pins_*)
        pins_0_1                Use pins 0 and 1 (default)
        pins_28_29              Use pins 28 and 29
        pins_44_45              Use pins 44 and 45
pins_46_47 Use pins 46 and 47
But i2c-0 isn't available to you if you're using the camera, and otherwise only if you're using very recent firmware (27 Jan 2017 or later).
You could use i2c-1 on 44&45 ALT2 https://github.com/raspberrypi/firmware ... EADME#L562

Code: Select all

Name:   i2c1-bcm2708
Info:   Enable the i2c_bcm2708 driver for the i2c1 bus
Load:   dtoverlay=i2c1-bcm2708,<param>=<val>
Params: sda1_pin                GPIO pin for SDA1 (2 or 44 - default 2)
        scl1_pin                GPIO pin for SCL1 (3 or 45 - default 3)
        pin_func                Alternative pin function (4 (alt0), 6 (alt2) - default 4)
(that overlay could do with being updated to use pins in the same way as i2c0-bcm2708).
aBUGSworstnightmare wrote:In addition some of the remaining GPIO are used for controlling ofter HW (enable signals, reset, PWM, etc). How to deal with them - overlay of device tree blob?
DPI1, CAM0 will be treated similiar to RPi3B initialization, only one USB port will be there.
Camera requires changes to dt-blob.bin - you can't change that.

Where there is an overlay or sensible Linux driver for it then it would be worth using it as the kernel will then reserve the GPIOs for that purpose and avoid conflicts.
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.

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 11:22 am

I'm still banging my head round the dt-blob-file for my custom CM3lite carrier board.

Functions I want to use:
GPIO 0 to 27: 24-bit DPI interface
GPIO28/29: I2C0 for camera0 and DSI display
GPIO30/31: camera control signals (LED and Shutdown)
GPIO32/33: UART0
GPIO34 to 39: SD1 mode for connecting to ESP12F WiFi module
GPIO40/41: PWM for audio
GPIO 43 to 45: additional control signals for DPI display

Here's the dt-blob.dts file I've generated. Would be glad if somebody could check to see if this is o.k.. because I have no idea what
SMPS_SCL, SMPS_SDA, ID_SDA and ID_SCL
are needed for.

Code: Select all

/dts-v1/;

/ {
  videocore {

	pins_cm3 { // Pi 3 CM3
         pin_config {

            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin

            // configure GPIO for 24-bit DPI interface
            pin@p0 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // CLK
            pin@p1 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // DEN
            pin@p2 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // VSYNC
            pin@p3 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // HSYNC
            pin@p4 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B0
            pin@p5 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B1
            pin@p6 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B2
            pin@p7 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B3
            pin@p8 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B4
            pin@p9 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B5
            pin@p10 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B6
            pin@p11 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B7
            pin@p12 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G0
            pin@p13 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G1
            pin@p14 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G2
            pin@p15 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G3
            pin@p16 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G4
            pin@p17 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G5
            pin@p18 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G6
            pin@p19 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G7
            pin@p20 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R0
            pin@p21 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R1
            pin@p22 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R2
            pin@p23 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R3
            pin@p24 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R4
            pin@p25 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R5
            pin@p26 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R6
            pin@p27 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R7
	    
            // I2C0 interface - used for Camera0 and DSI
            pin@p28 { function = "input";   termination = "pull_up";    }; // I2C 0 SDA
            pin@p29 { function = "input";   termination = "pull_up";    }; // I2C 0 SCL
		
            // Camera0 control signals
            pin@p30 { function = "output"; termination = "no_pulling"; }; // LED
            pin@p31 { function = "output"; termination = "no_pulling"; }; // SHUTDOWN

            // UART0
            pin@p32 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p33 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
		
            // ESP12F WiFi module (ESP8266 based)
            pin@p34 { function = "sdcard";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_CLK
            pin@p35 { function = "sdcard";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_CMD
            pin@p36 { function = "sdcard";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D0
            pin@p37 { function = "sdcard";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D1
            pin@p38 { function = "sdcard";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D2
            pin@p39 { function = "sdcard";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D3

            // use two PWMs for audio signal
            pin@p40 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Right audio
            pin@p41 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // Left audio
		
            // additional control signals
            pin@p43 { function = "output"; termination = "no_pulling"; }; // ID_SD
            pin@p44 { function = "output"; termination = "no_pulling"; }; // /OE
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // PWM backlight control

            // from original dt-blob.dts
            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 = <1>;
            };
            pin_define@CAMERA_0_LED {
                type = "internal";
                number = <30>;
            };
            pin_define@CAMERA_0_SHUTDOWN { 
                type = "internal"; 
                number = <31>;
            };
            pin_define@CAMERA_0_UNICAM_PORT { // use CAM1 interface
                type = "internal"; 
                number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT { 
                type = "internal"; 
                number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
                type = "internal"; 
                number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN { 
                type = "internal"; 
                number = <29>;
            };
            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 = "internal";
               number = <41>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            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_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines

    }; // pins_cm3

  };

};
Last edited by aBUGSworstnightmare on Wed Feb 22, 2017 8:48 am, edited 1 time in total.

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 12:30 pm

SMPS_SCL, SMPS_SDA, ID_SDA and ID_SCL
Leave them alone.
SMPS_Sxx = Switched Mode Power Supply. Any over/under voltage setup needs to be able to talk to it (over a bit banged I2C assuming a recent firmware, otherwise i2c-0 from the GPU).
ID_Sxx = HAT ID EEPROM pins. Not normally applicable on a CM as you're builing everything onto your carrier board, hence "absent".

What is and isn't working?
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.

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 1:50 pm

6by9 wrote:
SMPS_SCL, SMPS_SDA, ID_SDA and ID_SCL
Leave them alone.
SMPS_Sxx = Switched Mode Power Supply. Any over/under voltage setup needs to be able to talk to it (over a bit banged I2C assuming a recent firmware, otherwise i2c-0 from the GPU).
ID_Sxx = HAT ID EEPROM pins. Not normally applicable on a CM as you're builing everything onto your carrier board, hence "absent".

What is and isn't working?
Understood! Thanks for clarification.
Well, I've started testing the WiFi module n the V3 I/O board but with no luck so far. I think I still have an issue with the overlay I've generated (using sdio-overlay.dts as a template and changing the pin numbers). Need to further investigate this.
I've not tested DPI simply because I've used custom blobs on 'standard' RPis quite often already and don't expect any problems (and also need to finish the board design first because DPI is hooked to a single-pixel-in/dual-pixel-out LVDS transmitter).
I intend to proceed with further testings (camera, etc) once WiFi is working since I'm doing the schamtics/layout after I've verified that is (at least should be) working.

What I don't know atm is the relation between the definitions in the blob and the 'real hardware'. Although I'm mentioning CAM0 I will use the 4-lane CSI (CAM1 on the I/O-board). Do I need to change the blob for this or how to select the appropiate interface? Same applies for DSI1 (4-lane MIPI).

I'm still looking for an alternative to U4 (ESD5384) in a more 'user friendly' package, with TI TPD12S520DBTR beeing my favorite candidate as of today. So in case you can give some recommendation this would be welcome as well.

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 3:04 pm

aBUGSworstnightmare wrote:Well, I've started testing the WiFi module n the V3 I/O board but with no luck so far. I think I still have an issue with the overlay I've generated (using sdio-overlay.dts as a template and changing the pin numbers). Need to further investigate this.
I've not tested DPI simply because I've used custom blobs on 'standard' RPis quite often already and don't expect any problems (and also need to finish the board design first because DPI is hooked to a single-pixel-in/dual-pixel-out LVDS transmitter).
I intend to proceed with further testings (camera, etc) once WiFi is working since I'm doing the schamtics/layout after I've verified that is (at least should be) working.
Feel free to post the overlay and you'll get more sets of eyes looking at it.
You shouldn't need to set up the pins for anything that has an overlay in dt-blob.bin. The overlay and kernel should do all the pin allocation and muxing.
aBUGSworstnightmare wrote:What I don't know atm is the relation between the definitions in the blob and the 'real hardware'. Although I'm mentioning CAM0 I will use the 4-lane CSI (CAM1 on the I/O-board). Do I need to change the blob for this or how to select the appropiate interface? Same applies for DSI1 (4-lane MIPI).
Refer to https://github.com/raspberrypi/document ... -camera.md for CAM1 / CAM0 allocation. CAMERA_x_UNICAM_PORT dictates whether it uses Unicam0 (2-lane) or Unicam1 (4-lane).
DSI is hard coded in the firmware to only use DSI1. DSI0 is totally unused at the moment.
aBUGSworstnightmare wrote:I'm still looking for an alternative to U4 (ESD5384) in a more 'user friendly' package, with TI TPD12S520DBTR beeing my favorite candidate as of today. So in case you can give some recommendation this would be welcome as well.
Sorry, that side of the hardware isn't an area I deal with.
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.

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 3:41 pm

The overlay source is nothing special; just edited from the original (sdio-overlay.dts) one:

Code: Select all

/* Enable SDIO from MMC interface via GPIOs 34-39. Includes sdhost overlay. */

/include/ "sdhost-overlay.dts"

/{
	compatible = "brcm,bcm2708";

	fragment@3 {
		target = <&mmc>;
		sdio_mmc: __overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <&sdio_pins>;
			non-removable;
			bus-width = <4>;
			brcm,overclock-50 = <0>;
			status = "okay";
		};
	};

	fragment@4 {
		target = <&gpio>;
		__overlay__ {
			sdio_pins: sdio_pins {
				brcm,pins = <34 35 36 37 38 39>;
				brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */
				brcm,pull = <0 2 2 2 2 2>;
			};
		};
	};

	__overrides__ {
		poll_once = <&sdio_mmc>,"non-removable?";
		bus_width = <&sdio_mmc>,"bus-width:0";
		sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0";
	};
};
Well, this docu is exactly where the confusion comes from!
I think we are in-line that what is called CAM1 is the 4-lane CSI, right?

So, when the docu speaks of 'attaching camera to CAM1' it referrs to this as camera0

Code: Select all

pin_define@CAMERA_0_LED { type = "internal"; number = <2>; };
pin_define@CAMERA_0_SHUTDOWN { type = "internal"; number = <3>; };
pin_define@CAMERA_0_UNICAM_PORT { type = "internal"; number = <1>; };
pin_define@CAMERA_0_I2C_PORT { type = "internal"; number = <0>; };
pin_define@CAMERA_0_SDA_PIN { type = "internal"; number = <0>; };
pin_define@CAMERA_0_SCL_PIN { type = "internal"; number = <1>; };
with the only exeption of

Code: Select all

pin_define@CAMERA_0_UNICAM_PORT { type = "internal"; number = <1>; };
That menas this '1' distinguishes between CAMx --> CAM1 interface for the above?
When looking at this I'm asking myself why it has not been decided to keep a naming convention, means a camera attached to CAM1 interface is also referred to as CAMERA_1_xxx in all definitions, which could than make the link of 'CAMERA_1_UNICAM_PORT =1' more obvisious.
Nevertheless, think I got it now and will change my blob (it's looking at CAM0 atm but CAM1 will be used).

In regards of CSI1 and DSI1 does this mean that on the 'ordinary Pi' only 2 out of 4-lanes are routed to the connector? Is it that simple?

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

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 3:51 pm

I'll look at the overlay in a bit, or you can hope that Phil drops by.
aBUGSworstnightmare wrote:So, when the docu speaks of 'attaching camera to CAM1' it referrs to this as camera0

Code: Select all

pin_define@CAMERA_0_LED { type = "internal"; number = <2>; };
pin_define@CAMERA_0_SHUTDOWN { type = "internal"; number = <3>; };
pin_define@CAMERA_0_UNICAM_PORT { type = "internal"; number = <1>; };
pin_define@CAMERA_0_I2C_PORT { type = "internal"; number = <0>; };
pin_define@CAMERA_0_SDA_PIN { type = "internal"; number = <0>; };
pin_define@CAMERA_0_SCL_PIN { type = "internal"; number = <1>; };
with the only exeption of

Code: Select all

pin_define@CAMERA_0_UNICAM_PORT { type = "internal"; number = <1>; };
That menas this '1' distinguishes between CAMx --> CAM1 interface for the above?
When looking at this I'm asking myself why it has not been decided to keep a naming convention, means a camera attached to CAM1 interface is also referred to as CAMERA_1_xxx in all definitions, which could than make the link of 'CAMERA_1_UNICAM_PORT =1' more obvisious.
Nevertheless, think I got it now and will change my blob (it's looking at CAM0 atm but CAM1 will be used).
History mainly.
On phones the back camera is generally the higher resolution and therefore wants to have the option of 4 lanes. Both the mobile OSes that I've encountered want to refer to the back camera as "camera 0" (the documentation for the OS may not say that is the case, but 99.9% of the apps written for it make the assumption!).
You therefore have to be able to detach the logical camera number referenced in software from the hardware wiring - that is the table you are setting up with the defines. The CAMERA_x bit is software. The values on the other side define the hardware.
aBUGSworstnightmare wrote:In regards of CSI1 and DSI1 does this mean that on the 'ordinary Pi' only 2 out of 4-lanes are routed to the connector? Is it that simple?
Correct. The hardware block in both cases is capable of running 4 lanes, but only 2 of them are routed on the Pi PCB.
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.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3000
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Best (recommended) way to configure CM3Lite

Tue Feb 21, 2017 3:54 pm

The overlay looks fine - only the pins have been changed.

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

Re: Best (recommended) way to configure CM3Lite

Wed Feb 22, 2017 9:04 am

Hey guys,

o.k. just compiled my device tree (the one from here viewtopic.php?p=1117511#p1117511), decompiled it (sudo dtc -I dtb -O dts -o dt-blob-dc.dts /boot/dt-blob.bin) again which results in

Code: Select all

/dts-v1/;

/ {

	videocore {

		pins_cm3 {

			pin_config {

				pin@default {
					polarity = "active_high";
					termination = "pull_down";
					startup_state = "inactive";
					function = "input";
				};

				pin@p0 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p1 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p2 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p3 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p4 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p5 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p6 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p7 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p8 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p9 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p10 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p11 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p12 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p13 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p14 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p15 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p16 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p17 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p18 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p19 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p20 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p21 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p22 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p23 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p24 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p25 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p26 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p27 {
					function = "dpi";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p28 {
					function = "input";
					termination = "pull_up";
				};

				pin@p29 {
					function = "input";
					termination = "pull_up";
				};

				pin@p30 {
					function = "output";
					termination = "no_pulling";
				};

				pin@p31 {
					function = "output";
					termination = "no_pulling";
				};

				pin@p32 {
					function = "uart0";
					termination = "no_pulling";
					drive_strength_mA = <0x8>;
				};

				pin@p33 {
					function = "uart0";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p34 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p35 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p36 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p37 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p38 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p39 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p40 {
					function = "pwm";
					termination = "no_pulling";
					drive_strength_mA = <0x10>;
				};

				pin@p41 {
					function = "pwm";
					termination = "no_pulling";
					drive_strength_mA = <0x10>;
				};

				pin@p43 {
					function = "output";
					termination = "no_pulling";
				};

				pin@p44 {
					function = "output";
					termination = "no_pulling";
				};

				pin@p45 {
					function = "pwm";
					termination = "no_pulling";
					drive_strength_mA = <0x10>;
				};

				pin@p46 {
					function = "input";
					termination = "pull_up";
				};

				pin@p47 {
					function = "input";
					termination = "pull_up";
				};

				pin@p48 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p49 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p50 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p51 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p52 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p53 {
					function = "sdcard";
					termination = "pull_up";
					drive_strength_mA = <0x8>;
				};

				pin@p128 {
					function = "input";
					termination = "no_pulling";
					polarity = "active_low";
				};

				pin@p129 {
					function = "output";
					termination = "no_pulling";
					polarity = "active_low";
				};
			};

			pin_defines {

				pin_define@HDMI_CONTROL_ATTACHED {
					type = "external";
					number = <0x0>;
				};

				pin_define@EMMC_ENABLE {
					type = "external";
					number = <0x1>;
				};

				pin_define@NUM_CAMERAS {
					type = "internal";
					number = <0x1>;
				};

				pin_define@CAMERA_0_LED {
					type = "internal";
					number = <0x1e>;
				};

				pin_define@CAMERA_0_SHUTDOWN {
					type = "internal";
					number = <0x1f>;
				};

				pin_define@CAMERA_0_UNICAM_PORT {
					type = "internal";
					number = <0x1>;
				};

				pin_define@CAMERA_0_I2C_PORT {
					type = "internal";
					number = <0x0>;
				};

				pin_define@CAMERA_0_SDA_PIN {
					type = "internal";
					number = <0x1c>;
				};

				pin_define@CAMERA_0_SCL_PIN {
					type = "internal";
					number = <0x1d>;
				};

				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 = <0x2e>;
				};

				pin_define@SMPS_SCL {
					type = "internal";
					number = <0x2f>;
				};

				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 = "internal";
					number = <0x29>;
				};

				pin_define@PWMR {
					type = "internal";
					number = <0x28>;
				};

				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_I2C_PORT {
					type = "internal";
					number = <0x0>;
				};

				pin_define@DISPLAY_SDA {
					type = "internal";
					number = <0x1c>;
				};

				pin_define@DISPLAY_SCL {
					type = "internal";
					number = <0x1d>;
				};
			};
		};
	};
};
which is looking o.k. to me. But, when checking the gpio-status (sudo raspi-gpio get) the result is not as expected:

Code: Select all

pi@raspberrypi:~ $ sudo raspi-gpio get
BANK0 (GPIO 0 to 27):
  GPIO 00: level=1 fsel=6 alt=2 func=PCLK
  GPIO 01: level=0 fsel=6 alt=2 func=DE
  GPIO 02: level=0 fsel=6 alt=2 func=LCD_VSYNC
  GPIO 03: level=0 fsel=6 alt=2 func=LCD_HSYNC
  GPIO 04: level=0 fsel=6 alt=2 func=DPI_D0
  GPIO 05: level=0 fsel=6 alt=2 func=DPI_D1
  GPIO 06: level=0 fsel=6 alt=2 func=DPI_D2
  GPIO 07: level=0 fsel=6 alt=2 func=DPI_D3
  GPIO 08: level=0 fsel=6 alt=2 func=DPI_D4
  GPIO 09: level=0 fsel=6 alt=2 func=DPI_D5
  GPIO 10: level=0 fsel=6 alt=2 func=DPI_D6
  GPIO 11: level=0 fsel=6 alt=2 func=DPI_D7
  GPIO 12: level=0 fsel=6 alt=2 func=DPI_D8
  GPIO 13: level=0 fsel=6 alt=2 func=DPI_D9
  GPIO 14: level=0 fsel=6 alt=2 func=DPI_D10
  GPIO 15: level=0 fsel=6 alt=2 func=DPI_D11
  GPIO 16: level=0 fsel=6 alt=2 func=DPI_D12
  GPIO 17: level=0 fsel=6 alt=2 func=DPI_D13
  GPIO 18: level=0 fsel=6 alt=2 func=DPI_D14
  GPIO 19: level=0 fsel=6 alt=2 func=DPI_D15
  GPIO 20: level=0 fsel=6 alt=2 func=DPI_D16
  GPIO 21: level=0 fsel=6 alt=2 func=DPI_D17
  GPIO 22: level=0 fsel=6 alt=2 func=DPI_D18
  GPIO 23: level=0 fsel=6 alt=2 func=DPI_D19
  GPIO 24: level=0 fsel=6 alt=2 func=DPI_D20
  GPIO 25: level=0 fsel=6 alt=2 func=DPI_D21
  GPIO 26: level=0 fsel=6 alt=2 func=DPI_D22
  GPIO 27: level=0 fsel=6 alt=2 func=DPI_D23
BANK1 (GPIO 28 to 45):
  GPIO 28: level=1 fsel=0 alt=  func=INPUT
  GPIO 29: level=1 fsel=0 alt=  func=INPUT
  GPIO 30: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 31: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 32: level=1 fsel=7 alt=3 func=TXD0
  GPIO 33: level=1 fsel=7 alt=3 func=RXD0
  GPIO 34: level=1 fsel=0 alt=  func=INPUT
  GPIO 35: level=1 fsel=0 alt=  func=INPUT
  GPIO 36: level=1 fsel=0 alt=  func=INPUT
  GPIO 37: level=1 fsel=0 alt=  func=INPUT
  GPIO 38: level=1 fsel=0 alt=  func=INPUT
  GPIO 39: level=1 fsel=0 alt=  func=INPUT
  GPIO 40: level=0 fsel=0 alt=  func=INPUT
  GPIO 41: level=0 fsel=0 alt=  func=INPUT
  GPIO 42: level=0 fsel=0 alt=  func=INPUT
  GPIO 43: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 44: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 45: level=0 fsel=4 alt=0 func=PWM1
BANK2 (GPIO 46 to 53):
  GPIO 46: level=1 fsel=4 alt=0 func=SDA0
  GPIO 47: level=1 fsel=4 alt=0 func=SCL0
  GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
  GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
  GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
  GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
  GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
  GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
--> GPIO 34 to 39 doesn't appera to be configure to ALT3! Is this notmal behavior when configuring these I/O to SD1 or is there something wrong?
Please explain as well why SDA0 is not configured on GPIO28/29 but is displayed on #46/47 (you've explained that it defaults to I2C0) correctly.
This shows one error for sure: I'm trying to use PWM1 function on two GPIO: #41 and #45. This would explain why #41 is not configured correctly, but leaves open why #40 = PWM0 is shown as PWM0 (ALT=).

Any help is appreciated!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3000
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Best (recommended) way to configure CM3Lite

Wed Feb 22, 2017 9:21 am

"sdcard" equates to SD0, which isn't available on pins 34-39; for SD1 you need to use "emmc". Having said that, I think you'd be better off leaving this to the DT overlay, which will be required anyway to cause the driver to be loaded and enabled.

I2C0 is being used on pins 46 & 47 to drive the SMPS - you've declared it in pins_cm3, albeit as named pins and in hex (0x2e & 0x2f). The I2C driver will dynamically switch pin mappings as needed, so declaring 46 & 47 as inputs gets overridden. If you update to a newer firmware (sudo rpi-update) you'll find that those pins are driven by the VPU in software, leaving I2C0 free for your own purposes.

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

Re: Best (recommended) way to configure CM3Lite

Wed Feb 22, 2017 9:46 am

PhilE wrote:If you update to a newer firmware (sudo rpi-update) you'll find that those pins are driven by the VPU in software, leaving I2C0 free for your own purposes.
Own purposes in this case being the camera - that'll need i2c0 from the VPU anyway.
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.

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

Re: Best (recommended) way to configure CM3Lite

Wed Feb 22, 2017 10:25 am

PhilE wrote:"sdcard" equates to SD0, which isn't available on pins 34-39; for SD1 you need to use "emmc". Having said that, I think you'd be better off leaving this to the DT overlay, which will be required anyway to cause the driver to be loaded and enabled.
Yes, it's understood that the overlay (refer to viewtopic.php?p=1117666#p1117666) is needed anyhow. I justed wanted to make sure that GPIO configuration is readable and matching the HW-requirements (default config and status (Pull-up/down).
The overlay will overwrite the blob configuration anyhow, so it shouldn't harm (cause any problems) to use them later (i.e. the one for SDIO and DPI24, ..).
PhilE wrote:I2C0 is being used on pins 46 & 47 to drive the SMPS - you've declared it in pins_cm3, albeit as named pins and in hex (0x2e & 0x2f). The I2C driver will dynamically switch pin mappings as needed, so declaring 46 & 47 as inputs gets overridden. If you update to a newer firmware (sudo rpi-update) you'll find that those pins are driven by the VPU in software, leaving I2C0 free for your own purposes.
I've simpley didn't touch SMPS definitions on #46/47 as suggested. I have a camera here and intend to check later if everything is fine with I2C0 definitions.

But this still leaves PWM related question unanswerd. I will check with both configurations now (a) use PWM on #40/41 and b) only use PWM on #45 to see what makes the difference (because - if I'm right from my mind - PWM0/1 are displayed on the RPI3).

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

Re: Best (recommended) way to configure CM3Lite

Wed Feb 22, 2017 11:41 am

O.K. changing the device tree to

Code: Select all

/dts-v1/;

/ {
  videocore {

	pins_cm3 { // Pi 3 CM3
         pin_config {

            pin@default {
               polarity = "active_high";
               termination = "pull_down";
               startup_state = "inactive";
               function = "input";
            }; // pin

            // configure GPIO for 24-bit DPI interface
            pin@p0 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // CLK
            pin@p1 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // DEN
            pin@p2 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // VSYNC
            pin@p3 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // HSYNC
            pin@p4 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B0
            pin@p5 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B1
            pin@p6 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B2
            pin@p7 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B3
            pin@p8 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B4
            pin@p9 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B5
            pin@p10 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B6
            pin@p11 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // B7
            pin@p12 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G0
            pin@p13 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G1
            pin@p14 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G2
            pin@p15 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G3
            pin@p16 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G4
            pin@p17 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G5
            pin@p18 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G6
            pin@p19 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // G7
            pin@p20 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R0
            pin@p21 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R1
            pin@p22 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R2
            pin@p23 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R3
            pin@p24 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R4
            pin@p25 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R5
            pin@p26 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R6
            pin@p27 { function = "dpi";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // R7
	    
            // I2C0 interface - used for Camera0 and DSI
            pin@p28 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SDA
            pin@p29 { function = "i2c0";   termination = "pull_up";    }; // I2C 0 SCL
		
            // Camera0 control signals
            pin@p30 { function = "output"; termination = "no_pulling"; }; // LED
            pin@p31 { function = "output"; termination = "no_pulling"; }; // SHUTDOWN

            // UART0
            pin@p32 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
            pin@p33 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
		
            // ESP12F WiFi module (ESP8266 based)
            pin@p34 { function = "emmc";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_CLK
            pin@p35 { function = "emmc";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_CMD
            pin@p36 { function = "emmc";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D0
            pin@p37 { function = "emmc";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D1
            pin@p38 { function = "emmc";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D2
            pin@p39 { function = "emmc";  termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD1_D3
		
            // additional control signals
            pin@p43 { function = "output"; termination = "no_pulling"; }; // ID_SD
            pin@p44 { function = "output"; termination = "no_pulling"; }; // /OE
            pin@p45 { function = "pwm";    termination = "no_pulling"; drive_strength_mA = < 16 >; }; // PWM backlight control

            // from original dt-blob.dts
            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 = <1>;
            };
            pin_define@CAMERA_0_LED {
                type = "internal";
                number = <30>;
            };
            pin_define@CAMERA_0_SHUTDOWN { 
                type = "internal"; 
                number = <31>;
            };
            pin_define@CAMERA_0_UNICAM_PORT { // use CAM1 interface
                type = "internal"; 
                number = <1>;
            };
            pin_define@CAMERA_0_I2C_PORT { 
                type = "internal"; 
                number = <0>;
            };
            pin_define@CAMERA_0_SDA_PIN {
                type = "internal"; 
                number = <28>;
            };
            pin_define@CAMERA_0_SCL_PIN { 
                type = "internal"; 
                number = <29>;
            };
            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 = "internal";
               number = <41>;
            };
            pin_define@PWMR {
               type = "internal";
               number = <40>;
            };
            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_I2C_PORT {
               type = "internal";
               number = <0>;
            };
            pin_define@DISPLAY_SDA {
               type = "internal";
               number = <28>;
            };
            pin_define@DISPLAY_SCL {
               type = "internal";
               number = <29>;
            };
         }; // pin_defines

    }; // pins_cm3

  };

};
gives

Code: Select all

pi@raspberrypi:~ $ sudo raspi-gpio get
BANK0 (GPIO 0 to 27):
  GPIO 00: level=1 fsel=6 alt=2 func=PCLK
  GPIO 01: level=0 fsel=6 alt=2 func=DE
  GPIO 02: level=0 fsel=6 alt=2 func=LCD_VSYNC
  GPIO 03: level=0 fsel=6 alt=2 func=LCD_HSYNC
  GPIO 04: level=0 fsel=6 alt=2 func=DPI_D0
  GPIO 05: level=0 fsel=6 alt=2 func=DPI_D1
  GPIO 06: level=0 fsel=6 alt=2 func=DPI_D2
  GPIO 07: level=0 fsel=6 alt=2 func=DPI_D3
  GPIO 08: level=0 fsel=6 alt=2 func=DPI_D4
  GPIO 09: level=0 fsel=6 alt=2 func=DPI_D5
  GPIO 10: level=0 fsel=6 alt=2 func=DPI_D6
  GPIO 11: level=0 fsel=6 alt=2 func=DPI_D7
  GPIO 12: level=0 fsel=6 alt=2 func=DPI_D8
  GPIO 13: level=0 fsel=6 alt=2 func=DPI_D9
  GPIO 14: level=0 fsel=6 alt=2 func=DPI_D10
  GPIO 15: level=0 fsel=6 alt=2 func=DPI_D11
  GPIO 16: level=0 fsel=6 alt=2 func=DPI_D12
  GPIO 17: level=0 fsel=6 alt=2 func=DPI_D13
  GPIO 18: level=0 fsel=6 alt=2 func=DPI_D14
  GPIO 19: level=0 fsel=6 alt=2 func=DPI_D15
  GPIO 20: level=0 fsel=6 alt=2 func=DPI_D16
  GPIO 21: level=0 fsel=6 alt=2 func=DPI_D17
  GPIO 22: level=0 fsel=6 alt=2 func=DPI_D18
  GPIO 23: level=0 fsel=6 alt=2 func=DPI_D19
  GPIO 24: level=0 fsel=6 alt=2 func=DPI_D20
  GPIO 25: level=0 fsel=6 alt=2 func=DPI_D21
  GPIO 26: level=0 fsel=6 alt=2 func=DPI_D22
  GPIO 27: level=0 fsel=6 alt=2 func=DPI_D23
BANK1 (GPIO 28 to 45):
  GPIO 28: level=1 fsel=0 alt=  func=INPUT
  GPIO 29: level=1 fsel=0 alt=  func=INPUT
  GPIO 30: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 31: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 32: level=1 fsel=7 alt=3 func=TXD0
  GPIO 33: level=1 fsel=7 alt=3 func=RXD0
  GPIO 34: level=0 fsel=7 alt=3 func=SD1_CLK
  GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD
  GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0
  GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1
  GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2
  GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3
  GPIO 40: level=0 fsel=0 alt=  func=INPUT
  GPIO 41: level=0 fsel=0 alt=  func=INPUT
  GPIO 42: level=0 fsel=0 alt=  func=INPUT
  GPIO 43: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 44: level=0 fsel=1 alt=  func=OUTPUT
  GPIO 45: level=0 fsel=4 alt=0 func=PWM1
BANK2 (GPIO 46 to 53):
  GPIO 46: level=1 fsel=4 alt=0 func=SDA0
  GPIO 47: level=1 fsel=4 alt=0 func=SCL0
  GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
  GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
  GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
  GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
  GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
  GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
which is more what I prefer to see (SD1 now configured correctly).
Tested the camera first (no additional installations required) and here is - o.k. not the greatest pic of al times - but one that prooves the blob is working in regards of camera I2C0 and control signals.
cam_small.jpg
cam_small.jpg (46.18 KiB) Viewed 2241 times
Let's see if WiFi module is as simple too...

Return to “Compute Module”