Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start the peripheral-to-memory DMA transfer.
Embedded C
DMA_Start_Transfer([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the peripheral name instead of the DMA channel.
Using a timer channel instead of DMA channel.
✗ Incorrect
DMA_Start_Transfer requires the DMA channel identifier to start the transfer.
2fill in blank
mediumComplete the code to configure the DMA data size for peripheral-to-memory transfer.
Embedded C
DMA_Config.DataSize = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 8-bit size when peripheral sends 16-bit data.
Selecting unsupported 64-bit size.
✗ Incorrect
Peripheral data size is often 16 bits for many sensors and peripherals.
3fill in blank
hardFix the error in the DMA transfer complete interrupt handler to clear the interrupt flag.
Embedded C
void DMA_IRQHandler(void) {
if (DMA_GetFlagStatus([1])) {
DMA_ClearFlag([1]);
// Process data
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Clearing half-transfer flag instead of transfer complete.
Not clearing any flag causing interrupt to repeat.
✗ Incorrect
DMA_FLAG_TC1 indicates transfer complete and must be cleared to avoid repeated interrupts.
4fill in blank
hardFill both blanks to set the peripheral and memory addresses for DMA transfer.
Embedded C
DMA_Config.PeripheralBaseAddr = [1]; DMA_Config.MemoryBaseAddr = [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping peripheral and memory addresses.
Using ADC1 address when UART1 is the peripheral.
✗ Incorrect
Peripheral address is UART1 data register; memory address is the buffer to store data.
5fill in blank
hardFill all three blanks to configure DMA transfer direction, enable circular mode, and set priority.
Embedded C
DMA_Config.Direction = [1]; DMA_Config.Mode = [2]; DMA_Config.Priority = [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting direction as peripheral destination.
Using normal mode instead of circular for continuous transfer.
Setting low priority causing delays.
✗ Incorrect
Direction is peripheral source for peripheral-to-memory, circular mode allows continuous transfer, and high priority ensures timely DMA service.