Hey everyone.
I was hoping someone could help.
I'm working on a university research team and we are trying to send a Nasa-funded CubeSat into space. Our CubeSat is a bit unique in the layout so the type of camera used is very specific. That is why we are attempting to interface a Pi cam with an MSP430.
We are having difficulties currently with getting an ACK from the camera to the MSP430 (we are using an oscilloscope to see) through the I2C lines. We can send a START command and the slave address but the slave does not send an ACK.
What we are currently seeing on the oscilloscope is an attachment. (It's a NACK if the SDA line is high at the end, and an ACK if it ends low at the very end)
Here is the datasheet for the sensor (OV5647) that is used in the camera:
http://cdn.sparkfun.com/datasheets/Dev/RaspberryPi/ov5647_full.pdf
Here is the datasheet for the MSP430FR6989 that is used:
http://www.ti.com/lit/ds/symlink/msp430fr6989.pdf
Here is the user guide for the MSP430FR6989 that is used:
http://www.ti.com/lit/ug/slau367j/slau367j.pdf
We believe the hardware is connected correctly, as it is connected just like this (except the resistors are 8.2k to work, I do not know why but if I go any higher it won't work).
http://www.electroschematics.com/wp-con ... 1/2F-3.png
The only hardware problem that comes to mind is the fact that we are not quite sure what to do with the CAM_GPIO pin. The CAM_CLK only does the camera's LED (strange right?), but the GPIO is perhaps a power on for the sensor? We aren't really sure. We tried both VCC and GROUND, but nothing worked.
Here is the code that we are currently using for it in Code Composer:
//Author: MakerSat
//MSP430FR6989 with Rasberry Pi Camera V1.3 (OV5647 imaging sensor)
//Goal: Get Slave ID from Rasberry Pi Camera with I2C on Oscilliscope
///////////////////////////////////////////////////////////////////
// MSP430FR6989 OV5647
// master slave
//
// P1.7/SCL <--------> SCL0
// P1.6/SDA <--------> SDA0
// 3.3V <--------> 3.3V
// GND <--------> GND
///////////////////////////////////////////////////////////////////
#include
#include "msp430fr6989.h"
#include
#include
uint16_t registerAddress;
void init_i2c(uint16_t slaveAddress);
void singleBytewrite(uint16_t slaveAddress, uint16_t registerAddress, uint8_t setBits);
/*****Initalizes I2C*****/
void init_i2c(uint16_t slaveAddress) {
UCB0CTLW0 |= UCSWRST; // Enable SW reset (it is naturally, but double check)
UCB0CTLW0 = UCSSEL_2 + UCSWRST; // Use SMCLK (undoes reset, so telling it to stay on reset)
UCB0CTLW0 |= UCMST + UCMODE_3 + UCSYNC; // multi-Master, master mode, I2C, synchronous mode, use SMCLK
UCB0BRW = 10; // fSCL = SMCLK/10 = ~100kHz
UCB0BR1 = 0; // UCB1I2COA |= 0x0630;
UCB0I2CSA = slaveAddress; // Where the Master store's the Slaves ID (0x6C for write, 0x6D for read)
UCB0CTLW0 &= ~UCSWRST; // set eUSCI_B to Clear SW reset, resume operation
UCB0IE |= UCTXIE0 | UCRXIE0 | UCNACKIE; // Enable Transmit interrupt, receive interrupt, and the NACK interrupt
}
void singleBytewrite(uint16_t slaveAddress, uint16_t registerAddress, uint8_t setBits) {
UCB0CTLW0 |= UCTR + UCTXSTT; // set eUSCI_B to transmitter mode then create START condition
UCB0TXBUF = slaveAddress; // sends slave address
while (0){};
UCB0TXBUF = registerAddress; // register address in transmission buffer
while (!(UCB0IE & UCTXIFG0));
UCB0TXBUF = setBits; // setBits in transmission buffer ***write data***
UCB0CTLW0 |= UCTXSTP; // set eUSCI_B to STOP condition
}
/*****main*****/
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; // Disables high-impedance mode for FRAM memory
uint16_t slaveAddress = 0x6C; // slave address for writing to OV5647 according to datasheet (0x6C for read,
//0x6D for write)
registerAddress = 0x3D; // the last half of register address 0x503D
uint8_t setBits = 0x01; // enable test pattern
P1SEL0 |= BIT6 + BIT7; // init P1.6 and 7, primary not I/O
P1SEL1 &= ~BIT6 + ~BIT7;
init_i2c(slaveAddress); // starts I2C function with OV5647 slave
singleBytewrite(slaveAddress, registerAddress, setBits); // starts function to write 1 byte to slave register
LPM0; // Ends program in low power mode
}
Any and all help is appreciated.