This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129XNCZAD: SD card write is rebooting the microcontroller.

Part Number: TM4C129XNCZAD

Hello all,

I have joined recently in one project where we are using Tiva TM4C controller and TI RTOS. Multiple TI provided Libraries Like.

1) grlib_raster_driver_8bpp.c {Graphic library}

2) SD card {<driverlib/sysctl.h> <driverlib/ssi.h> <driverlib/gpio.h>} 

We all are new in team to continue working on given platform.

I am interested to know where I can get details like (Developer guide for TI RTOS, Graphic library and SD card related) any application notes related to these.

Part 2

>> Currently, I am facing one problem related to SD card. I am testing SD card functionality with full SD card.

      I am trying to write when SD card is already full. Then system is going for restart. Looks like memory exception.

      I am interested to know how I can get status of available free memory on SD card before going to write into it.  

      If there is already API provided by SD card driver then please direct me.

Regards,

Vishal Rana

  • Hello Vishal,

    For TI-RTOS collateral we have a few:

    Getting Started Guide for TM4C/Tiva-C MCU's: https://www.ti.com/lit/ug/spruhu5d/spruhu5d.pdf

    TI-RTOS User's Guide: http://www.ti.com/lit/pdf/spruhd4

    SYS/BIOS User's Guide: http://www.ti.com/lit/pdf/spruex3

    For Graphics, we have two resources specific to baremetal - TI-RTOS for Tiva-C did not formally port the graphics library (grlib) into the kernel so there isn't a specific resource for that:

    Graphics Library User Guide: https://www.ti.com/lit/pdf/spmu300

    Developing LCD Applications for TM4C MCUs app note: https://www.ti.com/lit/pdf/spma082

    >> Currently, I am facing one problem related to SD card. I am testing SD card functionality with full SD card.

          I am trying to write when SD card is already full. Then system is going for restart. Looks like memory exception.

          I am interested to know how I can get status of available free memory on SD card before going to write into it.  

          If there is already API provided by SD card driver then please direct me.

    I am not really familiar with SD card APIs as I haven't used them much but it looks like this API would be useful for what you need:

    Fullscreen
    1
    FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    That is documented in ff.h under [Install Path]\TivaWare_C_Series-2.2.0.295\third_party\fatfs\src

    You also should get a code back on operation of all APIs which is FRESULT. There is a defined code for the Directory being full. Maybe that needs to be checked in application code and if it is returned as FR_DENIED then actions are taken to avoid program crash.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    typedef enum {
    FR_OK = 0, /* (0) Succeeded */
    FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
    FR_INT_ERR, /* (2) Assertion failed */
    FR_NOT_READY, /* (3) The physical drive cannot work */
    FR_NO_FILE, /* (4) Could not find the file */
    FR_NO_PATH, /* (5) Could not find the path */
    FR_INVALID_NAME, /* (6) The path name format is invalid */
    FR_DENIED, /* (7) Access denied due to prohibited access or directory full */ <---- Here is FR_DENIED description
    FR_EXIST, /* (8) Access denied due to prohibited access */
    FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
    FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
    FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
    FR_NOT_ENABLED, /* (12) The volume has no work area */
    FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
    FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */
    FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
    FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
    FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
    FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */
    FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Best Regards,

    Ralph Jacobi