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.

LAUNCHXL-F280025C: FATFS Library Support with Launchpad

Part Number: LAUNCHXL-F280025C
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Hi Team,

Can you please help us with this inquiry of our customer?

Hoping for some help: I have been evaluating SD card interfacing with C2000 MCUs using the F280025C launchpad and an off the shelf microSD breakout board. I have loaded a simple 'test.txt' file onto a microSD card and have been attempting to read it from the launchpad. 

To do so, I have added the 'SDCARD FATFS' library in the C2000ware Libraries section of the system config tool to my project.

Generally, it seems right now I do not receive any reply data on the POCI line from the microSD card. My main.c code is below:

8726.main.c
#include "driverlib.h" #include "device.h" #include "c2000ware_libraries.h" #include "string.h" #include <sdspi/sdspi.h> #include <sdspi/SDFatFS.h> #define DRIVE_NUM 0 // // Main // int32_t fatfs_getFatTime(void) { return 0; } // // End File // void main(void) { Device_init(); // // Disable pin locks and enable internal pullups. // Device_initGPIO(); // // Initialize PIE and clear PIE registers. Disables CPU interrupts. // Interrupt_initModule(); // // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // Interrupt_initVectorTable(); // // Board initialization // Board_init(); C2000Ware_libraries_init(); FIL dst; FRESULT fresult; const char inputfile[8] = "test.txt"; char readBuffer[20] = ""; uint16_t bytesRead = 0; fresult = f_open(&dst, inputfile, FA_READ); if (fresult != FR_OK) { ESTOP0; while(1); } fresult = f_read(&dst, readBuffer, 20, &bytesRead); if (fresult != FR_OK) { ESTOP0; while(1); } fresult = f_close(&dst); if (fresult != FR_OK) { ESTOP0; while(1); } // // Enable Global Interrupt (INTM) and realtime interrupt (DBGM) // EINT; ERTM; SDFatFS_close(myFATFS0_Handle); ESTOP0; } // // End File //

The code hangs right now on the first ESTOP0 instance in the main.c file (after the f_open command), with fresult = FR_NOT_READY instead of FR_OK.

The generated C2000ware_libraries.C file contains all the initialization and calling of the FATFS library inits, that are also generated by the sysconfig tool or written by TI. I have not touched any of that:

C2000ware_libraries.C

 Here is how this FATFS instance is configured in the config tool:

I have only touched the bit rate, because the SPI_Config function was throwing an error at the default 25kHz number. 

What I have tried:

1. Formatting the microSD card in both FAT32 and exFAT.

2. Attempting to read from multiple microSD cards from multiple vendors with the same test.txt file loaded

3. Adding a scope probe on the clock line and CIPO lines to evaluate signal integrity

 - The signals had some minor ringing and crosstalk, nothing larger than 100mV. Nothing that would overcome hysteresis.

 - I did not see any indication the CIPO line was ever attempting to output any signal, even with the CLK and PICO lines toggling, with CS low. 

4. Adding bypass capacitance to the VCC line local to the SD Card (being fed 3.3V from the launchpad)

5. Adding a 10k pullup to the CIPO line

6. Tying the CS line to ground with a 10k (the microSD is the only peripheral on the bus)

7. Adding a SPI sniffer to the data lines at the SD card breakout pins. The result (first 10-20 bytes or so) of that is below after the fopen() function is called in my main.c file:

Given I am receiving no data at all from the microSD, and have tried multiple cards, makes me think it is a config issue or some other naïve thing. Any advice or insight you can give as to what is wrong would be appreciated.

Regards,

Danilo

  • Danilo,

    I will connect you with our SW owner for SDFAT FS.

    Thank you,

    Nima Eskandari

    C2000 Application Manager

  • Hi Nima,

    Please see this update from our customer.
    I actually figured out the problem. The software was right, I just had a bad solder joint on the breakout board!
    Since then I have run into a different issue. If possible, I would love your feedback on the matter.
    The launchpad board was prototyping code for a custom design. I have since moved to the custom design, and have run some basic GPIO tests to confirm the C2000 (specifically F280021) on the board is flashing and operating as expected.
    In trying to flash and debug the actual firmware to the design, I receive the following error when trying to write the program to flash:
    Here is the error code copy/pasted:
    C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code 0x00000000, FMSTAT (STATCMD on some devices) 0x00000000). Operation cancelled.
    C28xx_CPU1: File Loader: Memory write failed: Unknown error
    C28xx_CPU1: GEL: File: C:\Users\jssml\workspace_v12\empty_driverlib_project\CPU1_FLASH\empty_driverlib_project.out: Load failed.
    Like I said, I have written simple blink.c programs to flash and have run the debugger no problem. Probing the board I get the expected result. It is just when I try and write the larger program (that worked on the launchpad) that I get this problem.
    Here is a summary of my setup:
    • XDS110 DEBUG PROBE debugger. Ordered directly from TI
    • Flashing and debugging custom design based on F280021
    • Using most recent code composer version (just checked for updates and found none)
    Looking online it seems like it could be some kind of depletion problem, but I have not done anything wild to the controller flash. Only code composer has ever written anything to it. I can write the blink.c program to flash just fine. I have attached my main.c file, my sysconfig file and the target config file.
    Any ideas?
    Regards,
    Danilo
  • This seems to be a FLASH programming issue. Can you create a thread and we can assign it to our FLASH expert?

  • Hi Nima,

    I just received this update from our customer.

    I figured it out. I needed to use the non-default flash linker file for F2800XX ICs and use the one specifically for the F280021, then slightly edit this file to write to all sections of Bank 0 instead of just 1-3. 

    Thank you for your support!

    Regards,

    Danilo