Questions tagged [flash]

Flash memory is a type of memory available on the Arduino boards. It can be accessed from a program using PROGMEM directive to store data. For questions about using and accessing flash memory, use this tag.

Filter by
Sorted by
Tagged with
30 votes
4 answers
80k views

What can I do if I run out of Flash memory or SRAM?

According to the Arduino documentation, the ATmega328 has 32KB of Flash memory for the bootloader + uploaded sketch, and only 2KB SRAM for runtime data. The ATmega2560 has quite a bit more, totalling ...
Peter Bloomfield's user avatar
15 votes
6 answers
69k views

How do I erase the memory of the Arduino Uno?

I'm just a tinkerer learning Arduino with my son and I was surprised that when I plugged the USB cord back in to the Arduino the program was still running and I thought to myself, "it's a good thing I ...
Peter Turner's user avatar
9 votes
3 answers
10k views

PROGMEM: do I have to copy data from flash to RAM for reading?

I have got some difficulties understanding the memory management. Arduino documentation says, it is possible to keep constants like strings or whatever I don't want to change during runtime in ...
Ariser's user avatar
  • 567
8 votes
2 answers
6k views

Is it possible to run a binary from EEPROM?

Say I wrote a compiled sketch to EEPROM then read it. Could I run the program from EEPROM? I guess the question is: Can an Arduino run software not in flash memory in the middle of executing the ...
Piper McCorkle's user avatar
8 votes
4 answers
5k views

Where can I find out how to make a hex file for arduino firmware?

I have followed this tutorial on flashing my Arduino R3 to turn it into a "USB keyboard", but the article doesn't explain how the hex works, it's just for granted. Where can I learn about how to make ...
trusktr's user avatar
  • 181
6 votes
5 answers
5k views

What happens if you write >10000 times to the flash memory of an ATmega?

I realized that I'm uploading code every 5 minutes and doing relatively intensive trial-and-error development, and that this habit could cause problems down the road, especially if I'm working on a ...
user8437812's user avatar
5 votes
4 answers
1k views

How can a function/method determine if a const array passed in is PROGMEM (flash) or not (RAM)?

Is it possible for a function/method to know if a constant array that has been passed in is in flash or RAM? If I have a method or function that receives a constant array that is in RAM, the array is ...
Casey's user avatar
  • 151
5 votes
3 answers
4k views

Set EEPROM from PC before program

I have been working on an arduino program, which has gotten rather large. I am close to hitting the 32k limit on Flash for my ATmega328p. I would like lower my program size by saving some of my many ...
riverrun's user avatar
5 votes
2 answers
1k views

What are the FLASH_ARRAY/FLASH_TABLE macros in this code?

In this code for heating monitor, there appears to be macros called FLASH_ARRAY and FLASH_TABLE. I can't find any reference to them either in this code, Arduino, or on the Internet. What do they do? ...
Cybergibbons's user avatar
  • 5,290
5 votes
2 answers
11k views

Using PROGMEM to store array of structs

I am hitting the limits of my arduino's SRAM and found that SRAM usage can be reduced by storing static stuff in flash memory instead of SRAM. My project can (optionally) be built with an included ...
Alex's user avatar
  • 181
5 votes
2 answers
2k views

Store floats in and reading them from flash

How do I store floats in flash and how do I read them from there? (I need a look-up table for pairs of float values.) The storing part doesn't seem to be so difficult as this compiles: PROGMEM float ...
fuenfundachtzig's user avatar
5 votes
3 answers
3k views

External Flash Memory File System

I'm building a weather data collector and I want to be able to dump that weather data somewhere. I've considered the options, and since I'm going to be storing a fairly small amount of data (in the ...
Carrot M's user avatar
4 votes
3 answers
3k views

Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?

In STM32 microcontrollers it is possible to use a technique that ST calls IAP, or In-Application Programming, in order to write to the Flash memory from your running application. They even have a nice ...
Gabriel Staples's user avatar
4 votes
2 answers
1k views

What programming practices should be adopted while coding sketches for Arduino?

What are some of the best programming practices that can be adopted while coding sketches for Arduino, so that it uses the least memory and performance should not suffer from memory outage, and still ...
Ciasto piekarz's user avatar
4 votes
3 answers
6k views

How to read/write variables persistenly on Arduino Due (no EEPROM/shield)?

I am relatively new to Arduino and I am currently writing some code to control a relay board. The on/off times are provided by the user at run-time and should be stored persistently (EEPROM or flash) ...
SCBuergel's user avatar
  • 143
4 votes
1 answer
2k views

Flash String Helper object as variable

So I have a Bunch of commonly used char arrays to build commands in my library. So to preserve memory, I have them put into flash, via PROGMEM ext, typedef const char PROGMEM ProgChar; ProgChar AT[] =...
Steven Venham's user avatar
4 votes
1 answer
681 views

Flash Arduino Due via UART

I would like to write code in Arduino language, compile it in the Arduino IDE, grab the resulting binary code, and flash it to the Due via the TX/RX UART pins, bypassing both the USB Programming Port ...
fillybrese's user avatar
3 votes
1 answer
283 views

Can I force a function to live in the boot sector without overwriting the bootloader?

Not for any practical purpose but just out of curiosity, I want to abuse the flash memory and write it dynamically at run-time. This is, in a sense, what the bootloader does. If I understand it, the ...
Michael Stachowsky's user avatar
3 votes
1 answer
283 views

Extend program space by getting rid of bootloader on NANO

I just have a complex program that runs on a NANO. Now when I use my printlns for debugging I am running out of memory. I read about using a programmer to get rid of the bootloader that uses 2K space ...
GeKu's user avatar
  • 33
3 votes
1 answer
2k views

Flashing an ATtiny85 with a NodeMCU?

I recently purchased a Digispark for some of my smaller electronics projects. After it initially being a great little board, I soon found myself unable to flash the board in the same way I had done ...
Rocco's user avatar
  • 165
3 votes
3 answers
4k views

Trying to flash ESP8266 with Arduino UNO

This is my first project other than some of the starter projects. I am trying to flash the firmware onto an ESP8266 wifi module using and arduino uno. It would be nice to know if anything is wrong/...
ewizard's user avatar
  • 173
3 votes
2 answers
3k views

Arduino EEPROM retains old data after flashing with a new program

I have a custom 5V 16Mhz Arduino Uno (a breadboard Uno of sorts) that runs the grbl firmware. After the initial flashing I can see all the settings (through the serial monitor) and everything works. ...
electrophile's user avatar
3 votes
0 answers
387 views

Software flashing attiny167 from RPi with avrdude

I am trying to flash a program onto an attiny167 (already bootloaded with the micronucleus bootloader) with a Raspberry Pi via avrdude and USB. Background I have 50 Raspberry Pi 3B's connected to an ...
AidenRay's user avatar
2 votes
2 answers
932 views

EEPROM.get returns bad data

I am using the attached code. What I am trying to do is: Test if there is a personalized "board serial number" written in the EEPROM (by previous code run) If data found was not 7 characters (e.g SN-...
adrianTNT's user avatar
  • 242
2 votes
3 answers
3k views

Wrong data from DS18B20 temperature sensor after long power off

I have my Arduino Uno connected to the PC via USB when prototyping. I am developing a thermometer with memory, using DS18B20 sensors. When PC is shut down, there is no power on the USB and the ...
Suma's user avatar
  • 341
2 votes
3 answers
2k views

Arduino Nano 33 BLE - use of flash to store data; how to expand a piece of sample code

I've been looking into how to store data in between restarts. With an Arduino UNO, there are plenty of EEPROM libraries, but I'm not finding something 'off the rack' for the Arduino Nano 33 BLE. I ...
asylumax's user avatar
  • 239
2 votes
2 answers
217 views

How .data + .text section can be = How much flash the final program will consume

I could not understand one point related with Arduino code. Let's say i have following code void setup() { Serial.begin(9600); Serial.println("foo"); } void loop() { } When i ...
embeddedstack's user avatar
2 votes
1 answer
387 views

AVR-GCC can't call function located on fixed address

I wrote the following code: #include <avr/io.h> __attribute__((noinline, section(".app_start"))) void app_start() //app_start section starts at 0xFA0 { //register_packet_dispatch(...
Dankó Dávid's user avatar
2 votes
1 answer
759 views

What protocols and tools does Arduino Due use for flashing and debugging?

I am interested in writing a simple C program outside of the Arduino IDE and respective libraries, but deploying it directly to an Arduino Due (which uses a SAM3X8E ARM MCU). I am trying to figure out ...
smeeb's user avatar
  • 499
2 votes
1 answer
61 views

Is it possible to execute a code in runtime when gets updated over the air (OTA)?

I would like to build a lib like ArduinoOTA but with no downtime at runtime. To achieve that I am wondering if it is possible to create a simple setup and loop code to Check for new releases If we ...
marquesm91's user avatar
2 votes
3 answers
4k views

External Flash Memory for ATtiny85

I'm designing a lightweight circuit, but the ATtiny85 micro-controller I'm using to power it doesn't have nearly enough flash memory to store the code for the devices I'll have hooked up to it (It has ...
Prince_Saturn's user avatar
2 votes
1 answer
8k views

String to persistent memory (EEPROM?)

I am creating a server node that I want to be able to save the wifi SSID and the password into persistent memory so that when it starts ups it can connect to the network. I have looked for several ...
Michael Artman's user avatar
2 votes
1 answer
164 views

Arduino does not boot when SPI lines are loaded

i connected an Arduino Nano to an external SPI Flash using THIS tutorial (russian) and the SPIMemory library. While accessing the Flash works well, i have encountered the following issue: The Problem: ...
Sabulanis's user avatar
2 votes
2 answers
2k views

ESP8266 seems to be bricked , how to recover?

In a part of my sketch I put by mistake pinMode(7,INPUT_PULLUP); Which is dedicated pin for external flash chip (gpio7/SDIO_DATA_0/SPI_MISO) that not supposed to use for sketch. after uploading ...
saif's user avatar
  • 21
2 votes
1 answer
1k views

Better method for PROGMEM data access with multiple indirection?

-edit- This is a simplified recreation of personal learning project I have ongoing. My issue is in accessing data in flash, the path to which includes multiple layers of indirection. When the data ...
W. Barber's user avatar
2 votes
2 answers
484 views

How do I implement a userspace bootloader on Arduino Due?

Is it possible to use a custom bootloader, that loads and executes a main program stored for example on an SD card? The idea is to make it possible to update the Arduino remotely. I tried this with a ...
pguenther's user avatar
2 votes
1 answer
33 views

Micropython installation on Arduino nano

I am currently trying to use micropython on an arduino Nano 33 BLE using MacOS. Following the instructions from arduino website I was able to complete steps 1-3. At step 4, I can find the bossac file ...
Saif's user avatar
  • 21
2 votes
0 answers
73 views

Reading and writing to GD25B32CPIG flash memory

I recently removed a GD25B32CPIG flash memory chip from a commercial coin-operated arcade game. Apparently it has all the game's sounds stored directly on the chip. I decided to see if I can learn to ...
Ben Stafford's user avatar
2 votes
0 answers
430 views

How to adjust Partition Scheme Wemos D1 mini pro?

I bought myself a WEMOS D1 mini PRO (16MB) for creating a quite large project. As I'm writing code, my memory is starting to grow. When I looked at the Flash size in Arduino IDE, the only options I ...
Jens Vanhulst's user avatar
2 votes
0 answers
4k views

ESP-01 not running custom firmware

I have two esp-01 micro controllers that I'm trying to flash using the Arduino IDE but found some problems in the process. I followed step 1 of this tutorial to install all the dependencies to the IDE....
user avatar
2 votes
0 answers
129 views

Erasing all flash on boards with over 64kb of program memory

I'm using a Mega2560 board. My project needs to store some large constant data. To preserve the first 64kb flash chunk, I write these data on addresses beyond this limit. But there is either an ...
angelo.dev's user avatar
2 votes
0 answers
140 views

In-application programming for the Arduino Uno

I would like to know if it is possible to read from and write to the microcontroller's (Arduino Uno's ATmega328P) flash memory using a program or "bootloader" previously stored in the flash memory (or ...
user21506's user avatar
1 vote
1 answer
892 views

Executing machine code at runtime Uno

I want to create a small single threaded os for my arduino.The first thing I want to do is to allow my arduino to read a section from flash/eeprom and execute it. I have some question regarding the ...
sergiu reznicencu's user avatar
1 vote
1 answer
158 views

How do I get the size of my program at runtime?

(This question is specific for the Arduino Due, but maybe there's a general answer to the question) I'm using DueFlashStorage to store application data in the flash memory of my Arduino Due. That ...
PMF's user avatar
  • 1,218
1 vote
2 answers
285 views

Is there a good reference for Arduino Due memory architecture and usage?

It's been harder than I expected to find a reference source or usage guide. There's a number of sources I've looked at along the road to this question: The Due is listed here and here as having 512KB ...
RowanP's user avatar
  • 851
1 vote
1 answer
148 views

Reading & writing a configuration file on an Adafruit Circuit Playground Express

I would like to store an application's configuration in a file stored on the Circuit Playground Express (CPX) flash. The application itself needs to be able to update the configuration file. Things I ...
user3308886's user avatar
1 vote
1 answer
1k views

ESP32: best way to embed certificates

I'm using the Arduino framework on an ESP32 based board. The board has an SD card slot, but I'm not going to use it. Anyway, I need to store somewhere the certificates. To the the firmware I've just ...
Mark's user avatar
  • 357
1 vote
1 answer
2k views

ESP8266 OTA update with different flash size settings?

I have an ESP8266 in a project. It's specifically this ESP8266 SMT Module - ESP-12F item. It's been working great with OTA, but I realized belatedly that I didn't change the flash settings when I ...
Brick's user avatar
  • 174
1 vote
1 answer
4k views

Reading contents of ESP8266 Flash from inside sketch

I am aware that there is a way to create a dump of the flash via esptool, but is there a way to read the contents of the sketch (just the sketch, not the full flash or SPIFFS) memory via the sketch ...
user avatar
1 vote
2 answers
190 views

Unusual use of << operator... not a bit shift?

Poking through the example code of SDFS, I saw the following: static ArduinoOutStream cout(Serial); // F stores strings in flash to save RAM cout << F("\ntype any character to start\n"); What ...
Bo Thompson's user avatar