1

My setup is using a Pi compute module 4 to readout an IMX219 Pi camera. In between those two is an FPGA through which all signals are routed (I2C and MIPI).

I got the I2C module in the FPGA working, i.e. i2cdetect -y 1 will detect an I2C device with an address 0x10 as expected. vcgencmd get_camera returns supported=2 detected=1. I can also readout the 0x0000 register and the answer is 0x0219 again as expected (using i2ctransfer). I wrote a script which sets the camera parameters directly and puts it into streaming mode after which I can readout valid MIPI frames in the FPGA. So far so good.

Now I wanted to use raspistill to capture actual frames on the Pi and what I have to assume is the camera gets stuck and doesn't reply anymore. raspistill will timeout with:

"Camera control callback cmd=0x4f525245mmal: No data received from sensor. Check all connections, including the Sunny one on the camera board"

which also makes sense since the sensor doesn't actually get turned on. Using a scope and LA, I checked whats happening on the I2C bus: First it probes the bus for a device at 0x10 and also reads the 0x0000 register which returns 0x0219. It then probes the bus a few times for a device with address 0x71 which I'm guessing is a different camera type or just an alternative address. This returns a nack. At this point I'm guessing raspistill figured out that it's dealing with an imx219 and will start the appropriate setup. This is where the camera gets stuck.

It sends a 0x01 to reg 0x0103, telling it to do a software reset. Immediately after, it tries to write again to 0x10 but this gets NACKd. Raspistill will retry a few more times and then timeout. After this the camera wont answer to anything, i.e. i2cdetect won't detect anything at 0x10 (but a different device at 0x64 still responds, so bus is working). I can only reset the bus by running raspi-gpio set 44 a2 && raspi-gpio set 45 a2 and I can communicate with the cam again. Writing 0x01 to 0x0103 manually (through i2ctransfer) works just fine and nothing gets stuck. After the faulty transfer all busses are high and responsive, just the camera doesn't answer. Does anyone have an idea why this would work directly but not when tunneling through the FPGA?

Both camera and Pi have been tested in a different setup without the FPGA in between and raspistill works just fine.

1 Answer 1

0

So nothing wrong with either Cam or Pi. The problem was basically the cam missing a stop condition. This was caused by a synchronisation issue in the FPGA . The FPGA clk is significantly faster than the I2C clk and skipped over the stop without the camera noticing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.