AnsweredAssumed Answered

sd card error: not a valid memory address to write

Question asked by rgd@dvt on Sep 29, 2017
Latest reply on Oct 10, 2017 by Kader.M

Hi, I am integrating the sd-card example from the "Power_On_Self_Test" example (rsi design) in my project. It seems to work except when I try to load larger files. Below you see a small part from the code from the file "rsi.c".


 *  sd_mmc_write_mblocks_dma
uint32_t sd_mmc_write_mblocks_dma(uint32_t card_address, void * pSource, uint32_t num_blocks)
    uint32_t error = 0;
    uint32_t i = 0;
    if(num_blocks > 4)num_blocks =  4;//**************************!!!!!!!!!!!!!!!!!!!!!!!!!
 adi_rsi_SetBlockCntAndLen(hDeviceSD, num_blocks, 512);
 adi_rsi_SubmitTxBuffer(hDeviceSD, pSource, 512, num_blocks);
 error = sd_mmc_send_command(SD_MMC_CMD_WRITE_MULTIPLE_BLOCK, card_address, RESPONSE_SHORT, TRANS_WRITE, CRCDIS);
    void *pBuffer = NULL;
    adi_rsi_GetTxBuffer (hDeviceSD, &pBuffer); //<-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    /* workaround for some MMC cards that are fussy with regards to the timing
  of the STOP_TRANSMISSION signal */
    for(i=0; i<1024; i++);
    /* wait until the device becomes ready */
    return error;
The line
if(num_blocks > 4)num_blocks =  4;//**************************!!!!!!!!!!!!!!!!!!!!!!!!!
was added by me because without the program stayed in a loop. When I stopped the program and pressed the button "step return" I got the message in the consule: 0x04037352 is not a valid memory address to write to.
So I limited the number of blocks and found out that the max was 5. With the block max is 5 t a file was written to the sd card without a problem, the file was indeed 4MByte, however with a lot of zero's since a lot of blockes were skipped.
The problem seems to be with the line: adi_rsi_GetTxBuffer(hDeviceSD, &pBuffer);
I tried also an other pBuffer address (0x80000000 -videoBuffer0- , the Original was 0x118021d4), but had the same result.
I am using a custom made board with the BF707 connected to a micro sd-card.
The complete file I want to write is approx 4MByte.
Any suggestion that could help is highly appreciated.