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:
#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:
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