What causes my IMX519 Camera to produce errors when used? - raspberry-pi

My IMX519 Camera Sensor work on a preview through libcamera-still -t 0 but get these erros when initialized with libcamera-still -t 0 --viewfinder-width 2328 --viewfinder-height 1748 --autofocus
It worked just fine on my previous interaction with the camera.
Made X/EGL preview window
[0:02:01.198729637] [1994] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3897-c3c878a9
[0:02:01.206417698] [1996] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[0:02:01.206492559] [1996] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:02:01.236208388] [1996] WARN RPI raspberrypi.cpp:1280 Mismatch between Unicam and CamHelper for embedded data usage!
[0:02:01.237247694] [1996] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[0:02:01.237511562] [1996] INFO RPI raspberrypi.cpp:1404 Registered camera /base/soc/i2c0mux/i2c#1/imx519#1a to Unicam device /dev/media3 and ISP device /dev/media4
[0:02:01.238618960] [1994] INFO Camera camera.cpp:1035 configuring streams: (0) 2328x1748-YUV420
[0:02:01.239157063] [1996] INFO RPI raspberrypi.cpp:765 Sensor: /base/soc/i2c0mux/i2c#1/imx519#1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
Segmentation fault

Related

ERROR IPAProxy ipa_proxy.cpp:149 Configuration file 'ov5640.json' not found for IPA module 'raspberrypi'?

I'm trying to interface ov5640 with raspberry Pi 4 model B, kernel version 5.15.61, till now I had loaded driver successfully and Bound driver with ov5640 successfully, and video nodes were created successfully.
I tried to stream video using gstreamer
command:
gst-launch-1.0 libcamerasrc ! video/x-raw, width=640, height=480, framerate=30/1 ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! autovideosink
and it thrown error
error:
Setting pipeline to PAUSED ...
[0:02:06.704696651] [1320] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[0:02:06.726785010] [1324] WARN CameraSensor camera_sensor.cpp:212 'ov5640 10-003c': Recommended V4L2 control 0x009a0922 not supported
[0:02:06.726879464] [1324] WARN CameraSensor camera_sensor.cpp:264 'ov5640 10-003c': The sensor kernel driver needs to be fixed
[0:02:06.726907245] [1324] WARN CameraSensor camera_sensor.cpp:266 'ov5640 10-003c': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
[0:02:06.728038265] [1324] WARN CameraSensor camera_sensor.cpp:411 'ov5640 10-003c': Failed to retrieve the camera location
[0:02:06.746434072] [1324] ERROR IPAProxy ipa_proxy.cpp:149 Configuration file 'ov5640.json' not found for IPA module 'raspberrypi'
[0:02:06.746582013] [1324] ERROR IPARPI raspberrypi.cpp:213 Could not create camera helper for ov5640
[0:02:06.746635055] [1324] ERROR RPI raspberrypi.cpp:1253 Failed to load a suitable IPA library
[0:02:06.746922788] [1324] ERROR RPI raspberrypi.cpp:1184 Failed to register camera ov5640 10-003c: -22
ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Could not find any supported camera on this system.
Additional debug info:
../src/gstreamer/gstlibcamerasrc.cpp(354): gst_libcamera_src_open (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
libcamera::CameraMananger::cameras() is empty
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
can anyone give me a direction how to solve this?

Arducam libcamera low quality in low resolution video/images

I'm trying to use the Arducam libcamera to get video from my Arducam 16 MP Autofocus camera on a Raspberry Pi 4, but I'm running into the issue that the quality is very low when retrieving 1920x1080 video (and images). In fact using any other resolution than the maximum that the camera offers, the quality is very low.
libcamera was installed by following the Arducam guide.
Using libcamera-still --list-cameras, I get the following supported modes:
0 : imx519 [4656x3496] (/base/soc/i2c0mux/i2c#1/imx519#1a)
Modes: 'SRGGB10_CSI2P' : 1280x720 [120.00 fps - (1048, 1042)/2560x1440 crop]
1920x1080 [60.05 fps - (408, 674)/3840x2160 crop]
2328x1748 [30.00 fps - (0, 0)/4656x3496 crop]
3840x2160 [18.00 fps - (408, 672)/3840x2160 crop]
4656x3496 [9.00 fps - (0, 0)/4656x3496 crop]
To demonstrate the problem, I run the following command to capture two images. One 4656x3496 and one half as big (2328x1748):
libcamera-still --immediate --shutter 50000 --gain 1.5 --width 2328 --height 1748 -e png -o org_2328x1748.png && libcamera-still --immediate --shutter 50000 --gain 1.5 --width 4656 --height 3496 -e png -o org_4656x3496.png
If I then scale the 4656x3496 image to 2328x1748 on my computer, the result is a much sharper image than the 2328x1748 image delivered by the camera. This is true regardless of which program I use to scale the image. I don't understand why that happens. I've also noticed that the file size of the 4656x3496 image (15.6 MiB) is a lot bigger than 4x the file size of the 2328x1748 image (2.7 MiB). I think the small image should have been closer to 4 MiB in size.
Arducam support says it is a matter of finding the right libcamera arguments, so I'm hoping someone can be of help.
The output from executing the libcamera-still command is the following:
pi#rpi:~ $ libcamera-still --immediate --shutter 50000 --gain 1.5 --width 2328 --height 1748 -e png -o org_2328x1748.png && libcamera-still --immediate --shutter 50000 --gain 1.5 --width 4656 --height 3496 -e png -o org_4656x3496.png
Preview window unavailable
[3:26:37.815366618] [4847] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3730-67300b62
[3:26:37.851216285] [4849] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[3:26:37.851259785] [4849] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[3:26:37.868448913] [4849] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[3:26:37.868923575] [4849] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[3:26:37.869202646] [4849] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c#1/imx519#1a to Unicam device /dev/media3 and ISP device /dev/media0
[3:26:37.870104137] [4847] INFO Camera camera.cpp:1029 configuring streams: (0) 2328x1748-BGR888 (1) 2328x1748-SRGGB10_CSI2P
[3:26:37.870498504] [4849] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c#1/imx519#1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
Still capture image received
Preview window unavailable
[3:26:39.086635744] [4855] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3730-67300b62
[3:26:39.123343254] [4858] WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[3:26:39.123386606] [4858] WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[3:26:39.140987785] [4858] WARN RPI raspberrypi.cpp:1274 Mismatch between Unicam and CamHelper for embedded data usage!
[3:26:39.141479410] [4858] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/v4l-subdev0
[3:26:39.141723259] [4858] INFO RPI raspberrypi.cpp:1398 Registered camera /base/soc/i2c0mux/i2c#1/imx519#1a to Unicam device /dev/media3 and ISP device /dev/media0
[3:26:39.142604010] [4855] INFO Camera camera.cpp:1029 configuring streams: (0) 4656x3496-BGR888 (1) 4656x3496-SRGGB10_CSI2P
[3:26:39.142994210] [4858] INFO RPI raspberrypi.cpp:763 Sensor: /base/soc/i2c0mux/i2c#1/imx519#1a - Selected sensor format: 4656x3496-SRGGB10_1X10 - Selected unicam format: 4656x3496-pRAA
Still capture image received
The images can be seen in this Google Drive folder. It contains the original images as well as the large image scaled down to 2328x1748 (scaled_4656x3496.png) with MS Paint. Notice that it is very sharp compared to org_2328x1748.png.
Adding --mode 4656:3496 results in high quality lower resolution images. For example:
libcamera-still --immediate --width 2328 --height 1748 -e png -o 2328x1748.png --mode 4656:3496
libcamera-still --immediate --width 1920 --height 1080 -e png -o 1920x1080.png --mode 4656:3496
It also works for libcamera-vid. The framerate is limited by the selected sensor mode. So 9 fps is the max if the selected mode is 4656:3496, as specified by --list-cameras:
libcamera-vid -o 1080p_3496_mode.h264 --width 1920 --height 1080 --framerate 9 --mode 4656:3496
I ended up using 3840:2160 mode which delivers sufficient quality and supports 18 fps.

Getting Unexpected DMA error in Flutter when using video_player, better_player, and chewie

Im trying to play a video. Im getting the following error:
E/gralloc_ranchu( 2305): updateHostColorBuffer: Unexpected DMA
E/ ( 2305): lockAndWriteDma: ERROR: No DMA context bound!
Im just using the sample code from https://pub.dev/packages/chewie and the video player just shows a green screen and doesnt do anything. Any ideas?
EDIT: Some more comments that may help?
I/ExoPlayerImpl(10386): Release 3310ed3 [ExoPlayerLib/2.12.1] [generic_x86_arm, AOSP on IA Emulator, Google, 28] [goog.exo.core]
D/SurfaceUtils(10386): disconnecting from surface 0xd36c1008, reason disconnectFromSurface
I/ExoPlayerImpl(10386): Release d52c17 [ExoPlayerLib/2.12.1] [generic_x86_arm, AOSP on IA Emulator, Google, 28] [goog.exo.core]
D/SurfaceUtils(10386): disconnecting from surface 0xd2c83808, reason disconnectFromSurface
I/ExoPlayerImpl(10386): Init d3251ff [ExoPlayerLib/2.12.1] [generic_x86_arm, AOSP on IA Emulator, Google, 28]
I/OMXClient(10386): IOmx service obtained
D/SurfaceUtils(10386): connecting to surface 0xd1be1008, reason connectToSurface
I/MediaCodec(10386): [OMX.google.h264.decoder] setting surface generation to 10635268
D/SurfaceUtils(10386): disconnecting from surface 0xd1be1008, reason connectToSurface(reconnect)
D/SurfaceUtils(10386): connecting to surface 0xd1be1008, reason connectToSurface(reconnect)
E/ACodec (10386): [OMX.google.h264.decoder] setPortMode on output to DynamicANWBuffer failed w/ err -1010
I/ACodec (10386): codec does not support config priority (err -1010)
I/OMXClient(10386): IOmx service obtained
I/ACodec (10386): codec does not support config priority (err -2147483648)
I/ACodec (10386): codec does not support config operating rate (err -2147483648)
D/MediaCodec(10386): [OMX.google.h264.decoder] setting dataspace on output surface to #104
I/om.example.kli(10386): Background concurrent copying GC freed 11055(2MB) AllocSpace objects, 769(50MB) LOS objects, 50% free, 5MB/10MB, paused 529us total 209.709ms
W/MapperHal(10386): buffer descriptor with invalid usage bits 0x2000
This is an open issue with no known workarounds at present. It might be helpful if you could also provide the video that you're trying to load for easier replication of the issue.

stm32 factory bootloader possibly overwritten with openocd?

tl;dr: flashed firmware to 0x00000000 instead of 0x08000000, am I lost?
Hello,
my device is based on a STM32F103CBTx which came with a proprietary firmware and had readout protection on.
I connect to it with a ST-Link v2 SWDIO and SWCLK connected to PA13 and PA14 and this command:
sudo openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg
I don't remember how I removed flash protection, but it worked as the original firmware didn't work anymore. Then I created a simple hello world firmware which pulls up and down three gpios and flashed it. The gpios are pulled up and down in 700ms intervals.
After flashing, I can't connect with openocd anymore. I forgot to specify the offset, the manual says the offset defaults to 0 and as it worked, I suppose instead of the boot loader my shitty hello world is pulling up and down some random pins happily… Is this possible? All other threads I found say the boot loader is write protected.
This is the last contact I had:
> halt
halt
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0xffffffdc
> flash write_image erase fw.hex
flash write_image erase fw.hex
auto erase enabled
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x2000003a msp: 0xffffffdc
wrote 4096 bytes from file fw.hex in 0.285697s (14.001 KiB/s)
> reset
reset
jtag status contains invalid mode value - communication failure
Polling target stm32f1x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Any directions highly appreciated.
Edit:
What I get now, also tried another st-link:
% sudo openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select '.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.244356
Error: init mode failed (unable to connect to the target)
in procedure 'init'
in procedure 'ocd_bouncer'
flashed firmware to 0x00000000 instead of 0x08000000, am I lost?
No, it doesn't matter at all, they are the same.
After reset, the MCU loads the word at address 0 in SP, and the next one at address 4 in PC. The BOOT0 and BOOT1 pins control which memory gets mapped to 0x00000000. Usually, BOOT0 is tied low, and flash memory at 0x08000000 gets mirrored at 0x00000000.
instead of the boot loader my shitty hello world is pulling up and down some random pins happily… Is this possible? All other threads I found say the boot loader is write protected.
The factory bootloader is indeed write protected, openocd can't overwrite it.
However, your application could have reconfigured the SWD pins, by writing a wrong value in GPIOA->CRH or AFIO->MAPR, thereby preventing openocd from working. It's the most common cause of this problem.
Fortunately, there is a way to recover.
Connect under Reset
If the reset pin of the controller is held low for a while when openocd is started, the application is prevented from starting, and messing up the GPIO configuration.
Openocd can do this automatically, when
It's told to do so, the line reset_config srst_only srst_nogate is present somewhere in the configuration script.
The MCU reset pin is connected to the debugger hardware, pin 15 on an official ST-Link/V2.
Or you can do it manually, by whatever means your board provides. If you are lucky, it has a reset button, if not, you must find a way to somehow ground the MCU reset pin.
Pull the reset pin low
Start openocd
Wait until the Info : Target voltage line appears. Maybe a second longer.
Release the reset pin.
It requires a bit of trial and error, you'll get better with practice.
Then you can flash your improved application, which carefully avoids reconfiguring the SWD pins.

“RAM check failed” when using j-Link to erase chip or readback

I closed SWD and JTAG by acident so that I can't download new program into developboard by j-Link.Then I try using j-flash ARM to erase chip, and error comes like this:
Connecting ...
- Connecting via USB to J-Link device 0
- J-Link firmware: V1.20 (J-Link ARM V8 compiled Dec 1 2009 11:42:48)
- JTAG speed: 2000 kHz (Auto)
- Initializing CPU core (Init sequence) ...
- Executing Reset (0, 0 ms)
- Initialized successfully
- JTAG speed: 2000 kHz (Auto)
- Connected successfully
Reading entire flash chip ...
- 64 sectors, 1 range, 0x8000000 - 0x800FFFF
- ERROR: RAM check failed # address 0x20000000.
- ERROR: Write: 0x03020100 07060504
- ERROR: Read: 0xAAAAAAAA AAAAAAAA
- ERROR: (0 bytes of RAM have been checked successfully)
- ERROR: Failed to read back target memory
Disconnecting ...
- Disconnected
I don't know how to use BOOT0 and BOOT1 to get into ISP mode. BOOT0 is connected to GND.
Post some information about your environment.
Are you using IAR EWARM? If you're not, you should download the size-limited trial version. Then, load one of the basic program examples, and try to flash it to your board.
What board are you using? And what do you mean you "closed" SWD and JTAG? I'm not sure what that refers to...jumpers? options window?
Help us out here.