[HeRos] Faster camera configuration

This morning, I asked myself why I needed 10 seconds to configure the camera. After looking with the logic analyzer, I saw that the SCCB communication used a 250 Hz frequency.

Flo explained to me that chThdWaitMicroseconds doesn’t work in ChibiOS. Thus, the minimum wait time is 1 ms. Charles had the same problem yesterday. In order to wait a smaller time, he used GPT.

I changed the driver to wait a smaller time with GPT. Now, the time to configure the camera is reasonable.

Here the file : https://gist.github.com/Morikko/523c4e8a5bc85ceef224


[HeRos] I2C where are you


I am a little bit late for my post for Friday working since I get some trouble with my new laptop. Friday, I started with changing the output of MCO1. MCO1 is used to provide a clock for the camera. I need 24 MHz but I only had 16 MHz. At the beginning, MCO1 was setting to HSI and after I have changed it to HSE, I got my 24 MHz clock on the oscilloscope:


Next, I focused myself on the camera. The camera is a slave device using the SCCB protocol. The SCCB protocol looks like the I2C protocol except you don’t need to use pull up and the ninth bit is called “don’t care bit” instead of “acknowledge bit” for I2C. Thus, I was able to use the I2C master from the STM32F4 to speak with the camera. I saw on internet that a lot of people have succeeded it. In the case, it won’t work I will try to adapt the ChibiOS driver or at least, write a new one.

In order to watch the I2C communication, I used a logic analyzer. The included software with the logic analyzer allow to decode the mean of the packets. However, I saw nothing since my code didn’t work.

Analyseur logique pour I2C

I lost a lot of time to control the CAM_RST pin. The pin output stayed at 0 even if I called the function to put a 1. After being crazy 40 minutes, I ask for help to Samuel. Firstly, he didn’t understand too nevertheless he discovered the error. Instead of calling palSetPad, I was using palSetPort.  palSetPort made a | logic with the port.