Device Tree modification has no effect v4l2-camera

Hi, this is my first post. I’ve checked several forum threads on similar topics, but most of them were already closed or had links to the official camera development documentation. I also read through that site, and I found it to be a great resource. I tried following its instructions, but I’ve hit a roadblock. My goal is to develop a driver for the ov5647 camera. I’ve gone through the device tree and driver files related to imx219 and even looked into ov5693 examples available online. Following the Camera Development Guide, I started with modifying the device tree. After compiling the modified dts file into a dtb file and placing it in the /boot/dtb folder, it appears to have had no effect on the system. Upon rebooting the device with both an ov5647 and imx219 camera connected, the imx219 works perfectly, but there’s no sign of the ov5647. I’ve checked the kern.log and used i2cdetect, but I couldn’t find any trace of the ov5647. I’ve implemented the driver node and expanded the tegra-camera-platform part based on the examples and camera datasheets. Can you give me a clue where should i start search for the problem?

Hi @bence.lukacs,
If you dont see any driver probe failing or similar, could be that the incorrect dtb or kernel image is loading, not the one with your changes. You can verify it by checking this link, its for nano but the idea is the same. The other thing to try is since you dont see the sensor listed on i2c, it can be a power issue, so for example an enable pin is not up or similar. And lastly list all the i2c busses to verify its not under a different i2c address, thats something that I’ve seen before.

Regards,
Andres
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

1 Like

Hello Andres, thank you for your response. I reread the Development Guide and I realized I only finished half of the job, because I did not implemented a minimal driver for the camera (I thought the device tree modification is enough to start testing the I2C and camera presence). Now I started work on the camera driver. But can you clarify me something? At the end of the guide I am a bit confused about .dtsi files. Before the LKM part I thought I only need to compile the modified dts file into dtb file and the camer_name.c driver file into drive_name.ko load it with insmod, but I got confused when the Guide started LKM part and the .dtsi and overlay files.

There are two ways you can do it(to my knowledge), compile it as a module or do it built in, to me its easier to make it built it, since you have access to the full dtb and the kernel sources. For example there is a imx219 driver on the sources by default. Check over here for a guide on how to download and compile the sources. Before full compile, you need to verify that the imx219 and the other drivers that you need are enabled so, run

make mrproper

After you added the drivers to the kernel sources, so it adds them to the config and you can go an modify it so they are compiled and loaded, by default. In this method you can then add imports to the main device tree with your custom dtbs.

Also if you want to check more about overlays check over here. AFAIK, to properly load a kernel module, you need to replace the currenlty running dtb with the modified one, and then load the .ko. The overlays is another way to do it, you can check the link and see that its more like applying small pathes and/or adding small sections to the currenlty loaded dtb.

Regards,
Andres

I followed the guide, and tried multiple times the flashing also with an SD card and a soldered eMMC version of the Jetson Nano with the corresponding parts of the guide. Every time I got the same output after the successful flashing I can not boot the board until I reflash it with the default OS with the SDK manager. I tried to use “mrproper” but it returned with a lot of questions/parameter selection. it is hard to debug the problem because the board not booting but I could see some booting line with [FAILED] status. The only modification on the source files is the addition of the ov5647.c and ov5647_mode_tbls.h file adding the sensor to the config file with “=m” and modified the Makefile to build the camera files too, then recompiled the kernel it was successful and flash the board also no error. I would be grateful for any help because now I am stuck. [UPDATE]:Since the last try with the flashing I am not able to recover my boards even with the NVIDIA SDK manager reflashing. They are not able to boot after a few of seconds they both stuck with booting. I do not understand the situation I thought the SDK manager Flash reset the device. The last message I could see before the monitor goes blank: device-mapper:tabel: 253:0: thin-pool: unknown target type, ioctl: error adding target to table. I found topics about this problem, but I was not able to recover the boards.

After multiple reflashing with the SDK manager from multiple machines I could restore the default state of the boards, but now I afraid to run again the kernel recompiling. I followed the guide and at the and I got messages about the successful process even the flashing. But now I am afraid try again with the same files, without knowing what went wrong. In the development and experimenting phase how can I test my skeleton driver without Kernel compiling?

You can try to boot connected to the serial port, and then catch any errors that it might show. Take a look over here. If the kernel is failing to boot, you might see the reason on the logs

Hello I am so glad for your help. After I restored the boards I started working with them parallel. I copied the ov5647.c file with the headers to one of the boards and compiled them on the board load with “insmod”, modified the device tree file recompiled it and copied into the boot folder. restarted the board but the only sign of the ov5647 camera 2 lines in the kern.log:

ov5647: disagrees about version of symbol module layout

and

ov5647: loading out-of-tree module taints kernel

I tried to reverse engineer the meaning of it but now success yet. I also used the other board with the bad kernel and the serial logged boot. It looks like the problematic part is the following:

[ 7.520867] device-mapper: table: 253:0: thin-pool: unknown target type
[ 7.530626] device-mapper: ioctl: error adding target to table

Ubuntu 18.04.6 LTS localhost ttyS0

localhost login: [ 9.940644] device-mapper: table: 253:0: thin-pool: unknowne
[ 9.948249] device-mapper: ioctl: error adding target to table
[ 12.281272] device-mapper: table: 253:0: thin-pool: unknown target type
[ 12.287948] device-mapper: ioctl: error adding target to table .

I am still try find out the meaning of this error. Is it possible that I need to use a different Tegra version?
I am already started to search for platform threads about similar topics, but to be honest I am feeling dumb right now. I thought I just add some files with proper parameters and rebuild, flash and ready.

Hi @bence.lukacs,

Personally I have not seem those errors, but sounds like a bad config somewhere. Here is this thread that you can look at, maybe it has something that you can check.

Regards,
Andres

The other thing is if it’s possible for you to send the diff on the kernel sources to check what you did?

If the diff means the files I added to the kernel I zipped the modified device tree and driver files.
self_driver.zip (46.6 KB)
I continued the experiments with the onboard driver file building, I load the .ko file with the insmod command I can see it in the dmesg list

OV5647:loading out-of-tree module taints kernel

I checked the links about the kernel, but I think I am missing something basic and essential in the process of kernel building. Still investigating.

Will check the sources, but mostly I wanted to take a look at the make config.

Oh sorry for the misunderstanding, I did not want to brother you with the browsing of the source files. This is the content of the Makefile in the build folder:

VERSION = 4
PATCHLEVEL = 9

lastword = $(word $(words $(1)),$(1))
makedir := $(dir $(call lastword,$(MAKEFILE_LIST)))

ifeq (“$(origin V)”, “command line”)
VERBOSE := $(V)
endif
ifneq ($(VERBOSE),1)
Q := @
endif

MAKEARGS := -C /home/mbence/Linux_for_Tegra/source/public/kernel/kernel-4.9
MAKEARGS += O=$(if $(patsubst /%,$(makedir)),$(CURDIR)/)$(patsubst %/,%,$(makedir))

MAKEFLAGS += --no-print-directory

.PHONY: __sub-make $(MAKECMDGOALS)

__sub-make:
$(Q)$(MAKE) $(MAKEARGS) $(MAKECMDGOALS)

$(filter-out __sub-make, $(MAKECMDGOALS)): __sub-make
@:

I am so grateful for your help and sorry If I misunderstand the actual question but this is a new field for me. I am attached config file:
config.txt (168.1 KB)

The first thing I see is that on the config the sources are not enabled, there is no OV5647 field on the config.txt. My recomendation is to do it built-in, to do so first compile the kernel sources, like on here, until the Flash Jetson NANO step we dont need that step or the next ones. We want just the kernel compile. Then add the sources that you first sent me, the .c and .h on this location kernel/nvidia/drivers/media/i2c/. Im going to use the included ov5693 sources as example, just replace with your new device. And you can also use then as example. (kernel/nvidia/drivers/media/i2c/ov5693.c)
On that same level there should be a makefile, modify it to add your new driver:

obj-$(CONFIG_VIDEO_OV5693) += ov5693.o

To force it, do:

obj-y += ov5693.o

Add the config to the same level kconfig file

config VIDEO_OV5693
	tristate "OV5693 camera sensor support"
	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
	---help---
	  This is a Video4Linux2 sensor-level driver for the OmniVision
	  OV5693 camera.

	  To compile this driver as a module, choose M here: the module
	  will be called ov5693.

Then add it to the main config /kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig

CONFIG_VIDEO_OV5693=y

Finally add the device to the device tree.
Then run the full step 3. Compile kernel and dtb process, from the guide again. Then you should see on cmd at some point the ov sources that you added being compiled.
The second thing is that if I’m not mistaken that is the main makefile, what I meant is the makefile where you added the ov sources. But nvm since we are going to try built-in its ok.

1 Like

I followed these steps, checking the compiling messages I found some error in the .c driver file after that I could run successfully the compiling steps. Double checked the config files and now they are already enable the ov5647:

NVIDIA overlay Encoders, decoders, sensors and other helper chips

CONFIG_VIDEO_IMX185=m
CONFIG_VIDEO_IMX219=y
CONFIG_VIDEO_IMX268=y
CONFIG_VIDEO_IMX274=m
CONFIG_VIDEO_IMX318=y
CONFIG_VIDEO_LC898212=y
CONFIG_VIDEO_OV5693=m
CONFIG_VIDEO_OV5647=m
CONFIG_VIDEO_OV9281=y
CONFIG_VIDEO_OV10823=y
CONFIG_VIDEO_OV23850=y
CONFIG_I2C_IOEXPANDER_PCA9570=y
CONFIG_VIDEO_TC358840=y
CONFIG_I2C_IOEXPANDER_SER_MAX9295=y
CONFIG_I2C_IOEXPANDER_DESER_MAX9296=y
CONFIG_VIDEO_IMX390=y

But still stuck in the boot process I used the serial boot log to check and had a very similar output:

[ 6.842550] device-mapper: table: 253:0: thin-pool: unknown target type
[ 6.903995] device-mapper: ioctl: error adding target to table

Ubuntu 18.04.6 LTS lbence-desktop ttyS0

lbence-desktop login: [ 11.395183] device-mapper: table: 253:0: thin-pool: une
[ 11.403003] device-mapper: ioctl: error adding target to table
[ 13.751136] device-mapper: table: 253:0: thin-pool: unknown target type
[ 13.764635] device-mapper: ioctl: error adding target to table

It does not matter if I try it with or without connected camera sensor.
I repeated the whole guide without the modifications (download the sources, compile them, flash the jetson) and I got the same output (stucked boot) the serial log shows the same messages. I missing something essential during the flash or the compiling.

Ok cool, so at least on the first part we now know that the driver is getting picked up. Regarding the boot issue. You can try flashing it with default jetpack. If you are using the sdkmanager downloaded sources, you can change the folder name so it does the setup again. I mean the folder at ~/nvidia/nvidia_sdk/TARGET_JP Lastly, do you see any logs during the flashing process?

I am over multiple reflashing tried different configuration:

  • Based on the RidgeRun guide flash from terminal Output: Flash complete stuck the same booting step with the following log message:

    [ 11.403003] device-mapper: ioctl: error adding target to table
    [ 13.751136] device-mapper: table: 253:0: thin-pool: unknown target type
    [ 13.764635] device-mapper: ioctl: error adding target to table
    I attached the complete flash log from the terminal.
    flash_log.txt (18.3 KB)

  • After compiling the Kernel, opened the SDKManager and changed the Jetson OS folder directory to point to the modified and built kernel Output Flash complete boot without error but has no sign of the modifications. The default camera works but no sign of the ov5647 related files. The SDKManager terminal was not to cooperative when I tried to copy the messages I have only partial of it:
    sdkmanager_flash.txt (14.2 KB)

  • Also tried a fresh Flash from SDKManager with default kernel OS, changed the Image file in the /boot folder to my compilied one and also changed the .dtb file. Output: Device not booting, not even a single serial port message.

I reflashed the board multiple times but still no progress.

I tried to follow the the official kernel customization guide but I got an error about missing the

l4t-gcc/aarch64–glibc–stable-2022.08-1/bin/aarch64-linux-gnu-gcc does not exist

I am not understand because I downloaded the sources from the link from the guide. I do not understand where can I find this file if I downloaded the toolchain sources from the official NVIDIA site.

Hey,
Sorry for the late response. But sounds like a compile issue. Since with or without the driver you get no boot.
To get the toolchain for the specific Jetpack version you can download it from this link https://developer.nvidia.com/embedded/dlc/l4t-gcc-7-3-1-toolchain-64-bit. Its over here https://developer.nvidia.com/embedded/linux-tegra-r3271. on the table at the tools row.
Decompress it and modify the compile process so that it points to that location when needed.

Hello,
Thank you for your response. I repeated the complete guide with and without the usage of the SDK Manager. I will list the configurations to make sure that I am understand everything correctly:
I have a Jetson Nano with the soldered eMMc memory (I also have the SD card version but it gave me the same results now I only working with the emmc version).

  1. RidgeRun guide: used the command from the guide to download and build the kernel. In this configuration I did not changed any file. After running the make commands without any error, I have the dtb and Image files. I run the flash command and it run without error. I used the following flash command:

sudo ./flash.sh jetson-nano-emmc mmcblk0p1

I have the log from it:
ridgerun_flash.txt (18.0 KB)
OUTPUT:
Failing during boot, attached pictures about the display:


I also checked the board via TTL reader with the following output:

Starting kernel …

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.253-tegra (lbence@ubuntu) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef4
[ 0.000000] Boot CPU: AArch64 Processor [411fd071]
[ 0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[ 0.000000] OF: fdt: - 80000000 , 7ee00000
[ 0.000000] OF: fdt: - 100000000 , 7f200000
[ 0.000000] earlycon: uart8250 at MMIO32 0x0000000070006000 (options ‘’)
[ 0.000000] bootconsole [uart8250] enabled
[ 1.070199] tegradc tegradc.1: dpd enable lookup fail:-19
[ 1.575952] Host read timeout at address 545c00c4
[ 1.805523] imx219 7-0010: imx219_board_setup: error during i2c read probe (-121)
[ 1.813185] imx219 7-0010: board setup failed
[ 1.841632] imx219 8-0010: imx219_board_setup: error during i2c read probe (-121)
[ 1.849575] imx219 8-0010: board setup failed
[ 2.695215] cgroup: cgroup2: unknown option “nsdelegate”
[ 3.717207] using random self ethernet address
[ 3.721830] using random host ethernet address
[ 4.212006] random: crng init done
[ 4.215412] random: 7 urandom warning(s) missed due to ratelimiting
[ 4.431091] using random self ethernet address
[ 4.437143] using random host ethernet address
[ 5.616434] device-mapper: table: 253:0: thin-pool: unknown target type
[ 5.627440] device-mapper: ioctl: error adding target to table
[ 9.490196] device-mapper: table: 253:0: thin-pool: unknown target type
[ 9.496906] device-mapper: ioctl: error adding target to table
[ 11.788387] device-mapper: table: 253:0: thin-pool: unknown target type
[ 11.795116] device-mapper: ioctl: error adding target to table

Ubuntu 18.04.6 LTS lbence-desktop ttyS0

lbence-desktop login:

  1. In this configuration I used the SDK Manager I updated the default dtb file and Image with the compiled ones.
    I could only copy parts of the logs from the terminal (only if I filtered by type):

04:03:55 SUMMARY: CUDA on Host - host: Install completed successfully.
04:03:55 SUMMARY: CUDA Cross Compile Package on Host - host: Install completed successfully.
04:03:55 SUMMARY: VisionWorks on Host - host: Install completed successfully.
04:03:55 SUMMARY: VPI on Host - host: Install completed successfully.
04:03:55 SUMMARY: Nsight Graphics - host: Install completed successfully.
04:03:55 SUMMARY: Nsight Systems - host: Install completed successfully.
04:03:55 SUMMARY: Drivers for Jetson - target_image: Install completed successfully.
04:03:55 SUMMARY: File System and OS - target_image: Install completed successfully.
04:18:21 SUMMARY: Flash Jetson Nano - flash: Install completed successfully.
I was curious so I filtered for errors and I also fond this in the same terminal logs:
04:04:14 ERROR: Flash Jetson Nano - flash: Board ID(3448) version(401)
04:04:15 ERROR: Flash Jetson Nano - flash: /home/lbence/nvidia/nvidia_sdk/JetPack_4.6.4_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/flash.sh: line 2661: [: : integer expression expected
04:06:12 ERROR: Flash Jetson Nano - flash: 1+0 records in
04:06:12 ERROR: Flash Jetson Nano - flash: 1+0 records out
04:06:12 ERROR: Flash Jetson Nano - flash: 1 byte copied, 4.2197e-05 s, 23.7 kB/s
04:06:12 ERROR: Flash Jetson Nano - flash: 1+0 records in
04:06:12 ERROR: Flash Jetson Nano - flash: 1+0 records out
04:06:12 ERROR: Flash Jetson Nano - flash: 1 byte copied, 0.000134272 s, 7.4 kB/s
04:06:12 ERROR: Flash Jetson Nano - flash: 4+0 records in
04:06:12 ERROR: Flash Jetson Nano - flash: 4+0 records out
04:06:12 ERROR: Flash Jetson Nano - flash: 4 bytes copied, 0.00253652 s, 1.6 kB/s

I am not sure how can be successful the Flashing if it had errors.
OUTPUT:
Same as the manual flashing.

  1. I also tried one more time the kernel customization guide from nvidia, but I stucked at the same step like past week:

Path /home/lbence/Downloads/l4t-gcc/aarch64–glibc–stable-2022.08-1/bin/aarch64-linux-gnu-gcc does not exist.

I started to feel very dumb, I have multiple guides and and not able able to get results. I am not even able to flash the device. There are multiple great forum threads but did not find the solution yet.