'/dev/v4l-subdev1' node not created anymore for 16 MP Arducam with autofocus (IMX519 based) with Rpi 4B

  1. Where did you get the camera module(s)?
    https://www.amazon.com/gp/product/B09STL7S88/ref=ppx_yo_dt_b_asin_title_o00_s00

  2. Model number of the product(s).
    Arducam 16MP Autofocus Raspberry Pi Camera Module with ABS Case, IMX519

  3. What hardware/platform were you working on?
    Raspberry Pi 4B, Raspberry Pi OS Bullseye Lite with XFCE for desktop

  4. Instructions you have followed. (link/manual/etc.)
    Playing with code found on ArduCAM/Arducam-Pivariety-V4L2-Driver github repo, in the focus folder, as well as libcamera-vid commands called from subshells in python. Please see point 9 at the bottom for more details and links.

  5. Problems you were having.
    At first /dev/v4l-subdev1 node would always be created after/on boot. Now it is not anymore. This is an issue because I have code which tries to control the focus motor and it now crashes since /dev/v4l-subdev1 handle is not created/valid.

  6. The dmesg log from your hardware.

pi@raspberrypi:~ $ dmesg | grep -E 'vc4|bcm|imx'
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1  smsc95xx.macaddr=DC:A6:32:7E:E0:FB vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyAMA0,115200 console=tty3 root=PARTUUID=a4f6aa6f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait logo.nologo consoleblank=0 loglevel=3 quiet plymouth.enable=0 plymouth.ignore-serial-consoles plymouth.enable=0 splash
[    0.086743] bcm2835-mbox fe00b880.mailbox: mailbox enabled
[    0.172059] bcm2835-dma fe007000.dma: DMA legacy API manager, dmachans=0x1
[    1.210521] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000
[    1.238447] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[    1.349379] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    1.349836] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    1.350978] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    1.350997] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated
[    5.127905] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    5.383277] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.387623] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.400739] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    5.435347] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    5.439837] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    5.449297] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    5.507887] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    5.510158] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    5.527613] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    5.532968] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    5.533016] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.533038] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.533074] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.533092] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.538097] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.538195] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    5.540080] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[    5.540837] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[    5.544461] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.544562] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    5.545548] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[    5.608603] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    5.608661] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    5.614557] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[    5.614634] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[    5.615436] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[    5.615510] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    5.615562] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    5.615581] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    5.615597] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    5.622477] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[    5.622623] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[    5.630760] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    7.531491] imx519 10-001a: Device found is imx519
[    7.535964] imx519 10-001a: Consider updating driver imx519 to match on endpoints
[    7.803587] vc4-drm gpu: bound fe400000.hvs (ops vc4_hvs_ops [vc4])
[    7.828832] rc rc0: vc4 as /devices/platform/soc/fef00700.hdmi/rc/rc0
[    7.829058] input: vc4 as /devices/platform/soc/fef00700.hdmi/rc/rc0/input4
[    7.829599] vc4_hdmi fef00700.hdmi: 'dmas' DT property is missing or empty, no HDMI audio
[    7.829657] vc4-drm gpu: bound fef00700.hdmi (ops vc4_hdmi_ops [vc4])
[    7.843555] rc rc1: vc4 as /devices/platform/soc/fef05700.hdmi/rc/rc1
[    7.844181] input: vc4 as /devices/platform/soc/fef05700.hdmi/rc/rc1/input5
[    7.865604] vc4_hdmi fef05700.hdmi: 'dmas' DT property is missing or empty, no HDMI audio
[    7.865682] vc4-drm gpu: bound fef05700.hdmi (ops vc4_hdmi_ops [vc4])
[    7.867165] vc4-drm gpu: bound fe700000.dsi (ops vc4_dsi_ops [vc4])
[    7.867625] vc4-drm gpu: bound fe004000.txp (ops vc4_txp_ops [vc4])
[    7.869046] vc4-drm gpu: bound fe206000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.869405] vc4-drm gpu: bound fe207000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.869723] vc4-drm gpu: bound fe20a000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.869983] vc4-drm gpu: bound fe216000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.870308] vc4-drm gpu: bound fec12000.pixelvalve (ops vc4_crtc_ops [vc4])
[    7.909487] [drm] Initialized vc4 0.0.0 20140616 for gpu on minor 1
[    8.433252] vc4-drm gpu: [drm] fb0: vc4drmfb frame buffer device
[    8.843486] bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
[    8.848109] bcmgenet fd580000.ethernet eth0: Link is Down
[  219.677411] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  524.906727] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  550.205041] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  598.152695] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[  728.458490] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1135.855498] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1393.016378] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1394.072718] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1659.353240] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1787.030030] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1843.255107] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1864.310906] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1865.366923] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 1942.873118] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 2207.165277] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 2208.221407] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 2378.875873] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 2385.497709] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[ 2405.390915] i2c-bcm2835 fe205000.i2c: i2c transfer timed out

  1. Troubleshooting attempts you’ve made.
    Since I already dealt with setting up the drivers properly enough for this to work, I did not attempt to make any changes to any system config files. I’ve only tried basic rebooting, unplugging and re-plugging of the camera to the same port (in case it was a loose connection).

  2. What help do you need?
    Does anyone know the reasons why this would happen? Why would /dev/v4l-subdev1 suddenly stop showing up? My best guess at this point is it’s a hardware failure of some sort, since I already dealt with ensuring the right driver settings/overlays were setup and haven’t made changes to that since. The same code is still working fine on another mirror hardware test rig. Perhaps there is a hardware check I can do with a DMM on the camera module itself as well to probe its not due to ESD damage? Any advice/tips appreciated.


  1. Additional:

Relevant info from my original raspberrypi stackexchange post (where someone commented I should ask here):

I am using code from ArduCAM github repository “Arducam-Pivariety-V4L2-Driver” in the focus folder, namely Focuser.py and v4l2_utils.py. I would add the link here directly but am only allowed 2 links for this post (so you can find that repo link in my original raspberrypi stackexchange post). Specifically I am making use of: Focuser.py, and v4l2_utils.py, as-is. Then I have a custom script I wrote which makes leverages these two. Here are the most relevant snippets:

def main():

    width = 640
    height = 480
    camera_start(width, height)
    os.system('rm /run/shm/test*.jpg') # NECESSARY (not sure why yet)
    time.sleep(2) # let camera warmup
    target = 2000
    print('target (focus): ', target)
    focuser = Focuser('/dev/v4l-subdev1') # get motor control handle
    focuser.set(Focuser.OPT_FOCUS, target)

and the camera_start function definition:

def camera_start(wx,hx):
    print('starting camera')
    global p
    # -n --> without display
    rpistr = "libcamera-vid -t 0 --segment 1 --codec mjpeg -n -o /run/shm/test%06d.jpg --width " + str(wx) + " --height " + str(hx)
    # with display, for debugging (640,480)
    # i.e test manually with: DISPLAY=:0 libcamera-vid -t 0 --segment 1 --codec mjpeg -o /run/shm/test%06d.jpg --width 640 --height 480
    print(rpistr)
    p = subprocess.Popen(rpistr, shell=True, preexec_fn=os.setsid)

Here is the traceback output when I get the error:

Traceback (most recent call last):
  File "/home/pi/fun/pi/scanner/./scan_qr_code.py", line 220, in <module>
    main()
  File "/home/pi/fun/pi/scanner/./scan_qr_code.py", line 168, in main
    focuser = Focuser('/dev/v4l-subdev1')
  File "/home/pi/fun/pi/scanner/Focuser.py", line 40, in __init__
    self.fd = open(self.dev, 'r')
FileNotFoundError: [Errno 2] No such file or directory: '/dev/v4l-subdev1'
My application is ending!
Exception ignored in: <function Focuser.__del__ at 0x7f7f238670>
Traceback (most recent call last):
  File "/home/pi/fun/scanner/Focuser.py", line 99, in __del__
    if self.fd:
AttributeError: 'Focuser' object has no attribute 'fd'

While going through my own dmesg logs again, I noticed it said the imx driver could use updating. So I went ahead and did that via ./install_pivariety_pkgs.sh -p imx519_kernel_driver_low_speed and it actually seems to be fixed now. Was able to reproduce the fix on two separate systems.

1 Like

Created an account just to tell you thanks! Been trying to get this working for some time now. I definitely owe you a pint :grinning:

1 Like