7
votes
Serial printing from flash memory (F() macro, PROGMEM, sprintf_P, SPTR)
First, the freeMemory() function that you used from Adafruit was originated from a GitHub repository.
With the code related to the __arm__ implementation aside, for the code related to the AVR, it is ...
6
votes
Accepted
Is there a way to add external RAM (let's say 100 MB or 200 MB) in this audio buffer mixing context?
There are SRAM ICs / boards, however, don't expect 100 MB, more like 1 MB (with the pin numbers and connectivity / protocols that an Arduino offers).
With Flash you can get much further, but it can ...
6
votes
Locally declared variable takes up global variable space in dynamic memory/SRAM
Isn't the space taken up by the local variable supposed to be freed up
from the SRAM once the functions runs because I have declared the
variable locally?
This is correct. The local arrays you ...
5
votes
Accepted
Does the bootloader use some SRAM?
You did not specify what type of Arduino you are using. My answer is for
the AVR-based ones.
The bootloader does use RAM while it is running. However, once it
handles control to your program, the ...
5
votes
Accepted
Does the StringObject.reserve() function prevent memory fragmentation/leaks?
Reserving space will help reduce memory fragmentation, but much of what else you are doing is swamping that small improvement you have made.
The biggest area of concern is your cutString function, ...
5
votes
Locally declared variable takes up global variable space in dynamic memory/SRAM
You must declare the array in global space or static, and make sure the function you pass the buffer pointer to knows it is in PROGMEM.
void send22()
{
static unsigned int irSignal[] PROGMEM= {...
4
votes
Is using malloc() and free() a really bad idea on Arduino?
Is it a really bad idea to use malloc() and free() with Arduino?
The short answer is yes. Below are the reasons why:
It is all about understanding what an MPU is and how to program within the ...
4
votes
Accepted
Is SRAM erased when putting Arduino into sleep_mode_pwr_down?
Generally, Atmega sleep modes do not erase RAM. Their memory is static and as long as voltage (above 2.7V I believe) is applied, data is held.
However, this also depends on how you plan to wake up ...
3
votes
Accepted
Writing a 1Mb bitmap to an SDcard with only 96kB RAM
You can write the file in chunks. As suggested by ocrdu in a comment,
writing line by line is a good strategy. In order to keep the complexity
of the code manageable, I would put the logic of deciding ...
3
votes
How can i reduce my global variable use? Attiny85
FastLED needs to keep the colors of all the pixel in RAM, so that is using a lot of RAM.
To get around this, you could use a strategy that generates the pixel data on the fly as you send it out to the ...
3
votes
Which library to use for 23LC1024 SRAM 1 Mbit
This was an excellent challenge for an SPI bus manager and device driver support library I have been working on. Below are some performance results for the SRAM (23LC1024) device driver (Arduino Uno @ ...
3
votes
Serial printing from flash memory (F() macro, PROGMEM, sprintf_P, SPTR)
explain in detail what exactly does each of the keywords F(), (PGM_P)F, PSTR, const PROGMEM.
F() wraps the string literal in PSTR(...) and then casts it to __FlashStringHelper. This forces it to ...
2
votes
Accepted
Space needed for local String variable
You are requesting 80 String objects.
Each String object allocates memory to store its data. When you provide a string constant that string constant data's length is used for the allocated data size (...
2
votes
How much can I recurse? How much can I recurse? How much ca!@#QFSD@$RFW
I had this exact same question as I was reading Jumping into C++ by Alex Allain, Ch 16: Recursion, p.230, so I ran some tests.
TLDR;
My Arduino Nano (ATmega328 mcu) can do 211 recursive function ...
2
votes
How is it possible to access the CPU registers using memory addresses?
Microcontrollers tend to be simple compared to processors like you would find in your laptop. Most operating system make use of the higher security features that can prevent user programs from ...
2
votes
Accepted
Using ESP32 Cam internal RAM
If there is continuity between 3.3V and GND your board is dead. Most likely (from my experience) the ESD protection diode on the ESP module is fried which leaves you no chance to repair it. Even if ...
2
votes
Accepted
String(int) function stopping the Arduino
You should avoid String on the Arduino. It will cause random crashes. However that's not your issue. Your issue is trying to copy the data into an array that is too small.
char tempSMS2[] = "&...
2
votes
Accepted
Connect SDRAM to STM32
As far as I know, you have to choose variant with FMC module (Flexible Memory Controller) with SDRAM support - that means you have to use 144pin version STM32F730Z8. The 100pin version does have FMC ...
2
votes
RAM cost of entering functions
I guess avoiding functions may have been relevant with dumb compilers, a
few decades ago. Compilers today are pretty good at optimizing and,
since recently, the Arduino environment enables “link time
...
2
votes
Accepted
RAM cost of entering functions
A friend has told me I shouldn't rely on functions because, during execution, they occupy a significant amount of RAM.
I wouldn't say "significant", but some RAM is used, yes.
Every time a ...
1
vote
Accepted
How can i reduce my global variable use? Attiny85
Since i don't use sysex messages, i got my RAM usage down to 84% by setting the SysExMaxSize
in midi_settings.h
to 0.
1
vote
Writing a 1Mb bitmap to an SDcard with only 96kB RAM
Normally I'd write this a differently, but I've kept in relatively simple just to illustrate the basic idea:
struct point {
int x;
int y;
};
const point points_of_interest[] = {
{ 7, 11},
{23, ...
1
vote
External RAM (23LC1024) and external Flash (W25Q64JVSSIQ) with Sparkfun SAMD21
You are correct, MISO, MOSI and SCK are common to all the SPI devices. Be sure they are all set up for clock polarity etc. The CS\ line is the select line. If the device is not selected it does not ...
1
vote
Arduino due temperature reading shows random temperatures
Did you read about this smt160 sensor ? It relies on the calculation of duty cycle of the square wave output from the sensor, to calculate the temparature.
temperature = (dutyCycle) -0.32)/0.0047
...
1
vote
Is there any way I can connect the RAM of a computer to Arduino?
I know this is old, but it comes up on Google so here I am.
Forget about connecting any kind of modern computer RAM to an Arduino. Period.
However, an old school SIMM from the 80's/early 90's is very ...
1
vote
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.
The AVR MCUs are Harvard ...
1
vote
I'm using too much RAM. How can this be measured?
There is a program called Arduino Builder that provides a neat visualization of the amount of flash, SRAM and EEPROM your program is using.
The Arduino builder makes up part of the CodeBlocks ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sram × 62arduino-uno × 24
memory-usage × 17
memory × 11
programming × 6
c++ × 5
spi × 5
arduino-due × 5
array × 5
eeprom × 5
variables × 5
progmem × 5
serial × 4
arduino-mega × 3
flash × 3
esp32 × 2
wifi × 2
atmega328 × 2
sd-card × 2
string × 2
arduino-pro-mini × 2
sketch × 2
arduino-nano × 1
sensors × 1
power × 1