NUC502Apr 30, 2015 Page 58 of 266 Rev 1.16.4.5 SPIM Programming Example with DMAIf users want to access a device with DMA function, 3 additional registers need to beconfigured. They are CODE_LEN, AHB_ADDR and SPI_ADDR. DMA function can be used tosupport loading boot code, reading data from system memory into peripherals or copy datafrom peripherals, reading data from peripherals into system memory. Users must define thelength and destination and hardware will automatically move the desired length of code tospecific target address.6.4.5.1 Code Boot Process:Step 1: Read the Check ID and code length in device.Step 2:1. Set the target memory address in AHB_ADDR (system memory address)2. Set the boot code length which read from step 1 into CODE_LEN register3. Set the SPI start address in SPI_ADDR (peripheral address)4. Set SSR register to select spi slave. ( no support ASS in dma mode )5. Set the READ command (03) and 3-Byte SPI Start Address into Tx0, Tx1, Tx2,Tx3.6. Set SPI_CNTRL = 0x1a1345.for control information.7. Wait code read finish. Wait interrupt.8. Set SSR register to un-select spi slave. ( no support ASS in dma mode )If used SPI flash supports other read mode, users can also use the following mode.1. Fast read (0b), set read command (0b) into Tx0, & SPI_CNTRL =0x0b1a1b45.2. Fast dual read (3b), set read command (3b) into Tx0, & SPI_CNTRL =0x3b1a1b45.6.4.5.2 Move data from system memory to peripheral (Program SPIFlash):Step 1: Erase the spi flash before program it.Step 2:1. Send Write Enable command to SPI flash2. Set the source memory address in AHB_ADDR3. Set the code length into CODE_LEN register4. Set the spi start address in SPI_ADDR5. Set SSR register to select spi slave. ( no support ASS in dma mode )6. Set the Page Program command (02) and 3-Byte SPI Start Address into Tx0, Tx1,Tx2, Tx3.