I try to create an automatic DMA channel with SPI as the consumer. This is how I go about doing this:
CyU3PMemSet((uint8_t *)&dmaConfig, 0, sizeof(dmaConfig)); dmaConfig.size = pageLen; dmaConfig.count = 0; dmaConfig.prodAvailCount = 0; dmaConfig.dmaMode = CY_U3P_DMA_MODE_BYTE; dmaConfig.prodHeader = 0; dmaConfig.prodFooter = 0; dmaConfig.consHeader = 0; dmaConfig.notification = 0; dmaConfig.cb = NULL; /* Channel to write to SPI flash. */ dmaConfig.prodSckId = CY_U3P_UIB_SOCKET_PROD_1; dmaConfig.consSckId = CY_U3P_LPP_SOCKET_SPI_CONS; status = CyU3PDmaChannelCreate( &glSpiTxHandle, CY_U3P_DMA_TYPE_AUTO, &dmaConfig );
The execution of CyU3PDmaChannelCreate is not succesful.
If CY_U3P_UIB_SOCKET_PROD_1 is replaced with CY_U3P_CPU_SOCKET_PROD and CY_U3P_DMA_TYPE_AUTO is replaced with CY_U3P_DMA_TYPE_MANUAL_OUT then the function succeeds.
Do you understand what I am doing wrong?
Please check the error code returned by the DmaChannelCreate API and refer the API guide on what it means. Also, please check if CY_U3P_UIB_SOCKET_PROD_1 is already used by any other Dma Channel in your firmware.
- Madhu Sudhan