This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Circular SPI buffer with DMA

Hi!

I want to set up a circular buffer for the SPI with the DMA. One transmit buffer with 8 words and on receive buffer with 2 K words. Is this possible?

Thanks!

  • Hi Jonas,

    Can you please tell us more about your application? Are you going to use SPI compatiility mode or multi-buffer mode?

    Regards, QJ

  • Hi,

     

    This is want I want to happen

    1. TX_DMA_REQ request from SPI

    2. Move 2 bytes from RAM  address BASE + 0 to SPI TX buffer

    3. TX_DMA_REQ request from SPI

    4. Move 2 bytes from  RAM address BASE + 2 to SPI TX buffer

    5. TX_DMA_REQ request from SPI

    6. Move 2 bytes from  RAM address BASE + 4 to SPI TX buffer

    7. TX_DMA_REQ request from SPI

    8. Move 2 bytes from RAM address BASE + 6 to SPI TX buffer

    7. TX_DMA_REQ request from SPI

    8. Move 2 bytes from RAM address BASE + 0 to SPI TX buffer

    and so on.......

    At action 8 it's the same bytes as in action 1, thus it's a circular buffer. I guess it's easier to set up in SPI compatability mode.

    Another problem I have is that I can't write to DMA registers, are they per deafault protected somehow (I am in supervisor mode when I try to write to them)?

    Regards,

    Jonas

  • Jonas,

    For transfering eight 16-Bit data, I recommend to configure DMA control packets as below 

    1) Destination = SPIDAT1 
    2) Source = RAM address (or 16 bytes array)
    3) Frame count = 1
    4) Element count = 10
    5) Trans type = Frame Transfer
    6) Read = Addr Fixed
    7) Write = Addr Fixed
    8) Read Size = 16 bit
    9) Write Size = 16 bit
    
    
    Please check you gel file to make sure the DMA is mapped as:
       GEL_MapAdd(0xFFFFF000, 0, 0x00000400, 1, 1); /* DMA                       */
    GEL_MapAdd(0xFFF80000, 0, 0x00001000, 1, 1); /* DMA RAM                   */
    
    
    Regards,
    QJ