Questions tagged [memory]

Use this tag for memory management or issues in programming.

Filter by
Sorted by
Tagged with
7
votes
3answers
11k views

How much code can an Arduino board run?

I'm getting back up and running with microcontrollers after about 5 years of hibernation time, and I am trying to understand a lot of different things. I have been experimenting with Arduinos for the ...
7
votes
4answers
16k views

Can you access the EEPROM of an ATtiny with Arduino Code?

I'm attempting to reduce the amount of RAM being used by my program by writing some values to the EEPROM of my micro controller. I'm currently programming on the ATtiny85 which has 512 Bytes of EEPROM....
7
votes
1answer
18k views

int VS uint8_t VS uint16_t

This question is quite clear. What are the differences between an int, an uint8_t, and an uint16_t. I know it has to do with bytes and memory but can someone clarify me a bit? Things I want to know: ...
5
votes
3answers
4k views

When to use PROGMEM?

I believe PROGMEM is used to store large data (e.g. strings) that don't change. So it frees up the SRAM. in the Ardunio Reference it is mentioned that. "Using PROGMEM is also a two-step procedure. ...
5
votes
3answers
2k 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 ...
4
votes
2answers
984 views

Locally declared variable takes up global variable space in dynamic memory/SRAM

I'm trying to make my Arduino Uno control the air conditioner by recording the raw IR signal of several of the AC remotes temperatures using AnalysisIR. However these IR codes are quite long (array ...
4
votes
3answers
5k views

Arduino String memory allocation

When a String variable is declared and modified inside a function, where does it go? To the heap(as string declaration is a part of dynamic memory allocation) or to the stack(as it is a part of ...
3
votes
4answers
522 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 ...
3
votes
2answers
476 views

Understanding memory fragmentation due to char arrays in functions

This is similar to: Is this function subject to memory fragmentation? I am trying to get my head around Memory fragmentation in Arduino's and embedded systems in general. Currently I have a ...
3
votes
3answers
2k views

How to remove SD card safely

I’m constructing an arduino based sytem that uses a SD card and I’m looking for a way to safely remove the card from the system during operation. One way would probably be to turn of the arduino ...
3
votes
1answer
87 views

Best way of storing extra data for Arduino project

I am an arduino beginner and I am trying to make a speed camera alert system, it would start beeping if I am above the speed limit and getting close to the speed camera. There is this website where I ...
2
votes
3answers
3k views

Simple memory chip for Arduino?

My basic question is: What is a good alternative to EEPROM chips for external memory on the Arduino Unor R3? I know that there are EEPROM chips when one would like an external memory chip. It, in ...
2
votes
1answer
1k views

What is using up all the RAM in my program?

I am running a program on the ATtiny and for some reason I am way over the 512 bytes of RAM that are available to me. This is confusing because when I did the math by hand I should have 432 bytes. ...
2
votes
3answers
2k views

Spiffs vs Eeprom on esp8266

In my project, i have some data to save permanently. After some research i got many examples and informations to do that with eeprom. I used it effectively. After all i decide to deep dive to esp8266 ...
2
votes
3answers
787 views

Using malloc() and free() for a stack/linkedlist [closed]

I know this question has been asked before, however it was asked two years ago and I have some other constraints to add. (Previous question here) : Is using malloc() and free() a really bad idea on ...
2
votes
1answer
57 views

Branchless programing on arduino?

So I've been looking into branchless programming to speed up code and I'm curious as to how exactly Arduino (or rather atmega328) actually reads machine instructions. Does it have a memory cache or ...
2
votes
1answer
1k views

Does the StringObject.reserve() function prevent memory fragmentation/leaks?

I'm currently writing and testing a professional Arduino application, I'm aware of the dangers of using the String class, so I began to implement C-style strings in some places, but it's just way ...
2
votes
2answers
128 views

How to leak function addresses?

I'm doing some security research on FreeRTOS embedded systems and I don't have much information about Arduino. Is there any way to leak function or variable addresses on serial console? I can use avr-...
2
votes
1answer
1k views

Is the a low memory alternative to SoftwareSerial?

I'm running a program on a ATtiny85 and running into problems because of a lack of available RAM. When I ran avr-nm on my ELF file I found that SoftwareSerial was taking up a lot of RAM even though I'...
2
votes
2answers
1k views

Using SD shield for extra external memory?

I am an Arduino beginner and I am planning to make a musical instrument with it. I want to add record and playback functionalities into the instrument. I figure I will have to store lots of data to ...
2
votes
2answers
570 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 ...
2
votes
1answer
7k views

Using pointers with Arduino

I am learning about pointers. I was wondering how the memory address is defined in programming. I get different outputs depending on the format I choose for memory address. So I was wondering if it ...
2
votes
1answer
47 views

3-instruction remote machine coding Arduino Atmel chip over a serial line from a tethered (host) PC

I'm trying to write a program for AVR Atmel 328 chip on Arduino Nano board that will allow me to send machine code instructions to the chip over a serial line, run/execute them on the chip, and ...
2
votes
1answer
48 views

is PIN To PIN matching mcu against Atmega328P-AU available? [closed]

I want to upgrade my product which is based on Atmega328p-AU, having the problem of programming memory. I don't want to change the PCB of the product. Is PIN To PIN matching MCU against Atmega328P-AU ...
2
votes
1answer
84 views

Which platform is better to debug Arduino memory problems? Linux or Windows?

I am developing a product. I developed every module in the firmware individually. Now I am integrating them but getting memory issues. I am not able to see how the memory is allocated inside the MCU ...
2
votes
2answers
3k views

Update variable using buttons

I made a part of code to change the temperature limit for alarm system. On warm days user have to change the temperature limit with buttons and OLED display. The question is: How can the variable ...
2
votes
3answers
368 views

How do I create global pointers with low memory overhead?

Problem I have a few large objects in my code that need global visibility, but creating them seems to eat up memory significantly faster than simple math would dictate, and furthermore, using them ...
2
votes
1answer
2k views

Global memory reduction when using SPI/SD

I want to use an SD card and when including the library both SPI.h and SD.h are included. Also later I want to use an external SRAM chip (probably using SPI.h as well). However, without the SRAM chip ...
2
votes
1answer
1k views

Arduino Nano memory issue. SD card and LCD screen together

When i am uploading my code to arduino nano, i am getting message about high dynamic memory usage (87%): Sketch uses 17,628 bytes (57%) of program storage space. Maximum is 30,720 bytes. Global ...
2
votes
0answers
159 views

why is memcpy of unsigned long killing my sampling speed?

I'm using a Mega 2560 to communicate with a mixture of analog (i.e. measured via analogRead()) and I2C based sensors. Sampled data is placed in a 16 byte array, then written to an SD card once a 512 ...
1
vote
2answers
2k views

Most memory efficient way to program

I currently know 3 ways to do a program. Which one of them is the most memory friendly. Note that the example code is simple (blinking a led) and the final code will be VERY VERY complex. Also, the ...
1
vote
3answers
122 views

SoftwareSerial runs out of “text” space on ATtiny

I have an ATtiny and am trying to send a very large byte array stored in a separate .h file over SoftwareSerial: for (int i=0; i<numElements; i++) { softSerial.println(myList[i]); } I imagine ...
1
vote
2answers
1k views

Const data optimisation for Arduino

I'm taking a course on Arduino Uno programming and on today's talk I heard that the const data is optimized by Arduino, so that it occupies less space than the actual data type (namely, a const int ...
1
vote
1answer
588 views

EEPROM - Storing Static Data

I'm trying to store four items to EEPROM. I can do one item no problem, I just don't know how to make the jump to multiple items. My code: #include <EEPROM.h> char sgrpID[31] = "acpilot's ...
1
vote
2answers
243 views

Arduino write to memory and self shut down (over MOSFET) - An idea help

i would like to ask you for help with design of an circuit. I have and atmega328p, with detection for voltage on its Vin (Vcc). I have made and voltage divider and its output i connected to Analog ...
1
vote
1answer
84 views

Is there a way to “list” (in BASIC, or “cat” in LINUX) the current sketch loaded in my xxxDUINO? [duplicate]

I was surprised when I couldn't find an old post where someone asked this question. Seems like a natural beginner, uh excuse me, "newbie" question, but then I'm a throw-back to the days when a home ...
1
vote
3answers
3k views

Is there any way I can connect the RAM of a computer to Arduino?

I was thinking about a way to reuse the RAM of my old computer on my Arduino board. I was thinking about some peojects using neural networks, and more RAM would let the Arduino use more neurons. So ...
1
vote
1answer
2k views

Arduino Memory Best Practice

So I have been diving deep into AVR programming and have seen several different ways of defining constants. I know that some of these methods are from "C" and others are from more modern "C++" methods....
1
vote
2answers
115 views

Possible to determine at runtime whether a pointer is declared PROGMEM?

Is it possible to determine at runtime whether a pointer points to PROGMEM'ed values or regular values? This would give some flexibility when writing code that handles both.
1
vote
1answer
121 views

AVR & PIC 8-bit Microcontrollers - Can you add: external flash memory, external RAM, video & audio output, more address busses?

so I was planning on creating a mini PC out of basic ICs and 8-bit microcontrollers such as ATTinys and/or PICs and I have several questions regarding those: Can you add external RAM, say with SRAM, ...
1
vote
1answer
483 views

Is it possible to read-write the memory of a Gikfun ISD1820 voice recording module?

I just got a Gikfun ISD1820 voice recording module for an Arduino project that I'm working on. I want to be able to record a few seconds message and then send the message over wifi to another Arduino ...
1
vote
1answer
22 views

Recording of sensor results but only retain the last 3 sets of data

I'm doing a radiation-seeking robot, which will find the source of the radiation autonomously. But in this case, my robot will spin 180 degrees to detect the nearest source of radiation and 1 set of ...
1
vote
1answer
479 views

Arduino eeprom_put sketch writes data in two locations?

Using precisely this code - the eeprom_put example in the Arduino IDE, and am seeing some strange results... The sketch does write correctly to eeAddress = 0, and the corresponding eeprom_get sketch ...
1
vote
1answer
2k views

Writing to a SPI memory

Recently I salvaged a BIOS chip (EN25QH16) which has 2 Megabytes of memory (8192 pages, 256 bytes/page). I followed this instructables and it works. I double checked the opcodes because the code is ...
1
vote
3answers
164 views

How to save data in arduino when it's power goes off

I am doing a project 'arduino based switch operation'. Here the user needs to set a time to turn on relay and set time to turn it off. The problem is that I want to supply power to arduino using ...
1
vote
1answer
92 views

Reduce Sketch Size Help!

I dont know what to do? Sketch uses 3712 bytes (12%) of program storage space. Maximum is 30720 bytes. Global variables use 210 bytes (10%) of dynamic memory, leaving 1838 bytes for local variables. ...
1
vote
1answer
91 views

Arduino Program Memory Ran Out

I have a Arduino sketch I made and I have run out of dynamic memory on my Arduino Nano. How could I possibly reduce the amount of memory the program takes? (I'm not that good at this stuff) P.S: The ...
1
vote
2answers
369 views

Expand Arduino storage without an SD card [closed]

I'd like to have my Arduino write some files and store them somewhere. They won't be big files, but the 1Mb available on the device won't be enough. I know an SD card is the popular solution, but the ...
1
vote
1answer
56 views

Runtime Error when using array of structs of unknown size as variable within class - some kind of overflow issue?

I have a class defined as below, it's basically a simple ring buffer, with some methods for getting useful statistics from the data held in the buffer. enum BalanceMsgType{ BAL_MSG_NOT = 0, ...
1
vote
1answer
1k views

Storing data on AT24C02 EEPROM chips with Arduino

I have recently come across some 8-pin 128-byte EEPROM chips. I've seen those USB EEPROM chip programmer units, but I was wondering if there is any way I could manually store data on the chip with my ...