This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPI stucks waiting for semaphore

Hi all,

I'm trying to use the SPI interface on a STM32F407 with CMSIS, and KEIl RTX 4.74.
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 therefore the function waits there forever.
Any solutions?

Thanks in advance
Davide

void 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 ++;
    }
}

0