eDMA bus error ext. sdram

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

eDMA bus error ext. sdram

Jump to solution
1,274 Views
martinmadron
Contributor II

Hello,

i have a bus error when i try to write/read data with edma from/to external SDRAM. Every time i get source or destination bus error. For data transfers in internal RAM or flash to internal RAM it works fine.

I can also write and read data manualy to/from SDRAM with no problem.

Can it be somehow related to PACR and MPR registers?

platform :TWR-K65, MQX, KSDK 1.3

Buffers (buffram is external memory section)

uint8_t destinationBuff[1000];

__attribute__((section(".buffram"))) uint8_t sourceBuff[1000] = {1,1,2,3,4,5,6,7,8,9};

Init function

void trasferInitEdma( void)

{

    edma_status_t initStatus;

    edma_chn_state_type_t channelT;

    //  OSA_InstallIntHandler(UART0_RX_TX_IRQn, uartCom1_IRQHandler);

    OSA_InstallIntHandler(DMA0_DMA16_IRQn,  dmaController1_Chn0IRQHandler);

    OSA_InstallIntHandler(DMA_Error_IRQn,  dmaController1_Chn0ErrorIRQHandler);

    // initialiye edma drive

    //--------------------------

    initStatus = EDMA_DRV_Init(&dmaController1_State,&dmaController1_InitConfig0);

    if ( initStatus != kStatus_EDMA_Success )

    {

          __BKPT(3);

    }

    // request edma channel

    channelT = EDMA_DRV_RequestChannel(kEDMAAnyChannel, kDmaRequestMux0AlwaysOn60, &dmaController1_ChnState0);

    initStatus = EDMA_DRV_InstallCallback(&dmaController1_ChnState0, dmaController1_Callback0, NULL);

    if ( initStatus != kStatus_EDMA_Success )

          {

              __BKPT(6);

          }

}

transfer fnc

void tranferDataEdma(uint8_t * source, uint8_t * destination, size_t size )

{

    myTransferStatus = transferInProgress;

    edma_software_tcd_t transferDescriptor __attribute__((aligned (32)));

    edma_transfer_config_t edmaTransferConfig;

    edmaTransferConfig.srcAddr            = (uint32_t)source;

    edmaTransferConfig.destAddr           = (uint32_t)destination;

    edmaTransferConfig.srcTransferSize    = kEDMATransferSize_1Bytes;

    edmaTransferConfig.destTransferSize   = kEDMATransferSize_1Bytes;

    edmaTransferConfig.srcOffset          = 1U;

    edmaTransferConfig.destOffset         = 1U;

    edmaTransferConfig.srcLastAddrAdjust  = 0U;

    edmaTransferConfig.destLastAddrAdjust = 0U;

    edmaTransferConfig.srcModulo          = kEDMAModuloDisable;

    edmaTransferConfig.destModulo         = kEDMAModuloDisable;

    edmaTransferConfig.minorLoopCount     = 1U;

    edmaTransferConfig.majorLoopCount     = size;

    memset(&transferDescriptor, 0, sizeof(edma_software_tcd_t));

    EDMA_DRV_PrepareDescriptorTransfer(&dmaController1_ChnState0,

                                       &transferDescriptor,

                                       &edmaTransferConfig,

                                       true,

                                       true);

    /* Copies the software TCD configuration to the hardware TCD */

    EDMA_DRV_PushDescriptorToReg(&dmaController1_ChnState0, &transferDescriptor);

    /* Start DMA channel */

    EDMA_DRV_StartChannel(&dmaController1_ChnState0);

EDMA_DRV_PushDescriptorToReg(&dmaController1_ChnState0, &transferDescriptor);

/* Start DMA channel */

    EDMA_DRV_StartChannel(&dmaController1_ChnState0);

}

0 Kudos
1 Solution
890 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Martin,

what address are you using for SDRAM? Please note that 0x08000000 is alieased and only accesible by the core.

pastedImage_0.png

On the other hand there are 0x70000000 and 0x80000000 which are Write-back and write-through memory areas. In these cases if you have cache disabled there should be no problem, but if is you should flush cache in case you  use write-back space.

pastedImage_1.png

I hope this information helps.


Best regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
4 Replies
890 Views
Carlos_Musich
NXP Employee
NXP Employee

Hello Martin,

Are you using Flexbus to communicate with external RAM?

Carlos

0 Kudos
890 Views
martinmadron
Contributor II

I am using SDRAM controler. I have tried many different dma transfers with success, but whenever i "touch" sdram with dma, i get bus error.

0 Kudos
891 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Martin,

what address are you using for SDRAM? Please note that 0x08000000 is alieased and only accesible by the core.

pastedImage_0.png

On the other hand there are 0x70000000 and 0x80000000 which are Write-back and write-through memory areas. In these cases if you have cache disabled there should be no problem, but if is you should flush cache in case you  use write-back space.

pastedImage_1.png

I hope this information helps.


Best regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
890 Views
martinmadron
Contributor II

Hello Carlos,

you are right. It is exactly my problem. Thank you for your response. I should read manual more carefully :smileyhappy:.

Have a nice day.

0 Kudos