Photon 2 - PSRAM overflow

I’m hoping someone with more knowledge of this platform can save me from banging my head against my desk over this one :slight_smile: .

Particle Photon 2. Project deployed as a Particle library. After importing the library and copying the “examples/particle_microphone/main.cpp” code into “src/main.cpp” exactly as is and compiling/flashing, everything looks to be OK.

But, I need to make some changes to the code to make it useful for my purposes. Any minor change seems to result in a PSRAM overflow, however. For example, simply adding:

pinMode(D7, OUTPUT);

to the setup() function results in:

… visual_alerts_inferencing_fi.elf section .psram_text' will not fit in region PSRAM’
… arm-none-eabi/bin/ld: region `PSRAM’ overflowed by 4 bytes

Any thoughts on how I can extend the example code without running into this?

Thanks in advance!

Project ID:

Context/Use case:
Classify audio from supported PDM mic.

Hello @nickbild,

I don’t see anything odd in your project.
I have asked our embedded engineers to have a deeper look at your issue, we will come back to you asap.



Hi @nickbild,

This is known issue in the Particle build system. Which version of deviceOS are you using? The latest 5.4.1 should fix this.


Thanks @louis and @Arjan! Glad to hear it’s not something I was doing wrong.

I had tried 5 deviceOS versions: 5.0.0, 5.3.0, 5.3.1. 5.3.2, and 5.4.1.

With 5.4.1, it does compile and flash, however, I get no serial output (which is where the predictions are printed). To test if if was just a serial problem or something more, I added this:

pinMode(D7, OUTPUT);

to setup(), and this:

digitalWrite(D7, LOW);

to the beginning of loop(). D7 is connected to the onboard LED, so it should turn off, but it does not, so it seems that something has failed silently, and the impulse is not actually running, despite compiling and flashing fine.

5.3.2 does the same. 5.0.0, 5.3.0, and 5.3.1 compile and produce serial output, however, if I make any changes whatsoever, I get a PSRAM overflow, so I can’t customize them.

Hi @nickbild,

I’ve been trying today to fix the serial on version 5.4.1, but without success unfortunately. We will need more time to figure this out.

In the meantime I have a workaround for version 5.3.2 to get rid of the PSRAM & SRAM 4 bytes overflow error. In the installed Particle SDK (located in your root folder) open following file ~/.particle/toolchains/deviceOS/5.3.2/modules/shared/rtl872x/

Replace lines 38 and 39 with following lines:


This adds 20 bytes of extra alignment instead of 16.

Clean the project and rebuild again.

Let me know if this works.


Thanks @Arjan, I appreciate the quick response!

I ran a few quick tests, and I think that your workaround will get me by (using 5.3.1) for this project.