You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only connected to the computer without anything else. All GPIOs are free.
Version
v2.0.9
IDE Name
Arduino IDE 2.1.1
Operating System
macOS Ventura 13.4.1(M1 chip)
Flash frequency
80 MHz
PSRAM enabled
no
Upload speed
921600
Description
Try a simple example "StartCounter"(libraries/Preferences/examples/StartCounter/StartCounter.ino) on my board. Code as follows:
/* ESP32 startup counter example with Preferences library. This simple example demonstrates using the Preferences library to store how many times the ESP32 module has booted. The Preferences library is a wrapper around the Non-volatile storage on ESP32 processor. created for arduino-esp32 09 Feb 2017 by Martin Sloup (Arcao)*/
#include<Preferences.h>
Preferences preferences;
voidsetup() {
Serial.begin(115200);
Serial.println();
// Open Preferences with my-app namespace. Each application module, library, etc// has to use a namespace name to prevent key name collisions. We will open storage in// RW-mode (second parameter has to be false).// Note: Namespace name is limited to 15 chars.
preferences.begin("my-app", false);
// Remove all preferences under the opened namespace//preferences.clear();// Or remove the counter key only//preferences.remove("counter");// Get the counter value, if the key does not exist, return a default value of 0// Note: Key name is limited to 15 chars.unsignedint counter = preferences.getUInt("counter", 0);
// Increase counter by 1
counter++;
// Print the counter to Serial Monitor
Serial.printf("Current counter value: %u\n", counter);
// Store the counter to the Preferences
preferences.putUInt("counter", counter);
Serial.print("Free:");
Serial.println(preferences.freeEntries());
// Close the Preferences
preferences.end();
// Wait 3 seconds
Serial.println("Restarting in 3 seconds...");
delay(3000);
// Restart ESP
ESP.restart();
}
voidloop() {}
I changed 10 seconds to 3 seconds it doesn't matter I think. After I uploaded, the counter value is always "1". However, it was supposed to add "1" everytime, instead of keeping "1".
This is just a simple example. Thus, more complex things like this, too. "putString" doesn't save the string you provided, etc.
Board
ESP32S3 Dev Module
Device Description
DevKitC-1, N32R8V, just a single board.
Hardware Configuration
Only connected to the computer without anything else. All GPIOs are free.
Version
v2.0.9
IDE Name
Arduino IDE 2.1.1
Operating System
macOS Ventura 13.4.1(M1 chip)
Flash frequency
80 MHz
PSRAM enabled
no
Upload speed
921600
Description
Try a simple example "StartCounter"(libraries/Preferences/examples/StartCounter/StartCounter.ino) on my board. Code as follows:
I changed 10 seconds to 3 seconds it doesn't matter I think. After I uploaded, the counter value is always "1". However, it was supposed to add "1" everytime, instead of keeping "1".
This is just a simple example. Thus, more complex things like this, too. "putString" doesn't save the string you provided, etc.
Sketch
Debug Message
Other Steps to Reproduce
Just verify the code and upload, then open the monitor, "Current counter value" is always "1", nothing special.
If you check with "int pStatus = preferences.putUInt("counter", counter);", and the "pStatus" is "4", which is the right return value.
My friend who uses Windows 10 and uses the same ESP32S3 board also meet the problem.
I tested the code on "wokwi.com"(an online simulator) but it works normally...(God, That's weird?)
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: