SPI with edma (32byte align problem)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SPI with edma (32byte align problem)

898 次查看
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

标签 (1)
0 项奖励
回复
2 回复数

513 次查看
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 项奖励
回复

513 次查看
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 项奖励
回复