Communication I2C with the capac sensor controller

Hello,

Yesterday, I have worked on the I2C communication with the capacitive sensor controller.
I got a problem because I received a NAK when I tried to read or write a register but, thanks to Samuel, I finally solved it. In fact, the device, after receiving its address, wakes up but sends a NAK. It expects the master to retry the transaction until it accepts it.
Now, I can read and write any registers and I’m tackling with the sensor itself, by creating a capacitive button with some copper 🙂

About the wand, we had to make some changes on it, because it has been a little deformed during the last printing. It is currently being printed and we will share some pictures of it tomorrow 🙂

See you !

[HeRos] I2C where are you

Hello,

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:

MCO1_quartz_24MHz

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.

Eric