therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 240
Joined: Tue Jan 07, 2020 9:15 am

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 8:19 am

I don't think that looks quite right. I use "dtoverlay=vc4-fkms-v3d,cma-512" and get CmaTotal: 524288 kB and CmaFree: 494004 kB, which is rather more what I would expect. Could you maybe post your entire /boot/config.txt? Then I can get someone to take a look who understands more about how CMA gets allocated than I do!

Griller949698
Posts: 23
Joined: Thu Apr 01, 2021 12:37 pm

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 8:26 am

Hi, here is my Boot Config Text:

[all]

start_x=1
dtparam=i2c_vc=on
gpu_mem=256
dtoverlay=vc4-kms-v3d,cma-512
dtoverlay=imx477

#what I allready tryed or old project stuff
#cma_lwm=16
#cma_hwm=256
#disable_camera_led=1
#dtoverlay=arducam
#gpu_mem=400
#dtoverlay=vc4-fkms-v3d

Griller949698
Posts: 23
Joined: Thu Apr 01, 2021 12:37 pm

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 8:46 am

Hello,

is there a diffrens between dtoverlay=vc4-fkms-v3d ,cma-512 and dtoverlay=vc4-kms-v3d,cma-512?

when i run

libcamera-raw -o test.jpg -t 2000 --shutter 20000 --gain 1.5
libcamera-raw -o test.jpg -t 2000 --shutter 20000 --gain 1.5

it write a file in to the memory but it's way bigger than i can be 124 mb for dng and 106 mb for jpg. I can not open the file because there are damaged. I think it should be something like 3040 x 4056 Pixels 12 Bit coded in 16 Bit = 2 Bytes just one layer because of the Bayer Pattern Data
3040 * 4056 * 2 = 24,66 MiB.

Thank again for your help.

therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 240
Joined: Tue Jan 07, 2020 9:15 am

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 9:38 am

I think the CMA problem may be down to your /boot/cmdline.txt file. Any CMA value in there will override the config.txt file, so it sounds like you might be setting it to 128MB in there. Anyway, if you find anything about CMA in there please just delete it and you should get the value from config.txt like I do.

The "kms" and "fkms" display drivers are different but both should work.

Finally, libcamera-raw captures a (video) stream of raw files. These are bare unformatted and uncompressed files, regardless of the file name you supply. There is some variability in how long it actually runs, hence the differences. If you want a single raw image, use "libcamera-still -r ..." which will produce a dng file of the size you expect.

Griller949698
Posts: 23
Joined: Thu Apr 01, 2021 12:37 pm

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 2:31 pm

Cool that worked. Thank you very much.

After a few successful runs i get this error:

Code: Select all

libcamera-still -r -n -o test1.dng -t 100 --analoggain 1 --sharpness 0 --contrast 0 --brightness 0 --saturation

Code: Select all

[0:01:59.805238316] [1035]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3099-d1007485
[0:01:59.824641834] [1038]  WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for 'imx477'
[0:01:59.824717927] [1038]  WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:02:00.007269575] [1038] ERROR V4L2 v4l2_device.cpp:336 /dev/video0[17:cap]: Unable to set controls: Device or resource busy
[0:02:00.009232482] [1035]  INFO Camera camera.cpp:751 Pipeline handler in use by another process
[0:02:00.010440594] [1038] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video16[22:cap]: Unable to request 0 buffers: Device or resource busy
[0:02:00.010789742] [1038] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video15[21:cap]: Unable to request 0 buffers: Device or resource busy
[0:02:00.010914445] [1038] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video14[20:cap]: Unable to request 0 buffers: Device or resource busy
[0:02:00.011019019] [1038] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video13[19:out]: Unable to request 0 buffers: Device or resource busy
[0:02:00.011226482] [1038] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video1[18:cap]: Unable to request 0 buffers: Device or resource busy
[0:02:00.011339816] [1038] ERROR V4L2 v4l2_videodevice.cpp:1158 /dev/video0[17:cap]: Unable to request 0 buffers: Device or resource busy
ERROR: *** failed to acquire camera /base/soc/i2c0mux/i2c@1/imx477@1a ***
I2C is enabled.


I allthoug would like to know is it possibel to get real Exposurtime (in Python camera.shutter_speed) and the Chip temperature?

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

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 2:34 pm

Griller949698 wrote:
Thu Oct 14, 2021 8:09 am
Hi i tryed again. Also tryed to chang the GPU memory down to 256. I added dtoverlay=vc4-fkms-v3d,cma-512 to the Boot config file.

Code: Select all

pi@raspberrypi:~ $ dmesg | grep CMA
[    0.000000] Reserved memory: bypass linux,cma node, using cmdline CMA params instead

Code: Select all

pi@raspberrypi:~ $ free -h 
              total        used        free      shared  buff/cache   available
Mem:          7,5Gi       432Mi       6,5Gi       139Mi       637Mi       6,8Gi
Swap:          99Mi          0B        99Mi

Code: Select all

pi@raspberrypi:~ $ cat /proc/meminfo
MemTotal:        7905980 kB
MemFree:         6791276 kB
MemAvailable:    7074888 kB
Buffers:           42812 kB
Cached:           606072 kB
SwapCached:            0 kB
Active:           212032 kB
Inactive:         681908 kB
Active(anon):       1128 kB
Inactive(anon):   403200 kB
Active(file):     210904 kB
Inactive(file):   278708 kB
Unevictable:      106400 kB
Mlocked:              16 kB
HighTotal:       7274496 kB
HighFree:        6294056 kB
LowTotal:         631484 kB
LowFree:          497220 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:               156 kB
Writeback:             0 kB
AnonPages:        351496 kB
Mapped:           324332 kB
Shmem:            159256 kB
KReclaimable:      20348 kB
Slab:              43884 kB
SReclaimable:      20348 kB
SUnreclaim:        23536 kB
KernelStack:        2928 kB
PageTables:        13664 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4055384 kB
Committed_AS:    2777828 kB
VmallocTotal:     245760 kB
VmallocUsed:        5800 kB
VmallocChunk:          0 kB
Percpu:              576 kB
CmaTotal:         131072 kB
CmaFree:           90932 kB
Is that enough?
CmaTotal: 131072 kB
CmaFree: 90932 kB

because i changed Boot config file i would think here should be some more kb (512)???
Had you changed gpu_mem? You should not need to change that at all.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

Griller949698
Posts: 23
Joined: Thu Apr 01, 2021 12:37 pm

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 2:53 pm

Hi,

my GPU Memory is currently on 256. Is that ok? What size would you recommand?

Thanks

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

Re: Raw Bayer Pattern Data

Thu Oct 14, 2021 3:20 pm

Griller949698 wrote:
Thu Oct 14, 2021 2:53 pm
Hi,

my GPU Memory is currently on 256. Is that ok? What size would you recommand?

Thanks
I'd remove the setting of it completely and it will use the default. Why did you set it?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

Griller949698
Posts: 23
Joined: Thu Apr 01, 2021 12:37 pm

Re: Raw Bayer Pattern Data

Fri Oct 15, 2021 10:03 am

I removed the setting and it works. Thank you. :D I had it in there because of an old Project.

In one of the previous posts, I Ask this Question. Does anyone have an Idea?
I although would like to know is it possible to get real Exposurtime (in Python camera.shutter_speed) and the Chip temperature?

naushir
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 113
Joined: Mon Apr 25, 2016 10:21 am

Re: Raw Bayer Pattern Data

Fri Oct 15, 2021 12:59 pm

I although would like to know is it possible to get real Exposurtime (in Python camera.shutter_speed) and the Chip temperature?
The exposure time is available on every frame returned to the application. The best was to see how to get it is to look at the example in the source code here.

For the chip temperature, do you mean the sensor silicon temperature? That is not currently available. you can measure the CPU temperature with

Code: Select all

/opt/vc/bin/vcgencmd measure_temp

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

Re: Raw Bayer Pattern Data

Fri Oct 15, 2021 1:17 pm

naushir wrote:
Fri Oct 15, 2021 12:59 pm
For the chip temperature, do you mean the sensor silicon temperature? That is not currently available. you can measure the CPU temperature with

Code: Select all

/opt/vc/bin/vcgencmd measure_temp
I suspect the OP means the sensor temperature, which can be read back over I2C.
There's no standard V4L2 control for it though, so it's not a simple parameter to expose. The other approach would be to register the temperature with the Linux hwmon system, but that feels like overkill.
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.

Return to “Camera board”