Wednesday, 28 February 2018

stm32 - SPI Transfer with STM32F4 board gets stuck on SPI_WaitTX


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

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...