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.

Compiler/TM4C1290NCPDT: How much RAM can I use to save off data

Part Number: TM4C1290NCPDT

Tool/software: TI C/C++ Compiler

All, 

I have the following requirement.

  • Purpose is to continuously turn on and off  a device controlled by the micro-controller. An ON cycle is 2 seconds and an OFF cycle is 2 seconds. a 32-bit integer must be saved to RAM at the beginning and the end of the ON cycle. This must happen for ever. The values will be printed on demand.
  • My question is how many of those 32-bit integers can be saved? What happens when I run out of RAM?
  • Any ideas on how to best implement this requirement?

  • Hi Haroldo,
    Are you saving a different 32bit value to the RAM for each ON cycle? The on-chip RAM is limited and it will eventually run out. The RAM is also used to store the stack and other variables declared by your application.
    Not sure what your application is. Why do you need to save the entire history of all the 32-bit integers?
  • Thanks Charles for your quick reply.

    I'm actually saving 3 different 32-bit values for each ON cycle. A cycle last 2 seconds. One 32-bit value is saved at the beginning, another 500ms into the cycle and a third at 200ms.

    It is a requirement that I save the entire history of all 32-bit integers. How do I compute how many of these 32-bit values can be saved before I actually run out of RAM?
  • Hi,
    I will suggest you look at the .map file to see how much of the SRAM is used and unused. Below is only an example. Three 32bit integers takes up 12 bytes and you only have 256k of RAM. No matter how big the SRAM, you will eventually run out of it. You may want to explore saving the data to some external memory device if your application requires you to save all data. However, there is also limit on how many you can save onto an external device. Again, not sure why all data must be saved. Can you not save the data of the last 1 minute or last one hour only?


    ******************************************************************************
    TI ARM Linker PC v16.9.4
    ******************************************************************************
    >> Linked Fri Apr 13 16:31:09 2018

    OUTPUT FILE NAME: <enet_lwip.out>
    ENTRY POINT SYMBOL: "_c_int00" address: 0007a049


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    FLASH 00000000 00100000 0007b94e 000846b2 R X
    SRAM 20000000 00040000 00018374 00027c8c RW X


    SEGMENT ALLOCATION MAP

    run origin load origin length init length attrs members
    ---------- ----------- ---------- ----------- ----- -------
    00000000 00000000 0007b950 0007b950 r-x
    00000000 00000000 00000200 00000200 r-- .intvecs
    00000200 00000200 0006dae8 0006dae8 r-- .const
    0006dce8 0006dce8 0000dc06 0000dc06 r-x .text
    0007b8f0 0007b8f0 00000060 00000060 r-- .cinit
    20000000 20000000 00018374 00000000 rw-
    20000000 20000000 00017af0 00000000 rw- .bss
    20017af0 20017af0 00000800 00000000 rw- .stack
    200182f0 200182f0 00000084 00000000 rw- .data
  • Thank you Charles,
    Alternatively, I was considering writing these values to a file. Do you have any examples of saving values to a file from this microcontroller?
  • Would NOT: ... ( (Total MCU RAM (bytes) - RAM Safety Reserve (bytes: stack + vars + other) ) / 4 (4 bytes w/in each 32-bit integer) yield your result?

    You seek to 'SAVE the entire history' - yet choose a, 'HIGHLY VOLATILE' - and  severely size-limited medium (SRAM) - which places that 'ENTIRE HISTORY' in GREAT Jeopardy - does it not?

  • Hi,
    You can take a look at the sd_card example under <TivaWare_installation>/examples/boards/dk-tm4c129x/sd_card. The sd_card example demonstrates accessing a file system from an SD card. It makes use of the FatFS.