PCAM 5C failed initialize with custom overlay kv260

Hi,

I have a problem. I use the kv260 Vision AI board. I use Pynq 3.0, and with ubuntu 22.04, all of is based on the latest things. I built a custom overlay based on the given base overlay that I built with the given tcl script.
But when I try to execute pcam 5c with mipi library, I get this


RuntimeError Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 mipi = ov.mipi

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py:363, in Overlay.getattr(self, key)
358 “”“Overload of getattr to return a driver for an IP or
359 hierarchy. Throws an RuntimeError if the overlay is not loaded.
360
361 “””
362 if self.is_loaded():
→ 363 return getattr(self._ip_map, key)
364 else:
365 raise RuntimeError(“Overlay not currently loaded”)

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py:898, in _IPMap.getattr(self, key)
896 if key in self._description[“hierarchies”]:
897 hierdescription = self._description[“hierarchies”][key]
→ 898 hierarchy = hierdescription"driver"
899 setattr(self, key, hierarchy)
900 return hierarchy

File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/lib/video/pcam5c.py:81, in Pcam5C.init(self, description)
72 self._handle = pcam5c_lib.pcam_mipi(
73 6,
74 int(MIPIMode.r1280x720_60.value),
(…)
78 virtaddr_demosaic,
79 )
80 if self._handle < 0:
—> 81 raise RuntimeError(“PCam 5C cannot be initialized”)

RuntimeError: PCam 5C cannot be initialized

Does anyone know to solve it? Has anyone found a similar problem before?
Thanks

Hi @ihsanalhafiz28,

To configure this camera you need to communicate with it using i2c. The i2c device is not part of the board’s device tree, so it needs to be added at run time.

If you check closely, you will see that the Makefile for the base overlay compiles a device tree overlay. This file should live next to the .bit and .hwh and have the same basename.

Mario

Hi Mario, thanks a lot for your answer.

i got it. that is why I failed to initialize my overlay. do you have any tutorial or guide for making the dtsi for custom overlay especially for accessing the mipi camera? thank you.

do you have any tutorial or guide for making the dtsi for custom overlay especially for accessing the mipi camera?

No, I do not have a tutorial. I believe you can reuse/modify the dtsi I pointed out.

Thank you very much for your help Mario.

2 Likes