- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all!
I'm having some bother with the DMA and understanding a few concepts. I've spent most of the weekend on this and can not get it working so turning to the trusted sages on here.
Basically I want to read in some 16bit values to , do something with them and pass them out again. So far I only have the Tx working with some sine wave test data but it would make my week if I could just pass Rx to Tx! I have the I2S block and DMA_1_ is connected to the Tx_DMA and DMA_2 to the Rx_DMA.
Thanks in advanced, code below.
#include "project.h"
void DmaTxConfiguration(void);
void DmaRxConfiguration(void);
#define DMA_1_BYTES_PER_BURST 1
#define DMA_1_REQUEST_PER_BURST 1
#define DMA_1_SRC_BASE (CYDEV_SRAM_BASE)
#define DMA_1_DST_BASE (CYDEV_PERIPH_BASE)
/* DMA Configuration for RxDMA */
#define DMA_2_BYTES_PER_BURST (1)
#define DMA_2_REQUEST_PER_BURST (1)
#define DMA_2_SRC_BASE (CYDEV_PERIPH_BASE)
#define DMA_2_DST_BASE (CYDEV_SRAM_BASE)
#define LEN 101
int16_t inData[LEN];
int16_t outData[LEN];
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
Clock_1_Start();
I2S_1_Start();
I2C_1_Start();
isr_1_Start();
ADC_DelSig_1_Start();
codecConfig();
ADC_DelSig_1_StartConvert();
DmaTxConfiguration();
DmaRxConfiguration();
I2S_1_EnableRx();
while(0u != (I2S_1_ReadTxStatus() & I2S_1_TX_FIFO_0_NOT_FULL))
{/*wait*/}
I2S_1_EnableTx(); /* Enable Tx direction */
for(;;);
}
void DmaTxConfiguration(void)
{
uint8 TxDMA_Chan;
uint8 TxDMA_TD[1u];
TxDMA_Chan = DMA_1_DmaInitialize(DMA_1_BYTES_PER_BURST, DMA_1_REQUEST_PER_BURST, HI16(DMA_1_SRC_BASE), HI16(DMA_1_DST_BASE));
TxDMA_TD[0u] = CyDmaTdAllocate();
CyDmaTdSetConfiguration(TxDMA_TD[0u],LEN, TxDMA_TD[0u], CY_DMA_TD_INC_SRC_ADR);
CyDmaTdSetAddress(TxDMA_TD[0u], LO16((uint32)inData), LO16((uint32)I2S_1_TX_CH0_F0_PTR));
CyDmaChSetInitialTd(TxDMA_Chan, TxDMA_TD[0u]);
CyDmaChEnable(TxDMA_Chan, 1u);
}
void DmaRxConfiguration(void)
{
uint8 RxDMA_Chan;
uint8 RxDMA_TD[1u];
RxDMA_Chan = DMA_2_DmaInitialize(DMA_2_BYTES_PER_BURST, DMA_2_REQUEST_PER_BURST, HI16(DMA_2_SRC_BASE), HI16(DMA_2_DST_BASE));
RxDMA_TD[0u] = CyDmaTdAllocate();
CyDmaTdSetConfiguration(RxDMA_TD[0u],LEN, RxDMA_TD[0u], CY_DMA_TD_INC_DST_ADR);
CyDmaTdSetAddress(RxDMA_TD[0u], LO16((uint32)I2S_1_RX_CH0_F0_PTR), LO16((uint32)outData));
CyDmaChSetInitialTd(RxDMA_Chan, RxDMA_TD[0u]);
CyDmaChEnable(RxDMA_Chan, 1u);
}
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please check the Kit Example available with kit CY8CKIT-046 available at this link:
http://www.cypress.com/documentation/development-kitsboards/cy8ckit-046-psoc-4-l-series-pioneer-kit
Please check these ANs too:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please check the Kit Example available with kit CY8CKIT-046 available at this link:
http://www.cypress.com/documentation/development-kitsboards/cy8ckit-046-psoc-4-l-series-pioneer-kit
Please check these ANs too: