gvkalra
Posts: 6
Joined: Wed May 15, 2019 10:34 am

DSI display and CSI camera conflict

Wed May 15, 2019 10:52 am

Hi,

I am trying to use the following two peripherals together:

Display (DSI): https://www.dfrobot.com/product-1784.html
Camera (CSI): https://www.icbanq.com/P007454353

With DSI display disconnected (and using HDMI display), CSI camera works well:

Code: Select all

$ raspivid -f -v

"raspivid" Camera App (commit 7cbfbd38d982 Tainted)

Camera Name ov5647
Width 1920, Height 1080, filename (null)
Using camera 0, sensor mode 0

GPS output Disabled

bitrate 17000000, framerate 30, time delay 5000
H264 Profile high
H264 Level 4
H264 Quantisation level 0, Inline headers No
H264 Fill SPS Timings No
H264 Intra refresh type (null), period -1
H264 Slices 1
Wait method : Simple capture
Initial state 'record'


Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
Camera component done
Encoder component done
Starting component connection stage
Connecting camera preview port to preview input port
Starting video preview
Connecting camera video port to encoder input port
Enabling encoder output port
Closing down
Close down completed, all components disconnected, disabled and destroyed

$ vcgencmd get_camera
supported=1 detected=1
However, when I connect both DSI display + CSI camera (HDMI is disconnected), it doesn't work well:

Code: Select all

$ raspivid -f -v
mmal: Cannot read camera info, keeping the defaults for OV5647
"raspivid" Camera App (commit 7cbfbd38d982 Tainted)

Camera Name OV5647
Width 1920, Height 1080, filename (null)
Using camera 0, sensor mode 0

GPS output Disabled

bitrate 17000000, framerate 30, time delay 5000
H264 Profile high
H264 Level 4
H264 Quantisation level 0, Inline headers No
H264 Fill SPS Timings No
H264 Intra refresh type (null), period -1
H264 Slices 1
Wait method : Simple capture
Initial state 'record'


Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly

$ vcgencmd get_camera
supported=1 detected=0
The difference between the two logs is:

mmal: Cannot read camera info, keeping the defaults for OV5647

To be honest, I have no idea where to start debugging this issue.
Can someone please point me in the right direction?

Code: Select all

$ uname -a
Linux raspberrypi 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux

Code: Select all

$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Code: Select all

$ sudo rpi-update 
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Your firmware is already up to date

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22711
Joined: Sat Jul 30, 2011 7:41 pm

Re: DSI display and CSI camera conflict

Wed May 15, 2019 11:03 am

Does the display work by itself?

Note, neither of those devices are official, so support from Raspberry Pi will be minimal.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

gvkalra
Posts: 6
Joined: Wed May 15, 2019 10:34 am

Re: DSI display and CSI camera conflict

Wed May 15, 2019 12:27 pm

jamesh wrote:
Wed May 15, 2019 11:03 am
Does the display work by itself?

Note, neither of those devices are official, so support from Raspberry Pi will be minimal.
Yes, the display works by itself.

Hmmm, what intrigues me is:
1. Display works by itself
2. Camera works by itself
3. Together, they don't work (atleast not out of the box)

Any wild guesses on what could be the reason?

User avatar
DarkPlatinum
Posts: 819
Joined: Thu Nov 02, 2017 2:30 pm
Location: Unknown
Contact: Website

Re: DSI display and CSI camera conflict

Wed May 15, 2019 12:46 pm

gvkalra wrote:
Wed May 15, 2019 12:27 pm
Any wild guesses on what could be the reason?
Power supply problems?
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi 3B :) ): Https://Html.dynu.net

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

Re: DSI display and CSI camera conflict

Wed May 15, 2019 1:55 pm

Please run "lsmod" and report the output.
Are there any mods required to config.txt? I can't see any mentioned in their docs.

There are a couple of possibilities that I can think of. The DSI driver from the firmware only supports the official display. That happens to match the resolution of this display, but they'll have had to do a fair amount of work to get it working.
The DSI interface is also available via the vc4-kms-v3d driver, although numerous people have had issues getting it to work. If that is active then there will be contention for the I2C bus between the camera and display.

The other possibility is power as DarkPlatinum has suggested. Bother display and camera are running off the 3.3V rail from the Pi. The display claims it wants 320mA, which is a fair chunk. I don't believe a max available current has ever been specified for the 3.3V rail, but that seems high to me.

As James has said, both are third party products, therefore support effort from Pi Towers is going to be limited. Having said that, we do like to understand why issues are being experienced so we'll help out on diagnostics.
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.

gvkalra
Posts: 6
Joined: Wed May 15, 2019 10:34 am

Re: DSI display and CSI camera conflict

Thu May 16, 2019 1:32 am

Here's the list of loaded modules.
It seems that vc4-kms-v3d driver is not one of them.

Code: Select all

$ lsmod 
Module                  Size  Used by
rfcomm                 49152  4
bnep                   20480  2
fuse                  110592  3
hci_uart               40960  1
btbcm                  16384  1 hci_uart
serdev                 20480  1 hci_uart
bluetooth             385024  29 hci_uart,bnep,btbcm,rfcomm
ecdh_generic           28672  1 bluetooth
evdev                  24576  2
joydev                 20480  0
brcmfmac              311296  0
brcmutil               16384  1 brcmfmac
sha256_generic         20480  0
bcm2835_v4l2           45056  0
cfg80211              614400  1 brcmfmac
bcm2835_codec          36864  0
v4l2_common            16384  1 bcm2835_v4l2
v4l2_mem2mem           24576  1 bcm2835_codec
videobuf2_vmalloc      16384  1 bcm2835_v4l2
bcm2835_mmal_vchiq     32768  2 bcm2835_codec,bcm2835_v4l2
videobuf2_dma_contig    20480  1 bcm2835_codec
videobuf2_memops       16384  2 videobuf2_dma_contig,videobuf2_vmalloc
rfkill                 28672  6 bluetooth,cfg80211
videobuf2_v4l2         24576  3 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
raspberrypi_hwmon      16384  0
videobuf2_common       45056  4 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
hwmon                  16384  1 raspberrypi_hwmon
videodev              200704  6 bcm2835_codec,v4l2_common,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
snd_bcm2835            24576  1
media                  36864  2 videodev,v4l2_mem2mem
snd_pcm               102400  1 snd_bcm2835
vc_sm_cma              24576  1 bcm2835_mmal_vchiq
snd_timer              32768  1 snd_pcm
snd                    73728  5 snd_timer,snd_bcm2835,snd_pcm
rpi_ft5406             16384  0
fixed                  16384  0
rpi_backlight          16384  0
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
i2c_dev                16384  0
ip_tables              24576  0
x_tables               32768  1 ip_tables
ipv6                  450560  24
config.txt is also a standard one. Either DSI display or CSI camera works with it.
But not both at the same time.

Code: Select all

$ cat /boot/config.txt 
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# NOOBS Auto-generated Settings:
hdmi_force_hotplug=1
start_x=1
gpu_mem=128
Regarding power supply, I'll get a multimeter.
For now I only have the output from vcgencmd (which seems to be normal):

Code: Select all

$ \
> for id in core sdram_c sdram_i sdram_p ; do \
>     echo -e "$id:\t$(vcgencmd measure_volts $id)" ; \
> done
core:	volt=1.2000V
sdram_c:	volt=1.2500V
sdram_i:	volt=1.2500V
sdram_p:	volt=1.2250V

gvkalra
Posts: 6
Joined: Wed May 15, 2019 10:34 am

Re: DSI display and CSI camera conflict

Thu May 16, 2019 2:33 am

I also compared the output of raspi-gpio get (obtained while connected to the raspi via ssh)

Left column is screen-connected. Right column is screen-disconnected:
Image

There are two differences:
GPIO 34
SCREEN-CONNECTED GPIO 34: level=1 fsel=7 alt=3 func=SD1_CLK
SCREEN-DISCONNECTED GPIO 34: level=0 fsel=7 alt=3 func=SD1_CLK

GPIO 45
SCREEN-CONNECTED GPIO 45: level=0 fsel=5 alt=1 func=SCL0
SCREEN-DISCONNECTED GPIO 45: level=1 fsel=5 alt=1 func=SCL0

Can it possibly be some (please excuse my ignorance) conflicting GPIO pins which make the screen and display not work together?

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

Re: DSI display and CSI camera conflict

Thu May 16, 2019 7:33 am

The only difference is in the actual state of those two gpios, and as they are special function (i2c and sdcard) those peripherals were just doing something at the time.
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.

gvkalra
Posts: 6
Joined: Wed May 15, 2019 10:34 am

Re: DSI display and CSI camera conflict

Thu May 16, 2019 8:22 am

I borrowed the official 7" Touchscreen display from a friend (just to test things further)

Image

Observations:
  • CSI camera works with the official display
  • However, there's a thunderstorm icon on the display
I used an external DC power supply (fixed at 5V).

Image

However, the current drawn by the raspi-board doesn't exceed 1.3A (the current knob of the DC power supply is at it's maximum)

Could this be a problem?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22711
Joined: Sat Jul 30, 2011 7:41 pm

Re: DSI display and CSI camera conflict

Thu May 16, 2019 8:44 am

Probably worth upgrading the power supply wiring, looks like you get a significant voltage drop over them, and they look a bit thin.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: DSI display and CSI camera conflict

Thu May 16, 2019 9:17 am

The official display runs off the 5V rail on the Pi, so effectively direct from the power supply.

Your display and the camera are running off the 3.3V rail, which is produced by a regulator on the Pi, and it powers some parts of the Pi. If you exceed the available current from that supply then the regulator will potentially shut down or otherwise cause strange behaviour.

The lightning bolt icon means that the Pi is only getting 4.63V on the 5V rail, generally due to losses in the cabling, or a dodgy power supply that is really only a charger (not the situation in this case as you have a bench PSU).
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.

gvkalra
Posts: 6
Joined: Wed May 15, 2019 10:34 am

Re: DSI display and CSI camera conflict

Tue May 21, 2019 2:43 am

Thanks for all the suggestions!

I requested a friend to help me modify the DSI display connection and power it with an external PSU instead of drawing power from RPI's DSI port. The modification was successful, however, it still didn't solve the problem. The camera was not working along with the DSI connection of 5" TFT (although it works with HDMI).

This made us experiment with the official RPI camera and display. And the combination works!

Long story short:
1. Spy camera + 5" TFT => don't work together
2. Spy camera + Official 7" Raspberry Pi display => works together
3. Official Raspberry Pi camera + 5" TFT => works together

For my project, it's important to have a small display unit. So we'll stick with the third combination.

I hope the findings will help future readers.

Return to “Interfacing (DSI, CSI, I2C, etc.)”