Interpreting RAM test results after adding memory

Odobenus

New member
I soldered 2 - 8MB APS6404L-3SQR QSPI PSRAM chips to my Teensy 4.1. Since I have never soldered a SMD before I ran the memory test (teensy41_psram_memtest.ino from https://github.com/PaulStoffregen/teensy41_psram_memtest) and got:

Memory Usage on Teensy 4.1:
FLASH: code:28100, data:7064, headers:8864 free for files:8082436
RAM1: variables:7680, code:25432, padding:7336 free for local variables:483840
RAM2: variables:12384 free for malloc/new:511904

I don't understand these results both RAM1 and 2 are 524,288. I was expecting 67,108,864 or 8,388,608. Did I do the test wrong or install the memory wrong?

Thank you,

Vincent
 
Those printed results are showing memory use and allocation of internal RAM - there are two blocks of 512 KB.

If PSRAM memory is present it is detected and prepared for use only at run time.

In that sketch follow the use of: extern "C" uint8_t external_psram_size;

On reset it will be set to one of [ 0 or 8 or 16 ] based on the startup code finding the PSRAM to be present.

Running the sketch will test the found memory:
0: halt - nothing to test
8: test 8MB
16: test 16MB
 
I don't understand these results both RAM1 and 2 are 524,288.

That's not the test result.

To see the test result, after uploading you need to open the serial monitor. If you didn't select the proper port before uploading, you need to select it first with Tools > Port. Uploading can automatically find your Teensy (but if you have more than 1, which it finds is pretty much random), but the serial monitor needs the port selected to work.

The test result should look like this screenshot from the PSRAM page.

teensy41_memtest.png
 
To explain further, that info you're seeing is a summary of the anticipated memory usage of the program you've just compiled. This is before the program runs on your Teensy hardware. It's just info about the file on your PC. You'll always see that info when compiling any program, even if no Teensy is connected to your computer.

It's just a very basic summary of what is known about your program before it ever runs on the real hardware. It can only know about the variables your program has created before it runs. Those are the global or static variables. When your program runs, local variables are created as each function starts. Your program can also use malloc() or C++ new to dynamically allocate chunks of memory as it runs. The basic summary can't know in advance how much your program will really use. That's why it just tells you how much of each memory is left over from that type of usage.

But the important concept is this memory summary is just info about what your program is expected to do before you run it. To actually test the memory, you need to actually run the memory test program and view its result in the serial monitor.
 
Thank you very much.

>> Test ran for 73.14 seconds
>> All memory tests passed :)

Whoops, I thought the pane at the bottom was the serial monitor, I'm a circuitpython user and in the Mu IDE the split window at the bottom is the serial monitor.
 
Back
Top