I use the FX3 contact to a spi chip,i use the spi with the DMA mode.

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

cross mob
waxi_1305956
Level 3
Level 3

I use the FX3 contact to a spi chip,i use the spi with the DMA mode,the external chip need that the MOSI PIN of FX3 must be high level,but when i init the spi interface of the FX3,this pin is low level in the idel state.then i use the spi with the DMA mode to transfer and receive at the same time ,and when read data from the external chip ,i transfer oxff.but when i set to transfer and receive only one word,the CyU3PDmaChannelWaitForCompletion return is eeror(CY_U3P_ERROR_NOT_STARTED) ,

   

     status = CyU3PDmaChannelSetupRecvBuffer (&glSpiRxHandle, &buf_p);

   

     CyU3PDmaChannelSetupSendBuffer (&glSpiTxHandle,&s_buf);
     CyU3PSpiSetBlockXfer (1, 1);

   

     status = CyU3PDmaChannelWaitForCompletion (&glSpiRxHandle,
             CY_FX_USB_SPI_TIMEOUT);
     if (status == CY_U3P_ERROR_NOT_STARTED)
     {
         //CyU3PGpioSetValue(34,CyFalse);
     }
     status = CyU3PDmaChannelWaitForCompletion(&glSpiTxHandle,
             CY_FX_USB_SPI_TIMEOUT);
     if (status != CY_U3P_SUCCESS)
     {
         CyU3PGpioSetValue(37,CyFalse);
     }
     CyU3PSpiDisableBlockXfer (CyTrue, CyTrue);

   

can you tell me what is the problem?

   

thanks very much.

0 Likes
1 Reply
Anonymous
Not applicable

You can refer to UsbSpiDmaMode example given in the FX3 SDK. Can you tell me what is the size of word? 16 or 32? CyU3PDmaChannelSetupRecvBuffer has a restriction of 32bytes multiple when the DCache is enabled. 

   

Attach you firmware for reference.

0 Likes