19.4.1 Initialization

The following DMAC registers and bits or fields are enable-protected, meaning they can be written only when the DMAC is disabled (CTRL.DMAENABLE = 0):

  • Descriptor Base Memory Address (BASEADDR) register
  • Write-Back Memory Base Address (WRBADDR) register

The following DMAC bit is enable-protected, meaning it can be written only when both the DMAC and CRC are disabled (CTRL.DMAENABLE = 0 and CTRL.CRCENABLE = 0):

  • Software Reset bit in the Control register (CTRL.SWRST)

The following DMA channel register and bit are enable-protected, meaning it can be written only when the corresponding DMA channel is disabled (CHCTRLA.ENABLE = 0):

  • Channel Control B (CHCTRLB) register, except for the Command (CHCTRLB.CMD) bit and the Channel Arbitration Level (CHCTRLB.LVL) bit
  • Channel Software Reset bit in the Channel Control A (CHCTRLA.SWRST) register

The following CRC registers are enable-protected, meaning they can be written only when the CRC is disabled (CTRL.CRCENABLE = 0):

  • CRC Control (CRCCTRL) register
  • CRC Checksum (CRCCHKSUM) register

Enable-protection is indicated by the Enable-Protected property in the register description.

Before the DMA engine is enabled, it must be configured according to the following steps:

  • Write the SRAM address of the descriptor memory section to the Description Base Address (BASEADDR) register
  • Write the SRAM address of the write-back memory section to the Write-Back Memory Base Address (WRBADDR) register
  • Enable arbiter priority level n by writing ‘1’ to the Priority Level n Enable bit (CTRL.LVLENn) in the Control register. This allows the arbiter to handle channels assigned to priority level n.
  • Once the DMA engine is configured, it can be enabled by setting the DMA Enable bit in the Control (CTRL.DMAENABLE) register

Before a DMA channel is enabled, both the channel itself and the corresponding first transfer descriptor must be configured according to the following steps:

  • DMA channel configurations
    • Select the DMA channel number to configure by writing to the Channel ID (CHID) register
    • Select the trigger action by writing to the Trigger Action field (CHCTRLB.TRIGACT) in the Channel Control B register
    • Select the trigger source by writing to the Trigger Source field (CHCTRLB.TRIGSRC) in the Channel Control B register
  • Transfer Descriptor configurations
    • Select the size of each access on the data transfer bus by writing the Beat Size field (BTCTRL.BEATSIZE) in the Block Transfer Control register
    • Mark the transfer descriptor as valid by writing ‘1’ to the Valid bit (BTCTRL.VALID) in the Block Transfer Control register
    • Set the number of beats in the block transfer by writing to the Block Transfer Count (BTCNT) register
    • Set the source address for the block transfer by writing to the Block Transfer Source Address (SRCADDR) register
    • Set the destination address for the block transfer by writing to the Block Transfer Destination Address (DSTADDR) register
  • Once the selected DMA channel is configured, it can be enabled by setting the Channel Enable bit in the Channel Control A register (CHCTRLA.ENABLE)

If CRC calculation is required, configure the CRC engine before enabling it by following these steps:

  • Select the CRC input source by writing to the CRC Input Source bit field in the CRC Control (CRCCTRL.CRCSRC) register
  • Select the CRC calculation type by writing to the CRC Polynomial Type bit field in the CRC Control (CRCCTRL.CRCPOLY) register
  • If I/O is selected as the input source, select the beat size by writing to the CRC Beat Size bit field in the CRC Control (CRCCTRL.CRCBEATSIZE) register
  • Once the CRC engine is configured, it can be enabled by setting the CRC Enable bit in the Control (CTRL.CRCENABLE) register