I am new to the whole embedded hardware thing, and I am getting stuck when trying to connect my STM32F4 Discovery board to a Bosch BMX_055 IMU unit.
Here is a snippet of the code I am trying to run:
bool testConnection() {
SPI_ResetCS(&IMUSpi);
SPI_Transfer8(&IMUSpi, 0x0);
int chipId = SPI_Transfer8(&IMUSpi, 0x0);
printf("Chip Id: %d\n", chipId);
SPI_SetCS(&IMUSpi);
return true;
}
My code then gets hung up in here:
inline uint8_t SPI_Transfer8(Spi* spi, uint8_t value) {
*(uint8_t *)(&spi->spiPeriph->DR) = value;
SPI_WaitTX(spi->spiPeriph);
SPI_WaitRX(spi->spiPeriph);
//SPI_WaitBSY(spi->spiPeriph);
return *(uint8_t *)(&spi->spiPeriph->DR);
}
on the SPI_WaitTX function.
Any ideas on why it is stuck/how to fix it would be greatly appreciated!
No comments:
Post a Comment