0
0
Embedded Cprogramming~10 mins

DMA controller concept in Embedded C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable the DMA controller.

Embedded C
DMA->[1] |= DMA_ENABLE;
Drag options to blanks, or click blank then click option'
ACONFIG
BCTRL
CSTATUS
DINTERRUPT
Attempts:
3 left
💡 Hint
Common Mistakes
Using STATUS register instead of CONFIG.
Trying to enable DMA in INTERRUPT register.
2fill in blank
medium

Complete the code to set the source address for DMA transfer.

Embedded C
DMA->SRC_ADDR = [1];
Drag options to blanks, or click blank then click option'
A0x40000000
BDMA_ENABLE
C0x20000000
D0x00000000
Attempts:
3 left
💡 Hint
Common Mistakes
Using DMA_ENABLE instead of an address.
Using zero address which is usually invalid.
3fill in blank
hard

Fix the error in the code to start the DMA transfer.

Embedded C
DMA->[1] = 1; // Start transfer
Drag options to blanks, or click blank then click option'
ACTRL
BCONFIG
CSTATUS
DSRC_ADDR
Attempts:
3 left
💡 Hint
Common Mistakes
Writing to STATUS register which is read-only.
Writing to SRC_ADDR which sets address, not start.
4fill in blank
hard

Fill both blanks to configure the DMA transfer size and direction.

Embedded C
DMA->[1] = 256; // Transfer size
DMA->[2] = [2]_MEM_TO_PERIPH;
Drag options to blanks, or click blank then click option'
ASIZE
BDIR
CCTRL
DCONFIG
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing CTRL with SIZE or DIR registers.
Setting direction in CONFIG register incorrectly.
5fill in blank
hard

Fill all three blanks to create a DMA transfer descriptor with source, destination, and size.

Embedded C
dma_desc.src_addr = [1];
dma_desc.dst_addr = [2];
dma_desc.size = [3];
Drag options to blanks, or click blank then click option'
A0x20001000
B0x40002000
C512
DDMA_ENABLE
Attempts:
3 left
💡 Hint
Common Mistakes
Using DMA_ENABLE as an address or size.
Mixing up source and destination addresses.