Mega SPI camera not working on Raspberry pi

  1. Where did you get the camera module(s)?
    UCTronics

  2. Model number of the product(s)?
    B0436

  3. What hardware/platform were you working on?
    Raspberry Pi 3B+

  4. Instructions you have followed. (link/manual/etc.)
    Raspberry Pi — SPICamera documentation (arducam.com)

  5. Problems you were having.
    nothing happens when I run the driver. The command just sits in the terminal with no output indefinitely until I close and reopen.
    The pins I am using are:
    VCC - 3.3/5V Pin 17
    GND - Pin 25
    SCK - Pin 23
    MISO - Pin 21
    MOSI - Pin 19
    CS - GPIO 3 (Pin 15, BCM 22)

  6. The dmesg log from your hardware.

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 6.1.21-v7+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1642 SMP Mon Apr 3 17:20:52 BST 2023
[ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Plus Rev 1.3
[ 0.000000] random: crng init done
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Reserved memory: created CMA memory pool at 0x1ec00000, size 256 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000000000-0x000000003b3fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000000000000-0x000000003b3fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000003b3fffff]
[ 0.000000] percpu: Embedded 17 pages/cpu s36884 r8192 d24556 u69632
[ 0.000000] pcpu-alloc: s36884 r8192 d24556 u69632 alloc=17*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 240555
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0 video=Composite-1:720x480@60i vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=PARTUUID=d7719e4b-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[ 0.000000] Unknown kernel command line parameters “splash”, will be passed to user space.
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 680924K/970752K available (10240K kernel code, 1452K rwdata, 2900K rodata, 1024K init, 613K bss, 27684K reserved, 262144K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] ftrace: allocating 34800 entries in 103 pages
[ 0.000000] ftrace: allocated 102 pages with 4 groups
[ 0.000000] trace event string verifier disabled
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] Rude variant of Tasks RCU enabled.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[ 0.000001] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[ 0.000018] Switching to timer-based delay loop, resolution 52ns
[ 0.000387] Console: colour dummy device 80x30
[ 0.000464] printk: console [tty1] enabled
[ 0.000515] Calibrating delay loop (skipped), value calculated using timer frequency… 38.40 BogoMIPS (lpj=192000)
[ 0.000539] pid_max: default: 32768 minimum: 301
[ 0.000687] LSM: Security Framework initializing
[ 0.000894] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.000917] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.002069] cgroup: Disabling memory control group subsystem
[ 0.002312] CPU: Testing write buffer coherency: ok
[ 0.002732] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.003583] cblist_init_generic: Setting adjustable number of callback queues.
[ 0.003601] cblist_init_generic: Setting shift to 2 and lim to 1.
[ 0.003712] cblist_init_generic: Setting shift to 2 and lim to 1.
[ 0.003854] Setting up static identity map for 0x100000 - 0x10003c
[ 0.003993] rcu: Hierarchical SRCU implementation.
[ 0.004003] rcu: Max phase no-delay instances is 1000.
[ 0.004714] smp: Bringing up secondary CPUs …
[ 0.005618] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.006558] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[ 0.007439] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[ 0.007542] smp: Brought up 1 node, 4 CPUs
[ 0.007564] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[ 0.007577] CPU: All CPU(s) started in HYP mode.
[ 0.007584] CPU: Virtualization extensions available.
[ 0.008305] devtmpfs: initialized
[ 0.023576] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[ 0.023805] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.023835] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.033998] pinctrl core: initialized pinctrl subsystem
[ 0.035201] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.038486] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.043549] audit: initializing netlink subsys (disabled)
[ 0.043794] audit: type=2000 audit(0.040:1): state=initialized audit_enabled=0 res=1
[ 0.044404] thermal_sys: Registered thermal governor ‘step_wise’
[ 0.045484] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.045502] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.045747] Serial: AMBA PL011 UART driver
[ 0.051767] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[ 0.070071] raspberrypi-firmware soc:firmware: Attached to firmware from 2023-03-17T10:52:42, variant start
[ 0.080084] raspberrypi-firmware soc:firmware: Firmware hash is 82f3750a65fadae9a38077e3c2e217ad158c8d54
[ 0.122676] kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.
[ 0.127577] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1
[ 0.129243] SCSI subsystem initialized
[ 0.129478] usbcore: registered new interface driver usbfs
[ 0.129541] usbcore: registered new interface driver hub
[ 0.129593] usbcore: registered new device driver usb
[ 0.129812] usb_phy_generic phy: supply vcc not found, using dummy regulator
[ 0.129980] usb_phy_generic phy: dummy supplies not allowed for exclusive requests
[ 0.130237] pps_core: LinuxPPS API ver. 1 registered
[ 0.130248] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti [email protected]
[ 0.130274] PTP clock support registered
[ 2.009733] clocksource: Switched to clocksource arch_sys_counter
[ 2.107311] VFS: Disk quotas dquot_6.6.0
[ 2.107407] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 2.107567] FS-Cache: Loaded
[ 2.107845] CacheFiles: Loaded
[ 2.116329] NET: Registered PF_INET protocol family
[ 2.116615] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 2.119307] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 2.119344] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 2.119369] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 2.119486] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[ 2.119872] TCP: Hash tables configured (established 8192 bind 8192)
[ 2.120013] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 2.120069] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 2.120287] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 2.120808] RPC: Registered named UNIX socket transport module.
[ 2.120820] RPC: Registered udp transport module.
[ 2.120828] RPC: Registered tcp transport module.
[ 2.120836] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 2.122606] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[ 2.125700] Initialise system trusted keyrings
[ 2.125944] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[ 2.135172] zbud: loaded
[ 2.137580] NFS: Registering the id_resolver key type
[ 2.137624] Key type id_resolver registered
[ 2.137634] Key type id_legacy registered
[ 2.137761] nfs4filelayout_init: NFSv4 File Layout Driver Registering…
[ 2.137773] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering…
[ 2.139052] Key type asymmetric registered
[ 2.139065] Asymmetric key parser ‘x509’ registered
[ 2.139241] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[ 2.139255] io scheduler mq-deadline registered
[ 2.139266] io scheduler kyber registered
[ 2.143417] simple-framebuffer 3eaa9000.framebuffer: framebuffer at 0x3eaa9000, 0x151800 bytes
[ 2.143448] simple-framebuffer 3eaa9000.framebuffer: format=a8r8g8b8, mode=720x480x32, linelength=2880
[ 2.143913] Console: switching to colour frame buffer device 90x30
[ 2.148164] simple-framebuffer 3eaa9000.framebuffer: fb0: simplefb registered!
[ 2.152753] bcm2835-rng 3f104000.rng: hwrng registered
[ 2.153128] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[ 2.153986] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[ 2.165067] brd: module loaded
[ 2.172542] loop: module loaded
[ 2.173162] Loading iSCSI transport class v2.0-870.
[ 2.174632] usbcore: registered new interface driver lan78xx
[ 2.174693] usbcore: registered new interface driver smsc95xx
[ 2.174711] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 2.902798] Core Release: 2.80a
[ 2.902814] Setting default values for core params
[ 2.902840] Finished setting default values for core params
[ 3.103107] Using Buffer DMA mode
[ 3.103116] Periodic Transfer Interrupt Enhancement - disabled
[ 3.103125] Multiprocessor Interrupt Enhancement - disabled
[ 3.103134] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 3.103172] Dedicated Tx FIFOs mode

[ 3.104013] WARN::dwc_otg_hcd_init:1074: FIQ DMA bounce buffers: virt = 9ed04000 dma = 0xded04000 len=9024
[ 3.104051] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[ 3.104066] dwc_otg: Microframe scheduler enabled

[ 3.104183] WARN::hcd_init_fiq:457: FIQ on core 1

[ 3.104202] WARN::hcd_init_fiq:458: FIQ ASM at 807c4360 length 36

[ 3.104222] WARN::hcd_init_fiq:497: MPHI regs_base at bb810000
[ 3.104245] dwc_otg 3f980000.usb: DWC OTG Controller
[ 3.104282] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[ 3.104321] dwc_otg 3f980000.usb: irq 89, io mem 0x00000000
[ 3.104373] Init: Port Power? op_state=1
[ 3.104382] Init: Power Port (0)
[ 3.104619] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.01
[ 3.104638] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 3.104654] usb usb1: Product: DWC OTG Controller
[ 3.104666] usb usb1: Manufacturer: Linux 6.1.21-v7+ dwc_otg_hcd
[ 3.104678] usb usb1: SerialNumber: 3f980000.usb
[ 3.105303] hub 1-0:1.0: USB hub found
[ 3.105367] hub 1-0:1.0: 1 port detected
[ 3.105995] dwc_otg: FIQ enabled
[ 3.106005] dwc_otg: NAK holdoff enabled
[ 3.106013] dwc_otg: FIQ split-transaction FSM enabled
[ 3.106028] Module dwc_common_port init
[ 3.106327] usbcore: registered new interface driver usb-storage
[ 3.106535] mousedev: PS/2 mouse device common for all mice
[ 3.109236] sdhci: Secure Digital Host Controller Interface driver
[ 3.109249] sdhci: Copyright(c) Pierre Ossman
[ 3.109513] sdhci-pltfm: SDHCI platform and OF driver helper
[ 3.111590] ledtrig-cpu: registered to indicate activity on CPUs
[ 3.111928] hid: raw HID events driver (C) Jiri Kosina
[ 3.112081] usbcore: registered new interface driver usbhid
[ 3.112092] usbhid: USB HID core driver
[ 3.116117] Initializing XFRM netlink socket
[ 3.116174] NET: Registered PF_PACKET protocol family
[ 3.116308] Key type dns_resolver registered
[ 3.117241] Registering SWP/SWPB emulation handler
[ 3.117942] registered taskstats version 1
[ 3.117998] Loading compiled-in X.509 certificates
[ 3.118796] Key type .fscrypt registered
[ 3.118809] Key type fscrypt-provisioning registered
[ 3.130366] uart-pl011 3f201000.serial: cts_event_workaround enabled
[ 3.130511] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2
[ 3.132532] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[ 3.132819] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[ 3.134074] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[ 3.134092] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[ 3.160542] sdhost: log_buf @ 960ccfbd (ded03000)
[ 3.212270] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 3.214431] of_cfs_init
[ 3.214647] of_cfs_init: OK
[ 3.215720] Waiting for root device PARTUUID=d7719e4b-02…
[ 3.239863] Indeed it is in host mode hprt0 = 00021501
[ 3.246739] mmc0: host does not support reading read-only switch, assuming write-enable
[ 3.250130] mmc0: new high speed SDXC card at address 59b4
[ 3.250947] mmcblk0: mmc0:59b4 SD 57.8 GiB
[ 3.253834] mmcblk0: p1 p2
[ 3.254450] mmcblk0: mmc0:59b4 SD 57.8 GiB
[ 3.265480] mmc1: new high speed SDIO card at address 0001
[ 3.308806] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Quota mode: none.
[ 3.308897] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 3.309794] devtmpfs: mounted
[ 3.315444] Freeing unused kernel image (initmem) memory: 1024K
[ 3.350233] Run /sbin/init as init process
[ 3.350244] with arguments:
[ 3.350251] /sbin/init
[ 3.350258] splash
[ 3.350266] with environment:
[ 3.350272] HOME=/
[ 3.350279] TERM=linux
[ 3.449756] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 3.449916] Indeed it is in host mode hprt0 = 00001101
[ 3.690055] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 3.690091] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.690771] hub 1-1:1.0: USB hub found
[ 3.690861] hub 1-1:1.0: 4 ports detected
[ 3.834060] systemd[1]: System time before build time, advancing clock.
[ 4.009833] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 4.075682] NET: Registered PF_INET6 protocol family
[ 4.077170] Segment Routing with IPv6
[ 4.077213] In-situ OAM (IOAM) with IPv6
[ 4.140107] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 4.140144] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 4.140880] hub 1-1.1:1.0: USB hub found
[ 4.140987] hub 1-1.1:1.0: 3 ports detected
[ 4.160142] systemd[1]: systemd 247.3-7+rpi1+deb11u1 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified)
[ 4.161204] systemd[1]: Detected architecture arm.
[ 4.163120] systemd[1]: Set hostname to .
[ 4.493863] dwc_otg_handle_wakeup_detected_intr lxstate = 2
[ 5.096500] systemd[1]: /lib/systemd/system/plymouth-start.service:16: Unit configured to use KillMode=none. This is unsafe, as it disables systemd’s process lifecycle management for the service. Please update your service to use a safer KillMode=, such as ‘mixed’ or ‘control-group’. Support for KillMode=none is deprecated and will eventually be removed.
[ 5.149778] usb 1-1.1.1: new high-speed USB device number 4 using dwc_otg
[ 5.280310] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
[ 5.280347] usb 1-1.1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 5.371499] systemd[1]: Queued start job for default target Graphical Interface.
[ 5.423681] systemd[1]: Created slice system-getty.slice.
[ 5.425238] systemd[1]: Created slice system-modprobe.slice.
[ 5.426390] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 5.427243] systemd[1]: Created slice User and Session Slice.
[ 5.427917] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 5.429139] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[ 5.430473] systemd[1]: Reached target Slices.
[ 5.430804] systemd[1]: Reached target Swap.
[ 5.432209] systemd[1]: Listening on Syslog Socket.
[ 5.432956] systemd[1]: Listening on fsck to fsckd communication Socket.
[ 5.433386] systemd[1]: Listening on initctl Compatibility Named Pipe.
[ 5.434565] systemd[1]: Listening on Journal Audit Socket.
[ 5.435248] systemd[1]: Listening on Journal Socket (/dev/log).
[ 5.436112] systemd[1]: Listening on Journal Socket.
[ 5.442689] systemd[1]: Listening on udev Control Socket.
[ 5.443566] systemd[1]: Listening on udev Kernel Socket.
[ 5.444828] systemd[1]: Condition check resulted in Huge Pages File System being skipped.
[ 5.449518] systemd[1]: Mounting POSIX Message Queue File System…
[ 5.454796] systemd[1]: Mounting RPC Pipe File System…
[ 5.460825] systemd[1]: Mounting Kernel Debug File System…
[ 5.466609] systemd[1]: Mounting Kernel Trace File System…
[ 5.467576] systemd[1]: Condition check resulted in Kernel Module supporting RPCSEC_GSS being skipped.
[ 5.480619] systemd[1]: Starting Restore / save the current clock…
[ 5.486973] systemd[1]: Starting Set the console keyboard layout…
[ 5.493447] systemd[1]: Starting Create list of static device nodes for the current kernel…
[ 5.500612] systemd[1]: Starting Load Kernel Module configfs…
[ 5.506960] systemd[1]: Starting Load Kernel Module drm…
[ 5.513906] systemd[1]: Starting Load Kernel Module fuse…
[ 5.528345] systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped.
[ 5.534062] systemd[1]: Starting File System Check on Root Device…
[ 5.546564] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
[ 5.551594] systemd[1]: Starting Journal Service…
[ 5.581296] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
[ 5.586265] systemd[1]: Starting Load Kernel Modules…
[ 5.618203] systemd[1]: Starting Coldplug All udev Devices…
[ 5.634535] fuse: init (API version 7.37)
[ 5.650800] systemd[1]: Mounted POSIX Message Queue File System.
[ 5.651495] systemd[1]: Mounted RPC Pipe File System.
[ 5.652114] systemd[1]: Mounted Kernel Debug File System.
[ 5.652777] systemd[1]: Mounted Kernel Trace File System.
[ 5.654578] systemd[1]: Finished Restore / save the current clock.
[ 5.657930] systemd[1]: Finished Create list of static device nodes for the current kernel.
[ 5.663095] systemd[1]: [email protected]: Succeeded.
[ 5.666433] systemd[1]: Finished Load Kernel Module configfs.
[ 5.668834] systemd[1]: [email protected]: Succeeded.
[ 5.670226] systemd[1]: Finished Load Kernel Module fuse.
[ 5.683964] i2c_dev: i2c /dev entries driver
[ 5.690069] systemd[1]: Mounting FUSE Control File System…
[ 5.695823] systemd[1]: Mounting Kernel Configuration File System…
[ 5.701253] systemd[1]: Started File System Check Daemon to report status.
[ 5.707555] systemd[1]: Finished Load Kernel Modules.
[ 5.717461] systemd[1]: Starting Apply Kernel Variables…
[ 5.733872] systemd[1]: Mounted FUSE Control File System.
[ 5.757295] systemd[1]: Mounted Kernel Configuration File System.
[ 5.822796] systemd[1]: Finished Apply Kernel Variables.
[ 5.858657] systemd[1]: [email protected]: Succeeded.
[ 5.860496] systemd[1]: Finished Load Kernel Module drm.
[ 5.950973] systemd[1]: Started Journal Service.
[ 6.259186] EXT4-fs (mmcblk0p2): re-mounted. Quota mode: none.
[ 6.401774] systemd-journald[129]: Received client request to flush runtime journal.
[ 6.418749] systemd-journald[129]: File /var/log/journal/3708536ccfd54ea0b232d5691e225714/system.journal corrupted or uncleanly shut down, renaming and replacing.
[ 8.106275] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.108644] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 8.108690] [vc_sm_connected_init]: start
[ 8.110808] mc: Linux media interface: v0.10
[ 8.162813] [vc_sm_connected_init]: installed successfully
[ 8.246182] videodev: Linux video capture interface: v2.00
[ 8.303919] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.312329] bcm2835_audio bcm2835_audio: card created with 8 channels
[ 8.358190] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.425985] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.440916] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 8.440976] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[ 8.443813] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 8.443868] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[ 8.491304] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 8.491365] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[ 8.513212] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[ 8.513428] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[ 8.519528] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[ 8.519685] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[ 8.550607] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.581051] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.587194] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 8.589155] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 8.589649] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 8.644797] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 8.644843] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 8.644867] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 8.644885] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 8.644901] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 8.668323] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[ 8.668875] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[ 8.669256] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[ 8.669544] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[ 8.669584] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 8.669607] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 8.669624] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 8.669641] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 8.669935] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[ 9.281780] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 9.427873] cfg80211: Loaded X.509 cert ‘sforshee: 00b28ddf47aef9cea7’
[ 9.480339] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid
[ 9.765608] brcmfmac: F1 signature read @0x18000000=0x15264345
[ 9.795002] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 9.796609] usbcore: registered new interface driver brcmfmac
[ 9.811184] Console: switching to colour dummy device 80x30
[ 9.842042] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[ 9.931199] Registered IR keymap rc-cec
[ 9.931511] rc rc0: vc4-hdmi as /devices/platform/soc/3f902000.hdmi/rc/rc0
[ 9.931786] input: vc4-hdmi as /devices/platform/soc/3f902000.hdmi/rc/rc0/input0
[ 9.952564] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[ 9.953364] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[ 9.953884] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 9.954382] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 9.954877] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 9.970066] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[ 10.007759] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[ 10.010869] vc4-drm soc:gpu: [drm] Cannot find any crtc or sizes
[ 10.112856] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Nov 1 2021 00:37:25 version 7.45.241 (1a2f2fa CY) FWID 01-703fd60
[ 10.980995] 8021q: 802.1Q VLAN Support v1.8
[ 11.183591] uart-pl011 3f201000.serial: no DMA platform data
[ 11.265912] Adding 102396k swap on /var/swap. Priority:-2 extents:1 across:102396k SSFS
[ 11.458962] 8021q: adding VLAN 0 to HW filter on device eth0
[ 11.463895] lan78xx 1-1.1.1:1.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 11.479952] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 12.811595] ICMPv6: process `dhcpcd’ is using deprecated sysctl (syscall) net.ipv6.neigh.eth0.retrans_time - use net.ipv6.neigh.eth0.retrans_time_ms instead
[ 20.411170] Bluetooth: Core ver 2.22
[ 20.411304] NET: Registered PF_BLUETOOTH protocol family
[ 20.411309] Bluetooth: HCI device and connection manager initialized
[ 20.411330] Bluetooth: HCI socket layer initialized
[ 20.411339] Bluetooth: L2CAP socket layer initialized
[ 20.411354] Bluetooth: SCO socket layer initialized
[ 20.437991] Bluetooth: HCI UART driver ver 2.3
[ 20.438015] Bluetooth: HCI UART protocol H4 registered
[ 20.438103] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 20.438260] Bluetooth: HCI UART protocol Broadcom registered
[ 21.059455] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 21.059484] Bluetooth: BNEP filters: protocol multicast
[ 21.059505] Bluetooth: BNEP socket layer initialized
[ 21.070382] Bluetooth: MGMT ver 1.22
[ 21.096588] NET: Registered PF_ALG protocol family
[ 21.132704] cryptd: max_cpu_qlen set to 1000
[ 21.431563] Bluetooth: RFCOMM TTY layer initialized
[ 21.431597] Bluetooth: RFCOMM socket layer initialized
[ 21.431629] Bluetooth: RFCOMM ver 1.11
[ 1936.028785] usb usb1-port1: disabled by hub (EMI?), re-enabling…
[ 1936.028831] usb 1-1: USB disconnect, device number 2
[ 1936.028847] usb 1-1.1: USB disconnect, device number 3
[ 1936.028861] usb 1-1.1.1: USB disconnect, device number 4

[ 1936.029611] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 6
[ 1936.069065] lan78xx 1-1.1.1:1.0 eth0: Link is Down
[ 1936.069117] lan78xx 1-1.1.1:1.0: Runtime PM usage count underflow!
[ 1936.071326] lan78xx 1-1.1.1:1.0 eth0: failed to kill vid 0081/0
[ 1936.338847] Indeed it is in host mode hprt0 = 00001501
[ 1936.548725] usb 1-1: new high-speed USB device number 5 using dwc_otg
[ 1936.548845] Indeed it is in host mode hprt0 = 00001101
[ 1936.788884] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 1936.788907] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1936.789340] hub 1-1:1.0: USB hub found
[ 1936.789397] hub 1-1:1.0: 4 ports detected
[ 1937.108753] usb 1-1.1: new high-speed USB device number 6 using dwc_otg
[ 1937.239568] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 1937.239593] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1937.247807] hub 1-1.1:1.0: USB hub found
[ 1937.247927] hub 1-1.1:1.0: 3 ports detected
[ 1937.600720] dwc_otg_handle_wakeup_detected_intr lxstate = 2
[ 1938.118732] usb 1-1.1.1: new high-speed USB device number 7 using dwc_otg
[ 1938.249103] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
[ 1938.249137] usb 1-1.1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1938.511867] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
[ 1938.523821] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
[ 1938.663184] 8021q: adding VLAN 0 to HW filter on device eth0
[ 1938.666735] lan78xx 1-1.1.1:1.0 eth0: Link is Down
[ 1941.737213] lan78xx 1-1.1.1:1.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 1941.737282] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 2039.520240] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/status

  1. Troubleshooting attempts you’ve made.
    Enabled SPI in raspi-config
    Tried using 3.3V and 5V
    I noticed in main.c the CS pin is set to 22 so I tried to both plug the CS from the camera into pin 22, as well as change main.c CS pin to 15 to match the original pinout instructions, no change either way.
    Tried multiple Mega cameras
    confirmed mega cameras work on ESP32
    update & upgrade
    tried different versions of the mega SDK (2.02 and 2.04)
    tried bullseye and buster

  2. What help do you need?
    Anything I’m missing to get this to work on the raspberry pi?

when i run the program with strace, this is what I get:

evanp@raspberrypi:~/Arducam_Mega/examples/RaspberryPi/capture $ sudo strace ./Arducam_Mega
execve(“./Arducam_Mega”, [“./Arducam_Mega”], 0x7ebef790 /* 17 vars */) = 0
brk(NULL) = 0x488000
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f3b000
access(“/etc/ld.so.preload”, R_OK) = 0
openat(AT_FDCWD, “/etc/ld.so.preload”, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=54, …}) = 0
mmap2(NULL, 54, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x76f3a000
close(3) = 0
readlink(“/proc/self/exe”, “/home/evanp/Arducam_Mega/example”…, 4096) = 66
openat(AT_FDCWD, “/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so”, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, “\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\254\3\0\0004\0\0\0”…, 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=17708, …}) = 0
mmap2(NULL, 81964, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76ef6000
mprotect(0x76efa000, 61440, PROT_NONE) = 0
mmap2(0x76f09000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x76f09000
close(3) = 0
munmap(0x76f3a000, 54) = 0
openat(AT_FDCWD, “/etc/ld.so.cache”, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=75516, …}) = 0
mmap2(NULL, 75516, PROT_READ, MAP_PRIVATE, 3, 0) = 0x76ee3000
close(3) = 0
openat(AT_FDCWD, “/lib/arm-linux-gnueabihf/libc.so.6”, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, “\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\0y\1\0004\0\0\0”…, 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1319784, …}) = 0
mmap2(NULL, 1389116, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76d8f000
mprotect(0x76ecd000, 65536, PROT_NONE) = 0
mmap2(0x76edd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13e000) = 0x76edd000
mmap2(0x76ee0000, 8764, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76ee0000
close(3) = 0
set_tls(0x76f3c2c0) = 0
mprotect(0x76edd000, 8192, PROT_READ) = 0
mprotect(0x76f09000, 4096, PROT_READ) = 0
mprotect(0x23000, 4096, PROT_READ) = 0
mprotect(0x76f3d000, 4096, PROT_READ) = 0
munmap(0x76ee3000, 75516) = 0
openat(AT_FDCWD, “/dev/mem”, O_RDWR|O_SYNC) = 3
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0xfe200000) = 0x76f3a000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0xfe204000) = 0x76f39000
close(3) = 0

confirmed all cameras are working on an ESP32 and confirmed SPI works by testing a TFT display.

@epoliquin

What is the status of this example when you use perview?

@Edward

The folder I clone from github has no makefile in the folder, when I try to compile I get:

make: *** No targets specified and no makefile found. Stop.

when I add the makefile and src files (as well as a little fiddling) from this commit I get this error:

evan@raspberrypi:~/Arducam_Mega/examples/RaspberryPi/preview $ make
g++ -c -o obj/main.o src/main.cpp -Wall -pthread pkg-config --cflags --libs opencv
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘opencv’ found
src/main.cpp:12:10: fatal error: opencv2/opencv.hpp: No such file or directory
12 | #include <opencv2/opencv.hpp>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:19: obj/main.o] Error 1

confirmed that I have opencv installed in “/usr/include/opencv4/opencv2/opencv.hpp”

@epoliquin

Sorry, it seems that the documentation has not been updated, I will let the relevant people update the documentation.
You can use cmake to compile this project.

cd Arducam_Mega/examples/RaspberryPi/preview
mkdir build && cd build 
cmake .. && make

@Edward
No worries, thank you so much! When I use make to compile the project and run it with “sudo ./preview” a similar thing happens to capture. It hangs up after the command is entered into the terminal.

@epoliquin

Could

I see your hardware connection diagram?

The pins you should connect

@Edward
For sure! That’s the GPIO pin that Im using. Although, I’ve tried a few others just to troublueshoot. Here’s the current setup though. Also tried using 5v as well with no luck

@epoliquin

Could you take a picture of your actual wiring diagram and show it to me?

@Edward

@epoliquin

Maybe you can try to reduce the baud rate of spi, in the file arducam_mega_sdk/examples/RaspberryPi/preview/Arducam/bsp_spi.c — static unsigned int speed = 12000000; +++static unsigned int speed = 8000000, 12m Baud rate is on the verge of criticality

@Edward

no luck with changing the baud rate. still getting the same problem, the program hangs up after entering the command in terminal. I’m just changing this number at the top from 4 million to 8 million and 12 million and seeing if either one works right? Or do I need to include both lines you wrote?


added a bunch of prints, but yeah, it’s just not connecting to the camera. Same result if I unplug everything from the GPIO. so far i’ve tried 2 different 5mp m12 megas, a regular 3mp mega, and a 5mp autofocus mega and none want to work. :frowning:
mega

I jumped the MISO and MOSI pins and ran the code just to see what would happen, and it hangs up in the same spot. Is there a specific bullseye image you’re using? Maybe I can try that as well.

serial port seems to be working, wrote a quick loopback test in python and i got this:

import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
#Set SPI parameters
spi.mode = 0
spi.bits_per_word = 8
spi.max_speed_hz = 250000
spi.lsbfirst = False
#Send and receive data
response = spi.xfer2([135])
print(response)
spi.close()

checked continuity of the cables as well, mega is receiving power. 3.3v is a little under, 3.27, but 5v is 5.07.

@epoliquin

I did some testing and found that there are a few things that need to be modified to use on the pi3.
examples/RaspberryPi/preview/Arducam/bsp_spi.h

Sorry I overlooked this before.

1 Like

@Edward that did it! Thank you so much for helping me out with this :slight_smile:

@Edward another question, but noticed a lot of pins on the PCB of the mega. would any of those happen to be a hardware sync/trigger?

@Edward Sorry to bother, just wanted to follow up on this real quick. Can any of these pins inside the MEGA be used to synchronize cameras?

Thanks so much! :slight_smile:

Hi,
Sorry, for now, meage camera moduls do not have a hardware trigger/sync.