Re: Raspberry Pi camera under NetBSD current

2021-11-16 Thread Jun Ebihara
From: Dave Tyson 
Subject: Re: Raspberry Pi camera under NetBSD current
Date: Tue, 16 Nov 2021 20:34:32 +

>> I had a little success now with the camara and raspistill.
>> http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/cam.jpg
>> The file is slightly corrupted (truncated?) but can be displayed.
> I pulled down the latest snapshot produced by  Jun Ebihara on 6th November. 
> This boots fine on a Raspberry 1B & Pi zero but not on a Pi zero 2. The 
> snapshot does not include start_x.elf and start_db.elf and associated fixup 
> files so I used the 4 sets of start/fixup versions shipped with raspian and 
> the system booted OK with start_x=1 in the config file.

Update image with start/fixups
http://mail-index.netbsd.org/port-arm/2021/11/17/msg007495.html

rpi$ ls start*
start.elfstart4cd.elf start4x.elf  start_db.elf
start4.elf   start4db.elf start_cd.elf start_x.elf
rpi$ ls fix*
fixup.datfixup4cd.dat fixup4x.dat  fixup_db.dat
fixup4.dat   fixup4db.dat fixup_cd.dat fixup_x.dat
rpi$ ls dtb
bcm2708-rpi-b-plus.dtbbcm2710-rpi-cm3.dtb   bcm2835-rpi-b.dtb
bcm2708-rpi-b-rev1.dtbbcm2710-rpi-zero-2-w.dtb  bcm2835-rpi-cm1-io1.dtb
bcm2708-rpi-b.dtb bcm2710-rpi-zero-2.dtbbcm2835-rpi-zero-w.dtb
bcm2708-rpi-cm.dtbbcm2711-rpi-4-b.dtb   bcm2835-rpi-zero.dtb
bcm2708-rpi-zero-w.dtbbcm2711-rpi-400.dtb   bcm2836-rpi-2-b.dtb
bcm2708-rpi-zero.dtb  bcm2711-rpi-cm4.dtb   bcm2837-rpi-3-a-plus.dtb
bcm2709-rpi-2-b.dtb   bcm2835-rpi-a-plus.dtbbcm2837-rpi-3-b-plus.dtb
bcm2710-rpi-2-b.dtb   bcm2835-rpi-a.dtb bcm2837-rpi-3-b.dtb
bcm2710-rpi-3-b-plus.dtb  bcm2835-rpi-b-plus.dtbbcm2837-rpi-cm3-io3.dtb
bcm2710-rpi-3-b.dtb   bcm2835-rpi-b-rev2.dtb

Thanx!
--
Jun Ebihara


Re: Raspberry Pi camera under NetBSD current

2021-11-16 Thread Dave Tyson
On Monday 01 Nov 2021 09:42:57 Michael van Elst wrote:
> dty...@anduin.org.uk (Dave Tyson) writes:
> >> Trying to access the camera with raspistill however ends in a crash
> >> in the vchiq driver.
> >
> >Thanks for the data point. I guess there may be significant differences in
> >the microcode files between the RPI1B and RPI3b+, but at least the kernel
> >loaded OK for you so the sdcard driver works. I have turned on debugging
> >for the broadcom sdcard hooks and got a few hints as to where the problem
> >lies - but need to look closely at the source to pin point the failure. Of
> >course, even if I can get further I may still suffer the same crash with
> >raspistill. FreeBSD works OK and I can get pictures, so I know it is
> >achievable.
> I had a little success now with the camara and raspistill.
> 
> http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/cam.jpg
> 
> The file is slightly corrupted (truncated?) but can be displayed.

I pulled down the latest snapshot produced by  Jun Ebihara on 6th November. 
This boots fine on a Raspberry 1B & Pi zero but not on a Pi zero 2. The 
snapshot does not include start_x.elf and start_db.elf and associated fixup 
files so I used the 4 sets of start/fixup versions shipped with raspian and 
the system booted OK with start_x=1 in the config file.

The good news is raspistill worked fine with the --nopreview option and I 
could capture a reasonable image OK. (if you omit the --nopreview option it 
succeeds in displaying the image but crashes shortly after)

I tried to get it to take a sequence of still shots at a rate of 10/sec (using 
-tl 100) and that seemed to work OK, but after a while the kernel reports:

dwc2_host_complete: unknown error status -54 a couple of times 
and then a slew of usb devices detach including the ethernet, keyboard etc. 
and that seems to be game over :-(

Still at least its progress. I notice that there is an open source camera 
stack for Raspberry Pi using libcamera - might have a play with that under 
raspian and see if it can be ported to NetBSD.

https://www.raspberrypi.com/news/an-open-source-camera-stack-for-raspberry-pi-using-libcamera/

Dave



Re: Raspberry Pi camera under NetBSD current

2021-11-01 Thread Michael van Elst
dty...@anduin.org.uk (Dave Tyson) writes:

>> Trying to access the camera with raspistill however ends in a crash
>> in the vchiq driver.

>Thanks for the data point. I guess there may be significant differences in the 
>microcode files between the RPI1B and RPI3b+, but at least the kernel loaded 
>OK for you so the sdcard driver works. I have turned on debugging for the 
>broadcom sdcard hooks and got a few hints as to where the problem lies - but 
>need to look closely at the source to pin point the failure. Of course, even 
>if I can get further I may still suffer the same crash with raspistill. 
>FreeBSD works OK and I can get pictures, so I know it is achievable.

I had a little success now with the camara and raspistill.

http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/cam.jpg

The file is slightly corrupted (truncated?) but can be displayed.



Re: Raspberry Pi camera under NetBSD current

2021-10-28 Thread Dave Tyson
On Wednesday 27 Oct 2021 20:07:53 Dave Tyson wrote:
> On Wednesday 27 Oct 2021 18:28:31 Michael van Elst wrote:
> > dty...@anduin.org.uk (Dave Tyson) writes:
> > >I have been trying to get the raspberry pi camera to work on a model B
> > >under a recent current snapshot.
> > >
> > > NetBSD 9.99.88 (RPI) #0: Fri Sep 24 18:47:29 UTC 2021
> > > mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/evbarm/compile/RPI
> > >
> > >As standard booting off the sdcard works fine with the default
> > >config.txt,
> > >but to use the camera you need to modify this to add  start_x=1 and set
> > >the
> > >gpu mem to 128.  With the changed options you need different microcode
> > >files in the /boot partition start_x.elf and fixup_x.dat. NetBSD doesn't
> > >supply these, but I pulled versions from the git repository.
> > >
> > >The problem is that the system boots, but fails to attach the sdcard and
> > >thus cannot find root,

The attached diff of the boot messages shows some extra commands are issued to 
the bcmsdhost module in the failing case. I guess the calling sdmmc module 
doesn't like some of the data from the calls, tries to recover and fails. I'll 
try and understand the logic...

Dave NetBSD/evbarm (fdt) booting
 NetBSD/evbarm (fdt) booting 
 [ Kernel symbol table missing! 
 [ Kernel symbol table missing! 
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,  
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 
2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 
2014, 2015, 2016, 2017,
 2018, 2019, 2020, 2021 The NetBSD Foundation, Inc  All rights reserved 
 2018, 2019, 2020, 2021 The NetBSD Foundation, Inc  
All rights reserved
 Copyright (c) 1982, 1986, 1989, 1991, 1993 
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California  All rights reserved   
 The Regents of the University of California  All 
rights reserved
 NetBSD 9.99.92 (RPI) #2: Tue Oct 26 21:20:04 BST 2021  
 NetBSD 9.99.92 (RPI) #2: Tue Oct 26 21:20:04 BST 2021
root@cruncheranduinorguk:/usr/armobj/sys/arch/evbarm/compile/RPI

root@cruncheranduinorguk:/usr/armobj/sys/arch/evbarm/compile/RPI
 total memory = 384 MB  
   | total memory = 128 MB
 avail memory = 366 MB  
   | avail memory = 115 MB
 armfdt0 (root) 
 armfdt0 (root)
 simplebus0 at armfdt0: Raspberry Pi Model B Rev 2  
 simplebus0 at armfdt0: Raspberry Pi Model B Rev 2
 simplebus1 at simplebus0   
 simplebus1 at simplebus0
 simplebus2 at simplebus0   
 simplebus2 at simplebus0
 simplebus3 at simplebus0   
 simplebus3 at simplebus0
 cpus0 at simplebus0
 cpus0 at simplebus0
 cpu0 at cpus0: 700 MHz ARM1176JZ-S r0p7 (ARM11J V6ZK core) 
 cpu0 at cpus0: 700 MHz ARM1176JZ-S r0p7 (ARM11J V6ZK 
core)
 cpu0: DC enabled IC enabled WB enabled LABT
 cpu0: DC enabled IC enabled WB enabled LABT
 cpu0: L1 16KB/32B 4-way (128 set) VIPT Instruction cache   
 cpu0: L1 16KB/32B 4-way (128 set) VIPT Instruction 
cache
 cpu0: L1 16KB/32B 4-way (128 set) write-back-locking-C VIPT Data cache 
 cpu0: L1 16KB/32B 4-way (128 set) write-back-locking-C 
VIPT Data cache
 vfp0 at cpu0: VFP11, rounding, exceptions  
 vfp0 at cpu0: VFP11, rounding, exceptions
 fclock0 at simplebus2: 1920 Hz fixed clock (osc)   
 fclock0 at simplebus2: 1920 Hz fixed clock (osc)
 fclock1 at simplebus2: 48000 Hz fixed clock (otg)  
 fclock1 at simplebus2: 48000 Hz fixed clock (otg)
 simplebus4 at simplebus1   
 simplebus4 at simplebus1
 bcmicu0 at 

Re: Raspberry Pi camera under NetBSD current

2021-10-27 Thread Dave Tyson
On Wednesday 27 Oct 2021 18:28:31 Michael van Elst wrote:
> dty...@anduin.org.uk (Dave Tyson) writes:
> >I have been trying to get the raspberry pi camera to work on a model B
> >under a recent current snapshot.
> >
> > NetBSD 9.99.88 (RPI) #0: Fri Sep 24 18:47:29 UTC 2021
> > mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/evbarm/compile/RPI
> >
> >As standard booting off the sdcard works fine with the default config.txt,
> >but to use the camera you need to modify this to add  start_x=1 and set the
> >gpu mem to 128.  With the changed options you need different microcode
> >files in the /boot partition start_x.elf and fixup_x.dat. NetBSD doesn't
> >supply these, but I pulled versions from the git repository.
> >
> >The problem is that the system boots, but fails to attach the sdcard and
> >thus cannot find root,
> 
> I just tried this with an older 9.99.81 installation on a RPI3b+
> and a recent snapshot of the firmware files (around August) and
> NetBSD boots without a problem.
> 
> Trying to access the camera with raspistill however ends in a crash
> in the vchiq driver.

Thanks for the data point. I guess there may be significant differences in the 
microcode files between the RPI1B and RPI3b+, but at least the kernel loaded 
OK for you so the sdcard driver works. I have turned on debugging for the 
broadcom sdcard hooks and got a few hints as to where the problem lies - but 
need to look closely at the source to pin point the failure. Of course, even 
if I can get further I may still suffer the same crash with raspistill. 
FreeBSD works OK and I can get pictures, so I know it is achievable.

Dave 


Re: Raspberry Pi camera under NetBSD current

2021-10-27 Thread Michael van Elst
dty...@anduin.org.uk (Dave Tyson) writes:

>I have been trying to get the raspberry pi camera to work on a model B under a 
>recent current snapshot. 

> NetBSD 9.99.88 (RPI) #0: Fri Sep 24 18:47:29 UTC 2021
> mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/evbarm/compile/RPI

>As standard booting off the sdcard works fine with the default config.txt,
>but to use the camera you need to modify this to add  start_x=1 and set the 
>gpu mem to 128.  With the changed options you need different microcode files 
>in the /boot partition start_x.elf and fixup_x.dat. NetBSD doesn't supply 
>these, but I pulled versions from the git repository.

>The problem is that the system boots, but fails to attach the sdcard and thus 
>cannot find root,


I just tried this with an older 9.99.81 installation on a RPI3b+
and a recent snapshot of the firmware files (around August) and
NetBSD boots without a problem.

Trying to access the camera with raspistill however ends in a crash
in the vchiq driver.



Raspberry Pi camera under NetBSD current

2021-10-22 Thread Dave Tyson
I have been trying to get the raspberry pi camera to work on a model B under a 
recent current snapshot. 

 NetBSD 9.99.88 (RPI) #0: Fri Sep 24 18:47:29 UTC 2021
 mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/evbarm/compile/RPI

As standard booting off the sdcard works fine with the default config.txt,
but to use the camera you need to modify this to add  start_x=1 and set the 
gpu mem to 128.  With the changed options you need different microcode files 
in the /boot partition start_x.elf and fixup_x.dat. NetBSD doesn't supply 
these, but I pulled versions from the git repository.

The problem is that the system boots, but fails to attach the sdcard and thus 
cannot find root, Looking at the dmesg's from the two boots (screen shots for 
the failing one) it seems something goes wrong, but the error is poorly 
reported, A sort of diff between the dmesgs shows:

 -[ 1.00] total memory = 384 MB
 -[ 1.00] avail memory = 366 MB
+[ 1.00] total memory = 128 MB
+[ 1.00] avail memory = 115 MB

 -[ 1.00] genfb0: framebuffer at 0x5e6fa000, size 1280x1024, depth 32, 
stride 5120
+[ 1.00] genfb0: framebuffer at 0x4e6fa000, size 1280x1024, depth 32, 
stride 5120

 [ 1.180396] sdmmc0: direct I/O error 5, r=6 p=0xc8733f14 write
-[ 1.230495] sdmmc0: SD card status: 4-bit, C6
-[ 1.230495] ld0 at sdmmc0: <0x03:0x5344:SU08G:0x80:0x020d4db4:0x0c5>
-[ 1.230495] ld0: 7580 MB, 3850 cyl, 64 head, 63 sec, 512 bytes/sect x 
15523840 sectors
-[ 1.240524] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
+sdmmc0: autoconfiguration error: can't get SD status 5
+sdmmc0: autoconfiguration error: mem init failed
+sdmmc0: autoconfiguration error: init failed 

At first I thought the sdmmc0: direct I/O error 5, r=6 p=0xc8733f14 write
message was the problem, but that appears on the successful boot as well.

Irritatingly FreeBSD seems to work OK with the camera - but I really would 
prefer NetBSD.

I can compile a kernel with some debugging for the sdcard, but thought others 
may have run into this problem

Cheers,
Dave