cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

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
Reply
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
Reply
Anonymous
Not applicable

Thanks, I created a thread and it worked.

0 Likes
Reply