AnsweredAssumed Answered

howto DSPI EDMA Slave  MK64

Question asked by Ulrich Riedel on Jan 14, 2015
Latest reply on Jan 14, 2015 by Alice_Yang

Hello

 

I tried slave SPI with DMA on MK64  FRDM K64E with the example from 9.4 DSPI Slave Driver

Kinetis SDK v.1.1 API Reference Manual

No data is transfered...

What is wrong?

 

Thank you

 

short g_dma_read[128];

short g_dma_write[128];

 

 

    edma_state_t       edmaState;

    edma_user_config_t edmaUserConfig;

    dspi_edma_slave_state_t       dspiEdmaSlaveState;

    dspi_edma_slave_user_config_t slaveEdmaUserConfig;

 

 

    dspi_status_t result;

 

 

    PORT_HAL_SetMuxMode(PORTD_BASE, 0, kPortMuxAlt2); // PTD0 SPI0_PCS0  CS slave, 1 CLK high 19 CLK low

    PORT_HAL_SetMuxMode(PORTD_BASE, 1, kPortMuxAlt2); // PTD1 SPI0_SCK   CLK slave with continious 15 MHz clock

    PORT_HAL_SetMuxMode(PORTD_BASE, 2, kPortMuxAlt2); // PTD2 SPI0_SOUT

    PORT_HAL_SetMuxMode(PORTD_BASE, 3, kPortMuxAlt2); // PTD3 SPI0_SIN

 

 

    memset(&edmaUserConfig, 0, sizeof(edmaUserConfig));

    edmaUserConfig.chnArbitration = kEDMAChnArbitrationRoundrobin;

    EDMA_DRV_Init(&edmaState, &edmaUserConfig);

 

 

    memset(&dspiEdmaSlaveState, 0, sizeof(dspiEdmaSlaveState));

    memset(&slaveEdmaUserConfig, 0, sizeof(slaveEdmaUserConfig));

    slaveEdmaUserConfig.dataConfig.clkPhase    = kDspiClockPhase_FirstEdge;

    slaveEdmaUserConfig.dataConfig.clkPolarity = kDspiClockPolarity_ActiveHigh;

    slaveEdmaUserConfig.dataConfig.bitsPerFrame = 19;

    slaveEdmaUserConfig.dummyPattern = 0;

 

 

    DSPI_DRV_EdmaSlaveInit(0, &dspiEdmaSlaveState, &slaveEdmaUserConfig);  // DSPI0

 

  // g_dma_write, g_dma_read is previously filled with testpattern, to make sure to debug

 

    // make SPI transfer

    result = DSPI_DRV_EdmaSlaveTransfer(0, // SPI0

                                        (const uint8_t *) g_dma_write,

                                        (uint8_t *)       g_dma_read,

                                        100);

    while(kStatus_DSPI_Success != DSPI_DRV_EdmaSlaveGetTransferStatus(0, NULL)) {

      __asm(" NOP");

    }

Outcomes