RA4M1 , SPI with DMA

Hi,

I search a small example for SPI Master and DMA transfer.

So that I can receive e.g. 15 bytes with DMA and get a transfer end interrupt/callback when it is finished.

Thanks in advanced !

Parents Reply Children
  • FSP4.0 supports DTC and DMAC transfer interface in the driver

     Add the r_spi driver to your project

    Add the DMAC transfer driver to the stack:

  • Hello . As mentioned by Richard, the latest release of FSP added support for SPI with DMAC. 

    And if you are looking for SPI with DTC, the example code named "r_sci_spi" uses DTC by default. Please check that out here:

    https://github.com/renesas/ra-fsp-examples/tree/master/example_projects/ek_ra4m1/sci_spi/sci_spi_ek_ra4m1_ep

    -Jayesh

    If this response, or one provided by another user, answers your question, please verify the answer. Thank you!
    Renesas Engineering Community Moderators
    https://community.renesas.com/
    https://academy.renesas.com/
    en-support.renesas.com/.../

  • Now I use the 4.0 and there is DMAC supported. But I don't get a SPI DMA transmission to work. here my HAL_ENTRY :

    void hal_entry(void)
    {

    unsigned char txByte[] = {0,1,2,3,4,5,6,7,8,9};
    unsigned char rxByte[] = {0,1,2,3,4,5,6,7,8,9};

    /* Initialize SPI driver */
    g_spi_master.p_api->open (&g_spi_master_ctrl, &g_spi_master_cfg);
    /* Initialize SPI TX DMAC driver */
    g_transferSPI0_tx_cfg.p_info->p_dest = (void*)&R_SPI0->SPDR ;
    g_transferSPI0_tx_cfg.p_info->p_src = (void*)&txByte ;
    g_transferSPI0_tx_cfg.p_info->length = 10;
    /* Initialize SPI RX DMAC driver */
    g_transferSPI0_rx_cfg.p_info->p_dest = (void*)&rxByte ;
    g_transferSPI0_rx_cfg.p_info->p_src = (void*)&R_SPI0->SPDR ;

    g_transferSPI0_tx.p_api->open(&g_transferSPI0_tx_ctrl , &g_transferSPI0_tx_cfg);
    g_transferSPI0_rx.p_api->open(&g_transferSPI0_rx_ctrl , &g_transferSPI0_rx_cfg);

    g_transferSPI0_tx.p_api->enable(&g_transferSPI0_tx_ctrl);
    g_transferSPI0_tx.p_api->softwareStart(&g_transferSPI0_tx_ctrl,TRANSFER_START_MODE_SINGLE);

    while(1) {

    }

    }

    and here my settings :

    I can't see a SPI transfer on the Pins on my board. How I start the transmission with DMAC for e.g. 10 bytes ?

    What is wrong or missing ?

    Thanks in advanced