FX3 SPI error CY_U3P_ERROR_MUTEX_FAILURE

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I am triggering SPI register reads via GPIO34 but get a CY_U3P_ERROR_MUTEX_FAILURE when

   

CyFxSpiTransfer() -> CyU3PSpiTransmitWords() calls CyU3PSpiGetLock().  I am using the CyFxUsbSpiRegMode example as a template but controlling the SPI SSN with GPIO34. 

   

If I manually call CyFxSpiTransfer() the spi read works fine. 

   

SpiConfig:

   

    spiConfig.isLsbFirst = CyFalse;
    spiConfig.cpol       = CyTrue;
    spiConfig.ssnPol     = CyFalse;
    spiConfig.cpha       = CyFalse;
    spiConfig.leadTime   = CY_U3P_SPI_SSN_LAG_LEAD_ONE_HALF_CLK;
    spiConfig.lagTime    = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;
    spiConfig.ssnCtrl    = CY_U3P_SPI_SSN_CTRL_HW_EACH_WORD;
    spiConfig.clock      = 20000000; // set clock to 20MHz //16-20MHz
    spiConfig.wordLen    = 32; // set word length to 32 bits

   

Who else uses glSpiLock?

0 Likes
1 Solution
Anonymous
Not applicable

Are you calling this from within a GPIO callback (or any other interrupt context) by any chance? If yes, then this error will occur.

   

You will need to move your code out to a RTOS user thread.

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Are you calling this from within a GPIO callback (or any other interrupt context) by any chance? If yes, then this error will occur.

   

You will need to move your code out to a RTOS user thread.

0 Likes
Anonymous
Not applicable

Thanks, I created a thread and it worked.

0 Likes