bertvoldenuit opened a new issue, #11273:
URL: https://github.com/apache/nuttx/issues/11273

   At each transfer, there is a TERR (transfer error) on the RX channel. I 
tried to put the MISO pin on idle/high/low but it has no effect.
   
   According to SAMD21 Errata:
   ```text
   1.7.2 Linked Descriptor
   
   When at least one channel using linked descriptors is already active, 
enabling another DMA channel (with or without
   linked descriptors) can result in a channel Fetch Error (FERR) or an 
incorrect descriptor fetch.
   This occurs if the channel number of the channel being enabled is lower than 
the channel already active.
   
   Workaround
   
   When enabling a DMA channel while other channels using linked descriptors 
are already active, the channel number
   of the new channel enabled must be greater than the other channel numbers.`
   ```
   
   In the spi driver, in the description and in the code it is always Tx and 
then Rx except in one place where it is Rx and then Tx which could lead in the 
FERR according to Errata
   
   I think it would be better to swap Rx/Tx in the following code:
   
   ```c
   static void spi_dma_setup(struct sam_spidev_s *priv)
   {
     /* Allocate a pair of DMA channels */
   
       priv->dma_rx = sam_dmachannel(DMACH_FLAG_STEPSEL_PERIPH|
                                   DMACH_FLAG_BEATSIZE_BYTE |
                                   DMACH_FLAG_MEM_INCREMENT |
                                   
DMACH_FLAG_PERIPH_RXTRIG(priv->dma_rx_trig)); 
       priv->dma_tx = sam_dmachannel(DMACH_FLAG_STEPSEL_PERIPH|
                                   DMACH_FLAG_BEATSIZE_BYTE |
                                   DMACH_FLAG_MEM_INCREMENT |
                                   DMACH_FLAG_PERIPH_TXTRIG(priv->dma_tx_trig));
                                  
   }
   ```
   into
   
   ```c
   static void spi_dma_setup(struct sam_spidev_s *priv)
   {
     /* Allocate a pair of DMA channels */
   
     priv->dma_tx = sam_dmachannel(DMACH_FLAG_STEPSEL_PERIPH|
                                   DMACH_FLAG_BEATSIZE_BYTE |
                                   DMACH_FLAG_MEM_INCREMENT |
                                   DMACH_FLAG_PERIPH_TXTRIG(priv->dma_tx_trig));
   
     priv->dma_rx = sam_dmachannel(DMACH_FLAG_STEPSEL_PERIPH|
                                   DMACH_FLAG_BEATSIZE_BYTE |
                                   DMACH_FLAG_MEM_INCREMENT |
                                   
DMACH_FLAG_PERIPH_RXTRIG(priv->dma_rx_trig));                                
   }
   ```
   
   I can make a PR but it does not change anything in my case, I still get TERR.
   
   Could disabling the DMAC_INT_TERR  interrupt be a way around? when I disable 
it nsh is not showing up.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to