Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

TMS320F28379D: Hish Speed SD Card Data Logging

Part Number: TMS320F28379D
Other Parts Discussed in Thread: CONTROLSUITE

Hello,

We are developing a Control Board based on TMS320F28379D. We need high speed data logging. What I mean by high speed is to write about 20 signals (each a word size) in CSV format in about 20 micro-seconds. I was looking at the reference manual and there is a high speed SPI communications mode. But I am not able to find any example that writes to CSV. Also, given that its a high speed data logging, I want to split the files into n MB size. So, basically, after writing m Samples which is equivalent to n MB file size, I want to close the old file, open new one and start data logging on to the new file. The catch is that I cannot miss any samples during this transition. I plan to use DMA.

I am new to C2000 and I am also a newbie for high speed data logging and file system. Any insight is appreciated. Please advise. I thank you all for your time and help.

Regards,

Archit

  • Archit,

    In ControlSuite, there is an example to create a FATFS file system with SPI on an SD card. this is located here: C:\ti\controlSUITE\device_support\F2837xD\v190\F2837xD_examples_Cpu1\sd_card

    Please read/understand/try out the example. If you have any trouble getting the example to work. let us know.
  • Hello,

    Thank you for your message. So, I was able to write to the SD Card in CSV format. How ever its extremely slow and I am not able to understand the reason and what can I modify to fix the issue. The requirement is to write about 24 floating point numbers to the SD Card every 50 micro seconds. However, CPU takes about 20 micro seconds to compute those numbers and so essentially CPU shall not take more than about 25 micro seconds to write 24 floating point numbers to the card. Below is the sample code that I have been using.

    f_open(&g_sFileObject, "0:/Message.csv", FA_READ |  FA_WRITE |  FA_OPEN_ALWAYS );
    ReadCount = 512;
    size = (&g_sFileObject)->fsize;
    
    ////////////////////////////// SECTION 2 //////////////////////////////////////
    
    fresult = f_lseek(&g_sFileObject,size);
    f_write(&g_sFileObject, "1000.00,1001.00,1002.00,1003.00,1004.00,1005.00,1006.00,150,151,152,1,10000,10001,10002,360.1234\n", sizeof("1000.00,1001.00,1002.00,1003.00,1004.00,1005.00,1006.00,150,151,152,1,10000,10001,10002,360.1234\n"), &Count);
    f_sync(&g_sFileObject);
    
    ////////////////////////////// END SECTION 2 //////////////////////////////////////
    
    f_close(&g_sFileObject);
    

    So, basically the code enclosed in "SECTION 2" has to occure every 50 micro seconds. Using the clock tool in Debug Mode, I tried to calculate the ticks and it turns out that the logic in "Section 2" takes about 5 milli seconds. I then tried to dubug the code even further and here is what I found:

    1.) f_lseek takes about 2 milliseconds

    2.) f_write actually only takes about 10 micro seconds. (And I have not even enabled FIFO and DMA)

    3.) f_sync takes about 2.9 milliseconds.

    So then I tried not to use f_sync to reduce the time, but if I dont execute it every cycle, data is not being written. And for the f_lseek function there is a f_read statement which takes all the time. And so, I tried to comment out that statement and data is not being written then. So, it seems that I am stuck now and have no idea what can I do to achieve the requirement.

    Please provide some insight on what and how to modify the code to make the timing achievable and reliably perform data logging. Also, at this point I am converting all the floats to string using "ltoa" and thats an inefficient way to do the data logging. Suggestions please.

    I thank you all for your time and appreciate your help.

    Regards,

    Archit