The example code to work with SD cards is using automatic variables (uint8_t buffer;) for DMA buffers. Of course, when the stack is in the scratchpad memory, that can't work.
Since the example code is very likely to be used as a basis for other applications, you might want to consider either making the buffer global or at least putting a big fat warning about the necessity to keep all DMA buffers out of automatic variables. I can also recommend adding a runtime assertion to ensure the address passed is in the right range.
It's likely that other drivers might suffer from similar problems so a more thorough investigation might be necessary.
Can you confirm that you are referring to the POST example for the BF506F EZ-KIT Lite? If this is the case, I can enter an enhancement request so it can be considered for the future.
Note that it may be beyond the scope of the examples to reiterate limitations - such as performing DMA from scratchpad - that are documented elsewhere.
static uint32_t sd_mmc_get_sd_scr_register(void)
uint32_t error = 0;
*pRSI_DATA_LGTH = 8;
*pRSI_DATA_TIMER = 0xFFFFFFFF;
error = sd_mmc_send_command(SD_MMC_CMD_SEND_STATUS, adi_rsi_card_registers.sd.rca<<16);
if((*pRSI_RESPONSE0 & SD_CSR_CURRENT_STATE) == SD_CSR_CURRENT_STATE_STANDBY)
error = sd_mmc_send_command( SD_MMC_CMD_SELECT_DESELECT_CARD,
// DMA call here
SDBlockRead((void *)&buffer, 8);
We declared them global and make static like this
static uint8_t dma_buffer;
or uint8_t buffer;
from functions static uint32_t sd_mmc_get_sd_scr_register(void), static uint32_t sd_mmc_get_sd_ssr_register(void) and so on
Thanks for the feedback. As I said, I'll log this as an enhancement request.