SPI with edma (32byte align problem)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI with edma (32byte align problem)

759 Views
martinmadron
Contributor II

Hello, my program keeps crashing when i try initi my DSPI driver. Worked without edma fine.

 

Here

dspiResult = DSPI_DRV_EdmaMasterInit(SPI0_IDX, &dspiMasterState, &userConfig, &stcdSrc2CmdDataLast);
    if (dspiResult != kStatus_DSPI_Success)
    {
        PRINTF("\r\nERROR: Can not initialize master EDMA driver \n\r");
    }

 

Driver says stcdSrc2CmdDataLast has to be 32 byte aligned. I have used gcc atribute to set align, no warnings or errors.

 

typedef struct EDMASoftwareTcd {

    uint32_t SADDR;

    uint16_t SOFF;

    uint16_t ATTR;

    uint32_t NBYTES;

    uint32_t SLAST;

    uint32_t DADDR;

    uint16_t DOFF;

    uint16_t CITER;

    uint32_t DLAST_SGA;

    uint16_t CSR;

    uint16_t BITER;

} edma_software_tcd_t __attribute__ ((aligned (32)));

Original Attachment has been moved to: customDspi.c.zip

Labels (1)
0 Kudos
2 Replies

374 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Martin Madron:

Exactly what board or Kinetis part are you using?

In the Kinetis SDK installation there are some ready to test DSPI+DMA driver example projects in the path:

...\KSDK_1.3.0\examples\<board>\driver_examples\dspi\dspi_edma_blocking

...\KSDK_1.3.0\examples\<board>\driver_examples\dspi\dspi_edma_non_blocking

You can start with one of those as reference and then integrate the code to your custom project.

Regards!

Jorge Gonzalez

0 Kudos

374 Views
martinmadron
Contributor II

Hello,

its frdm-k64. Those examples you have suggested are exactly same as my implementation. Program is using USB cdc and MQX with ksdk. I have read on this forum that it can be caused by USB using DMA. Is it possible?

0 Kudos