AnsweredAssumed Answered

SD Card with FREE RTOS

Question asked by Sam Tyler on Jul 29, 2015
Latest reply on Dec 1, 2015 by Kai Schmidt

Hi. I'm using KSDK3.00 and a modified example project. I'm writing this in KDS (No processor expert). I'm using the demo board FRDM K64F. I'm trying to add SD card functionality. When running the bare metal the program runs and I can write to an SD card.The problem is that the debugger breaks at default ISR when running using FREE RTOS.

 

The stack point where the program breaks is here:

dq3dUhR

 

Source code :

 

int main(void)

{

     hardware_init();

     OSA_Init();

 

     uint32_t i, status;

 

    #ifdef MPU_INSTANCE_COUNT

    // disable MPU

    for(i = 0; i < MPU_INSTANCE_COUNT; i++)

    {

        MPU_HAL_Disable(g_mpuBase[i]);

    }

    #endif

 

    configure_sdhc_pins(0);

    CLOCK_SYS_EnableSdhcClock(0);

    GPIO_DRV_Init(sdhcCdPin, NULL);

 

    sdhc_card_t card = {0};

    sdhc_host_t host = {0};

    sdhc_user_config_t config = {0};

 

    // initialize user sdhc configuration structure

    config.transMode = kSdhcTransModeAdma2;

    config.clock = SDMMC_CLK_100KHZ;

    config.cdType = kSdhcCardDetectGpio;

 

    // initialize the SDHC driver with the user configuration

    if (SDHC_DRV_Init(BOARD_SDHC_INSTANCE, &host, &config) != kStatus_SDHC_NoError)

    {

        PRINTF("ERROR\r\n");

    }

 

    if (kStatus_SDHC_NoError != SDCARD_DRV_Init(&host, &card))

    {

        PRINTF("SDCARD_DRV_Init failed\r\n");

        SDHC_DRV_Shutdown(card.hostInstance);

    }

 

    PRINTF("sdcard initialized\r\n");

    }

     //Later write to SD Card

}

 

Thanks in advance, Sam        

BAE Systems

Outcomes