Question
CMSIS SPI Driver wait forever in SendData function
Posted on February 11, 2014 at 14:00
Hi all,
I'm trying to use the SPI interface on a STM32F207 with CMSIS. Below you my sample code can be seen. The problem there is that within the function drv_Info->SendData(...) the function waits for the semaphore_busy but it somewhere hold and never released and therfore the function waits there forever. How can I make the SendData(..) function work? Is my code correct? Every hint is very welcome Benjaminvoid th_SPI (void const *argument){
ARM_SPI_STATUS status;
ARM_DRV_VERSION version;
ARM_SPI_CAPABILITIES drv_capabilities;
uint32_t busSpeed;
uint8_t sendData[3];
uint32_t cr1;
sendData[0] = 16;
sendData[1] = 24;
sendData[2] = 144;
drv_info = &Driver_SPI1;
status = drv_info->Initialize(spiSignalCB);
status = drv_info->PowerControl(ARM_POWER_FULL);
SPI1->CR2 |= SPI_CR2_SSOE; //enable SlaveSelect
SPI1->CR1 |= SPI_CR1_MSTR; //necessary to enable Master Mode
status = drv_info->Configure(ARM_SPI_CPOL1_CPHA1,ARM_SPI_MSB_LSB); //clk polarity and phase see Reference manual and ad7794 datasheet
busSpeed = drv_info->BusSpeed(1e4);
drv_info->SlaveSelect(ARM_SPI_SS_ACTIVE);
status = drv_info->SendData(sendData,3);
if(status == ARM_SPI_ERROR){
status ++;
}
}
#spi #cmsis #stm32