Help with dts on rpi compute module io board

I have a Raspberry Pi Compute Module 4 installed on a Raspberry Pi Compute Module IO board. The IO board has 2 CSI connections. I wanted to bring up the ADDI9036 TOF dev kit on one of the  CSI ports. I have rebuilt the latest RPI kernel and also managed to build the addi9036.ko kernel module. I would like to if there is any specific dts overlay file I need to install for the dev. kit to be recognized? I have seen a dts file specific for Rpi, but it looks like it is for a previous Rpi board : https://github.com/analogdevicesinc/linux/blob/rpi-4.19.y/arch/arm/boot/dts/overlays/rpi-addi9036-overlay.dts

Could you please advise me as to how to proceed here for the CMIO4 board?

  • +1
    •  Analog Employees 
    on Apr 26, 2021 6:49 AM

    Hi,

    The devicetree you found on our linux repository is a good starting point for you.

    According to RPI cm4io-datashhet, section 2.11 if you use CAM0 port you have to place 2 jumpers on J6 in order to route ID_SC and ID_SD to camera connector I2C. If you use CAM1 that has I2C_VC bus routed to it so the overlay we have should be compatible.

    Now the problem that I see is that the connector is different on the CM vs normal RPI and our flat cable is compatible with the normal RPI arrangement. The CM one is designed to accommodate 4 lane cameras and you have to design yourself an interposer because they are not pin to pin compatible.

  • I have made progress. I recompiled the kernel with the addi9036 kernel and installed it on the EMMC on the CMIO4. BTW, the stock img from the ToF support page for RPi4 does not work with the CMIO - that is, I am unable to finish flashing the EMMC with the stock img. 

    I have installed the 2 jumpers on J6 to enable CAM0 port and also used an adapter cable to convert from a 15-pin 1mm pitch CSI cable to a 22-pin CSI cable with 0.5mm pitch from here

    I also modified the dts overlay to account for the csi0 port and the i2c0 port. The kernel logs indicate that addi9036 and the eeprom are recognized at the appropriate addresses:

    Apr 30 12:53:05 raspberrypi kernel: [ 6.454030] at24 0-0056: supply vcc not found, using dummy regulator
    Apr 30 12:53:05 raspberrypi kernel: [ 6.459979] at24 0-0056: 131072 byte 24c1024 EEPROM, writable, 32 bytes/write
    Apr 30 12:53:05 raspberrypi kernel: [ 6.520366] addi9036 0-0064: addi9036 detected at address 0x64

    There are two video devices created: /dev/video0 and /dev/video1. However when I start a simple program to read from either of these devices, I get an error:

    Apr 30 12:54:39 raspberrypi kernel: [ 84.737920] addi9036 0-0064: could not set power up registers

    I thought that there was a confusion and even tried using the csi1 port instead of the csi0 port. Even that didn't work.

    I believe what is labeled CAM1 on the CMIO is in fact the csi0 port which has exposed 4-lanes, and the one labeled CAM0 is the csi1 port which is a 2-lane CSI.

    Could you please help?

  • 0
    •  Analog Employees 
    on May 4, 2021 8:56 AM in reply to ram95014

    The error you're seeing originates in this line: https://github.com/analogdevicesinc/linux/blob/rpi-5.4.y/drivers/media/i2c/addi9036.c#L169

    It looks like I2C comm is not working. Can you please try to check with i2ctools (i2cdetect -r -y) if camera and eeprom are really detected on the bus. If the driver is loaded you could see UU at the corresponding address even if the devices are not there so I recommend you to not load the overlay and perform the check with i2cdetect.

    Related to the two video devices you could use v4l2-ctl --all -d /dev/video0/1 to gather more info about them and identify which is the one you should use.

    And related to EMMC, what's the capacity of the one installed on your board? We never tried CM4 with EMMC.