0
0
Embedded Cprogramming~10 mins

DMA with UART for bulk transfer 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 DMA for UART transmission.

Embedded C
UART->CR3 |= [1];
Drag options to blanks, or click blank then click option'
AUSART_CR3_DMAT
BUSART_CR3_DMAR
CUSART_CR3_TE
DUSART_CR3_RE
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing DMA transmit enable with DMA receive enable.
Setting transmit or receive enable bits instead of DMA bits.
2fill in blank
medium

Complete the code to configure the DMA channel for UART transmission direction.

Embedded C
DMA_Channel->CCR |= [1];
Drag options to blanks, or click blank then click option'
ADMA_CCR_TCIE
BDMA_CCR_DIR
CDMA_CCR_EN
DDMA_CCR_MINC
Attempts:
3 left
💡 Hint
Common Mistakes
Using the enable bit instead of direction bit.
Confusing memory increment with direction.
3fill in blank
hard

Fix the error in setting the DMA buffer size for UART transmission.

Embedded C
DMA_Channel->CNDTR = [1];
Drag options to blanks, or click blank then click option'
Astrlen(buffer)
Bsizeof(buffer)
CBUFFER_SIZE
Dsizeof(buffer) - 1
Attempts:
3 left
💡 Hint
Common Mistakes
Using strlen which works only for strings, not binary data.
Using sizeof on a pointer instead of the actual buffer size.
4fill in blank
hard

Fill both blanks to correctly configure DMA memory increment and enable the channel.

Embedded C
DMA_Channel->CCR |= [1] | [2];
Drag options to blanks, or click blank then click option'
ADMA_CCR_MINC
BDMA_CCR_DIR
CDMA_CCR_EN
DDMA_CCR_TCIE
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to enable the DMA channel.
Confusing direction bit with memory increment.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps UART buffer indices to their values if the value is greater than zero.

Embedded C
uart_data = [1]: [2] for [3] in range(BUFFER_SIZE) if buffer[[3]] > 0
Drag options to blanks, or click blank then click option'
Ai
Bbuffer[i]
Dbuffer
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong variable name for the loop index.
Confusing the key and value in the comprehension.