Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hello everybody,
I'm trying to interface ARDUCAM ov5642 with MSP432, through SPI protocol. I try to send a byte to a test register but the code always be stuck in the line while (!(UCB0IFG & UCRXIFG));.
I'd like to know if somebody can help me.
CODE:
void spiWrite(uint8_t addr, uint8_t value) { ASSERT_CS(); while (!(UCB0IFG & UCTXIFG)) ; // wait for TX flag UCB0TXBUF = addr; // send register address while (UCB0STAT & UCBUSY); UCB0RXBUF; while (!(UCB0IFG & UCTXIFG)) ; // wait for TX flag UCB0TXBUF = value; // send register value to write while (!(UCB0IFG & UCRXIFG)) ; UCB0RXBUF; DEASSERT_CS(); } int spiRead(uint8_t addr, uint8_t *data, int len) { int i = 0; ASSERT_CS(); for (i = 0; i < len; i++) { while (!(UCB0IFG & UCTXIFG)) ; // wait for TX flag if (i >= 1) UCB0TXBUF = 0x00; // send dummy byte if greater than 1 else UCB0TXBUF = addr; // send address if this is the first send while (!(UCB0IFG & UCRXIFG)) ; // wait for RX flag if (i >= 1) data[i - 1] = UCB0RXBUF; // store data if the address has already been sent else UCB0RXBUF; // don't care about first byte sent from Arducam } DEASSERT_CS(); return len; }