ARDUCAM with Crazyflie
Posted: Fri Jan 13, 2017 9:06 am
Hello everybody.
I'm working on integrating the Arducam with Crazyflie 2.0.
After connecting and porting the code from Arduino to STM32 SPI API, I've noticed a really strange behavior when I try to read the TEST register: I read something different from what I wrote.
Comes without saying that, on Arduino, everything is working flawlessly, while on the STM32 the camera is replying with a wrong signal ( ).
The high-level code used for Arduino is:
`delay(5000);
myCAM.write_reg(ARDUCHIP_TEST1, 0x40);
temp = myCAM.read_reg(ARDUCHIP_TEST1);
Serial.print("Test: ");Serial.println(temp, HEX);`
The high-level code used for STM32 is:
`vTaskDelay(M2T(5000));
write_reg(ARDUCHIP_TEST1, 0x40);
temp = read_reg(ARDUCHIP_TEST1);
DEBUG_PRINT("Read SPI temp: %d %x\n", temp,temp);
temp = read_reg(ARDUCHIP_REV);
DEBUG_PRINT("REV: %d %x\n", temp,temp);`
The rest is just exactly the same as in the original firmware available at ArduCAM github: https://github.com/ArduCAM
I've tried all the following:
1) Change the ArduCAM
2) Use the same ArduCAM
3) Checked several time the hardware connections
4) Since the drone is powering the ArduCAM with 3.3V, I've tried to power up the camera with external 5V
5) Tried different combination of SPI settings (CPOL, CPHA, MSB, LSB etc)
6) Other small things.
Please let me know if you have any idea.
Best regards,
Jassy
PS: In the pictures, the top oscilloscope screenshot is for from the Arduino while the bottom one is from the Crazyflie.
I'm working on integrating the Arducam with Crazyflie 2.0.
After connecting and porting the code from Arduino to STM32 SPI API, I've noticed a really strange behavior when I try to read the TEST register: I read something different from what I wrote.
Comes without saying that, on Arduino, everything is working flawlessly, while on the STM32 the camera is replying with a wrong signal ( ).
The high-level code used for Arduino is:
`delay(5000);
myCAM.write_reg(ARDUCHIP_TEST1, 0x40);
temp = myCAM.read_reg(ARDUCHIP_TEST1);
Serial.print("Test: ");Serial.println(temp, HEX);`
The high-level code used for STM32 is:
`vTaskDelay(M2T(5000));
write_reg(ARDUCHIP_TEST1, 0x40);
temp = read_reg(ARDUCHIP_TEST1);
DEBUG_PRINT("Read SPI temp: %d %x\n", temp,temp);
temp = read_reg(ARDUCHIP_REV);
DEBUG_PRINT("REV: %d %x\n", temp,temp);`
The rest is just exactly the same as in the original firmware available at ArduCAM github: https://github.com/ArduCAM
I've tried all the following:
1) Change the ArduCAM
2) Use the same ArduCAM
3) Checked several time the hardware connections
4) Since the drone is powering the ArduCAM with 3.3V, I've tried to power up the camera with external 5V
5) Tried different combination of SPI settings (CPOL, CPHA, MSB, LSB etc)
6) Other small things.
Please let me know if you have any idea.
Best regards,
Jassy
PS: In the pictures, the top oscilloscope screenshot is for from the Arduino while the bottom one is from the Crazyflie.