- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to read a status register at regular, short intervals. To do this I've connected a clock to my DMA drq signal and have set up the status register DMA through the DMA wizard. I am using all internal clocks just to test the DMA but I have not seen any successful memory transfer. Could you please look over my code and let me know of any errors? I have also attached an image of my Top Design.
#include <project.h>
/* Defines for DMA_1 */
#define DMA_1_BYTES_PER_BURST 1
#define DMA_1_REQUEST_PER_BURST 1
#define DMA_1_SRC_BASE (CYDEV_PERIPH_BASE)
#define DMA_1_DST_BASE (CYDEV_SRAM_DATA_MBASE)
int main()
{
uint8 DMA_1_Chan;
uint8 DMA_1_TD[1];
DMA_1_Chan = DMA_1_DmaInitialize(DMA_1_BYTES_PER_BURST, DMA_1_REQUEST_PER_BURST,
HI16(DMA_1_SRC_BASE), HI16(DMA_1_DST_BASE));
DMA_1_TD[0] = CyDmaTdAllocate();
CyDmaTdSetConfiguration(DMA_1_TD[0], 1, DMA_1_TD[0], TD_INC_DST_ADR);
CyDmaTdSetAddress(DMA_1_TD[0], LO16((uint32)Status_Reg_1_Status_PTR), LO16((uint32)CYDEV_SRAM_DATA_MBASE));
CyDmaChSetInitialTd(DMA_1_Chan, DMA_1_TD[0]);
CyDmaChEnable(DMA_1_Chan, 1);
unsigned char* Receive_Data = (unsigned char*) CYDEV_SRAM_DATA_MBASE;
int i;
CyGlobalIntEnable; /* Enable global interrupts. */
Clock_4_Stop();
Clock_4_Start();
CyDelayUs(1500);
Clock_4_Stop();
for(;;)
{
for(i = 0; i < 200; i++)
{
Pin_1_Write(1);
if((int)Receive_Data)
CyDelay(500);
CyDelay(100);
Pin_1_Write(0);
CyDelay(500);
}
}
}
- Labels:
-
PSoC 5LP