I'm working in a project where I need to adquire 53 bytes of samples which come from a digital IC periodically and then I need to save them in packets of 1431 bytes which is 27 packets of 53 bytes. Then, I need to send the 1431 bytes through the UART and I can't be sending one by one because I need to keep getting the next 53 bytes before I can send the 1431 so I want to use the DMA to transfer the 1431bytes through the UART without CPU intervention.
I haven't been able to do this becasuse the DMA is not working at all and I don't know why.
I've added the DMA component to my schematic. I use a array to store the 1431 bytes and once the array is full I call CyDmaChSetRequest(UART_DMA_CH, CPU_REQ); to start the DMA transfer.
I've tried to download the example here: http://www.psocdeveloper.com/forums/viewtopic.php?t=9435&p=40637 but de file is damaged onece downloaded.
The code I'm using to configurate the DMA is the following:
#define UART_DMA_BYTES_PER_BURST 4 // Size of the UART Buffer
#define UART_DMA_REQUEST_PER_BURST 0 //Automatically send rest of bursts
#define UART_DMA_TRANSFER_SIZE 1431 // Size of Samples frame
#define DMA_BURST_COUNT UART_DMA_TRANSFER_SIZE/UART_DMA_BYTES_PER_BURST // 1430/4 = 14
void UART_HANDLER_InitDMA(uint8 DMA_TX_Buffer)
UART_DMA_CH = DMA_DmaInitialize( (uint8)DMA_BURST_COUNT, UART_DMA_REQUEST_PER_BURST, HI16(&DMA_TX_Buffer), HI16 (CYDEV_PERIPH_BASE) );
UART_DMA_TD = CyDmaTdAllocate();
CyDmaTdSetConfiguration( UART_DMA_TD, UART_DMA_TRANSFER_SIZE, UART_DMA_TD, TD_INC_SRC_ADR); //
/* Configure the lower 16 bit source and destination addresses
* Souce Address = Lower 16 bits of txBuffer array
* Destiantion address = Lower 16 bits of uart tx register
CyDmaTdSetAddress( UART_DMA_TD, LO16((uint32)&DMA_TX_Buffer), LO16((uint32)UART_TXDATA_PTR));
/* Map TD to the DMA Channel */
CyDmaChSetInitialTd( UART_DMA_CH, UART_DMA_TD);
/* Enable the DMA channel */
CyDmaChEnable(UART_DMA_CH, 1 ) ;