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.

CCS/LAUNCHXL-F28377S: How to use memory RAM & Flash to record data at maximum sampling rate ?

Part Number: LAUNCHXL-F28377S

Tool/software: Code Composer Studio

Dear sir,

I am using TI Launchpad F28377S in the project of Structural Health Monitoring. In which I want to record data at the highest sampling rate of ADC (which is 3.5MSPS at 12bit resolution) of 2000 points (i.e. for 2000/(3.5*10^6)=0.571msec). Now I am using the default example program from controlSUITE "adc_soc_continuous" to sample this data. And the problem is that when i use this program to sample 1504 samples with "2837xS_Generic_RAM_lnk.cmd" linker command file it works but for 2000 samples it shows errors as shown in attached img. but same code with "2837xS_Generic_FLASH_lnk.cmd" works good but sampling rate reduces this may be because writing in flash memory requires more time than writing in RAM.

Again I want to sample such data for 16 times and do the averaging of the sampled data. So may be i need to sample this data in RAM and then copy the same array in Flash memory & do this for 16 times and then average it. But I don't know how to write such a program or which linker command file should be used. Also, i tried creating array of 2000 Uint16 points using the flash linker command file i.e."2837xS_Generic_RAM_lnk.cmd" and when i create more than 3 such arrays it shows the same error as shown in image.  

So, whats exactly the problem is? because to store 2000 points i need a memory of 2000*16=32000bits=32000/8*1024= 3.90625 KB  and for 16 such arrays 3.90625*16=62.5 KB. But this device has 1 MB flash and 128 KB RAM so what is the exact problem. Is am i doing anything wrong? I am following all the steps as mentioned in "file____C__ti_controlSUITE_device_support_F2837xS_v210_doc_F2837xS-FRM-EX-UG.pdf" document to setup properties and linker command files.

Again I am beginner with Launchpads previously I used Arduino boards. So please consider if I am asking some very basic questions. & please help me understanding Launchpad

Thank You 

Mandar Kothavade

  • Hi Mandar,

    The largest contiguous chunk of RAM on the device are GS RAM banks 0 to 15. Each is 4K x 16, so I think you should have enough space there to store all your captured data.

    Create a named RAM section:
    // buffer for storing conversion results
    #define RESULTS_BUFFER_SIZE 65536
    Uint16 resultArray[RESULTS_BUFFER_SIZE];
    #pragma DATA_SECTION(resultArray, ".ADC_RESULT_TABLE");

    Then edit the linker command file to place this named section into a specific chunk of memory:
    SECTIONS
    {
    ...
    .ADC_RESULT_TABLE: > RAMGS, PAGE = 1
    }

    Note that here I redefined 'RAMGS' to be one chunk that spans all 16 GS blocks:
    PAGE 1 :
    RAMGS : origin = 0x00C000, length = 0x010000
    //RAMGS0 : origin = 0x00C000, length = 0x001000
    //RAMGS1 : origin = 0x00D000, length = 0x001000
    //RAMGS2 : origin = 0x00E000, length = 0x001000
    //RAMGS3 : origin = 0x00F000, length = 0x001000
    //RAMGS4 : origin = 0x010000, length = 0x001000
    //RAMGS5 : origin = 0x011000, length = 0x001000
    //RAMGS6 : origin = 0x012000, length = 0x001000
    //RAMGS7 : origin = 0x013000, length = 0x001000
    //RAMGS8 : origin = 0x014000, length = 0x001000
    //RAMGS9 : origin = 0x015000, length = 0x001000
    //RAMGS10 : origin = 0x016000, length = 0x001000
    //RAMGS11 : origin = 0x017000, length = 0x001000
    //RAMGS12 : origin = 0x018000, length = 0x001000
    //RAMGS13 : origin = 0x019000, length = 0x001000
    //RAMGS14 : origin = 0x01A000, length = 0x001000
    //RAMGS15 : origin = 0x01B000, length = 0x001000

    Note that you don't have to combine all the blocks in your case because I think you only need about half of the blocks.

    If you want multiple arrays, you can make multiple data sections and then assign them to the same combined block.
  • Dear Devin,

    Thanx for your reply. & Apologies for very late reply from my side(Actually i gotup with something in my life )

    So, Does it means i need to specify everytime in the programm & linker command file where my data should be stored(using the procedures as shown by you)? Dont we have any other way to do this or may be memory allocation done automatically by compiler? what about .ebss(which stores uninitialized data) section in linker command file what if I changed following, its working but what are the effects if any?
    //.ebss : >RAMLS5, PAGE = 1
    .ebss : > RAMGS, PAGE = 1
    this procedure may avoid the use of pragma.

    Another thing when i write a program into ram it stays there for one single time. Once i powered off or reset the device. it vanishes (Obviously this is because RAM keeps only temporary data ). So there is need of storing data and program into flash as i need a permanent program. And I need ADC sampling rate maximum which works only with RAM. So whats the way of doing this?

    I checked with the default linker command files for flash memory i.e. "2837xS_Generic_FLASH_lnk". It also uses RAM sections for uninitialized data (i.e. .ebss). So, I think reason for slowing down the speed of ADC when using with flash linker command file is not because of delay in writing of captured samples to memory (as it is using RAM sections only) rather it may be because of fetching programs from flash memory. Can you please clear this thing to me? I am confused in this, why ADC gets slow down when i run program using flash linker command file.

    Again apologies for late reply & silly questions if any.

    Thanks for helping me understand Launchpad and showing new ways of doing things.
    Mandar
  • Hi Mandar,

    You do not have to use a named data section to place a large data structure in memory. I usually like to create a section for anything that is larger than 1K or so to ensure that it starts at a nice round address so that it is easy to examine in the memory browser.

    You can, as you suggest, just let the linker assign the structure wherever there is space. You will, however, still have to manually ensure that there is a sufficiently large enough memory block (or combination of blocks).

    Code execution from Flash memory will be slower than RAM, since it is not 0-wait state memory. This is especially true if there are many branches (e.g. a tight inner loop or ISR) because there is a pre-fetch buffer that speeds up execution of linear code from Flash.

    For ISRs, inner loops, and any other time-critical code, you can store the code in flash but copy to RAM on power-up and execute from RAM. Search for "ramfuncs" in the e2e forum and TI documentation to understand how this is accomplished.