64.6.9 Transfer Without DMA

Important: If the DMA is not to be used, it is necessary to disable it, otherwise it can be enabled by previous versions of software without warning. If this should occur, the DMA can process data before an interrupt without knowledge of the user.

The recommended means to disable DMA are as follows:

// Reset IP UDPHS 
  BASE_UDPHS->UDPHS_CTRL &= ~UDPHS_EN_UDPHS;
  BASE_UDPHS->UDPHS_CTRL |= UDPHS_EN_UDPHS;// 
With OR without DMA !!!
  for( i=1; i<=((BASE_UDPHS->UDPHS_IPFEATURES &
UDPHS_DMA_CHANNEL_NBR)>>4); i++ ) {
// RESET endpoint canal DMA:
    // DMA stop channel command    
   BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMACONTROL = 0; // STOP
command
// Disable endpoint
  BASE_UDPHS->UDPHS_EPT[i].UDPHS_EPTCTLDIS |= 0XFFFFFFFF;
// Reset endpoint config
  BASE_UDPHS->UDPHS_EPT[i].UDPHS_EPTCTLCFG = 0;
// Reset DMA channel (Buff count and Control field)
  BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMACONTROL = 0x02; // NON
STOP command
// Reset DMA channel 0 (STOP) 
  BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMACONTROL = 0; // STOP
command
// Clear DMA channel status (read the register for clear it)
  BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMASTATUS =  
  BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMASTATUS;
}