Она под старое ядро 2.x.x, под 3.x.x надо править
Так и в обычной ESP32 то же самое.
В обычной ESP32 есть область памяти выделенная специально для сохранения энергонезависимых данных, и библиотека EEprom.h работает с этой областью. В ESP32S3 такого нет.
А в адресах можно?
тебя обманули (gen4esp32_2MBapp_2MBota_12MBspiffs.csv):
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000,0x200000,
app1, app, ota_1, 0x210000,0x200000,
spiffs, data, spiffs, 0x410000,0xBE0000,
coredump, data, coredump,0xFF0000,0x10000,
Есть
Структура таблицы разделов для любых ESP32 одинакова
Значит библиотека, которая работала в ESP32, но не работает в ESP32-S3, наверно устарела. Может у вас есть опыт сохранения данных на ESP32-S3 подскажите ссылку на работающую библиотеку EEprom для ESP32-S3.
1.8.19
Библиотека EEPROM.h
- штатная, входит в состав аддона, должна работать с любыми чипами.
Стандартный пример
eeprom_write.ino
/*
EEPROM Write
Stores random values into the EEPROM.
These values will stay in the EEPROM when the board is
turned off and may be retrieved later by another sketch.
*/
#include "EEPROM.h"
// the current address in the EEPROM (i.e. which byte
// we're going to write to next)
int addr = 0;
#define EEPROM_SIZE 64
void setup() {
Serial.begin(115200);
Serial.println("start...");
if (!EEPROM.begin(EEPROM_SIZE)) {
Serial.println("failed to initialize EEPROM");
delay(1000000);
}
Serial.println(" bytes read from Flash . Values are:");
for (int i = 0; i < EEPROM_SIZE; i++) {
Serial.print(byte(EEPROM.read(i)));
Serial.print(" ");
}
Serial.println();
Serial.println("writing random n. in memory");
}
void loop() {
// need to divide by 4 because analog inputs range from
// 0 to 1023 and each byte of the EEPROM can only hold a
// value from 0 to 255.
// int val = analogRead(10) / 4;
int val = byte(random(10020));
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off.
EEPROM.write(addr, val);
Serial.print(val);
Serial.print(" ");
// advance to the next address. there are 512 bytes in
// the EEPROM, so go back to 0 when we hit 512.
// save all changes to the flash.
addr = addr + 1;
if (addr == EEPROM_SIZE) {
Serial.println();
addr = 0;
EEPROM.commit();
Serial.print(EEPROM_SIZE);
Serial.println(" bytes written on Flash . Values are:");
for (int i = 0; i < EEPROM_SIZE; i++) {
Serial.print(byte(EEPROM.read(i)));
Serial.print(" ");
}
Serial.println();
Serial.println("----------------------------------");
}
delay(100);
}
я жеж написал, дело в ядре, возьми ветку 2.0.11 там все работает
Если тебе именно та библиотека нужна
То же. Вин10. Проект для 8266, но на S3 скомпилировался и зашился. Используется первые 20 байт библы для четырёх значений. Итого при сохранении каждый раз происходит дисконнект и переписываются только адреса с 0\5\10. Странненько.
Вот прямо этот стандартный пример уже пару лет трудится успешно с ESP32. Тупо поправил скеч по GPIO и загрузил в ESP32-S3. Всё работает штатно. Но когда пытаюсь поменять значения через вебку, переменные не сохраняются. После перезагрузки старые значения. (((
Для сохранения данных в EEPROM нужно не забывать вызывать метод commit()
EEPROM.commit();
Всё это делается, вызывается. Говорю же на ESP32 всё классно работает.
Чудес не бывает. Но если проблема действительно есть, может быть стоит создать issue на гитхабе разработчика?
Взял, всё равно не работает. А вот Serial0 пришлось исправить на Serial. А то не собиралось. Может ещё понизить?
Ну как это нет.
Бог с вами.
Все ЕСП32 не имеют ЕЕПРОРМ. Везде она эмулируется через флэш. Если вы посмотрите таблицу разделов на вашем флеше, там будут разделы типа “NVS”, “NVS Data”, “NVS Keys”
Это оно.
В ЕСП32 можно замаппить эту память на RAM и общаться с еепромкой . как с обычной памятью.
Может сделать минимальный скетч с проблемой и выложить сюда? А то все на словах да на словах ))
“Стандартный сейтч”(с) Из примеров.
/*
EEPROM Write
Stores random values into the EEPROM.
These values will stay in the EEPROM when the board is
turned off and may be retrieved later by another sketch.
*/
#include "EEPROM.h"
// the current address in the EEPROM (i.e. which byte
// we're going to write to next)
int addr = 0;
#define EEPROM_SIZE 64
void setup() {
Serial.begin(115200);
Serial.println("start...");
if (!EEPROM.begin(EEPROM_SIZE)) {
Serial.println("failed to initialize EEPROM");
delay(1000000);
}
Serial.println(" bytes read from Flash . Values are:");
for (int i = 0; i < EEPROM_SIZE; i++) {
Serial.print(byte(EEPROM.read(i)));
Serial.print(" ");
}
Serial.println();
Serial.println("writing random n. in memory");
}
void loop() {
// need to divide by 4 because analog inputs range from
// 0 to 1023 and each byte of the EEPROM can only hold a
// value from 0 to 255.
// int val = analogRead(10) / 4;
int val = byte(random(10020));
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off.
EEPROM.write(addr, val);
Serial.print(val);
Serial.print(" ");
// advance to the next address. there are 512 bytes in
// the EEPROM, so go back to 0 when we hit 512.
// save all changes to the flash.
addr = addr + 1;
if (addr == EEPROM_SIZE) {
Serial.println();
addr = 0;
EEPROM.commit();
Serial.print(EEPROM_SIZE);
Serial.println(" bytes written on Flash . Values are:");
for (int i = 0; i < EEPROM_SIZE; i++) {
Serial.print(byte(EEPROM.read(i)));
Serial.print(" ");
}
Serial.println();
Serial.println("----------------------------------");
}
delay(1000);
}
Настройки
Результат
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
66 20 235 119 36 147 154 132 131 199 59 78 247 21 209 160 45 134 247 130 149 234 60 59 170 122 29 247 134 34 100 197 124 191 171 13 153 191 165 91 30 170 110 13 162 55 151 245 221 100 111 207 196 97 101 4 89 99 109 101 9 43 168 46
writing random n. in memory
181 115 250 77 175 206 78 ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
66 20 235 119 36 147 154 132 131 199 59 78 247 21 209 160 45 134 247 130 149 234 60 59 170 122 29 247 134 34 100 197 124 191 171 13 153 191 165 91 30 170 110 13 162 55 151 245 221 100 111 207 196 97 101 4 89 99 109 101 9 43 168 46
writing random n. in memory
155 211 223 2 117 242 216 43 27 170 122 168 87 44 47 85 45 ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
66 20 235 119 36 147 154 132 131 199 59 78 247 21 209 160 45 134 247 130 149 234 60 59 170 122 29 247 134 34 100 197 124 191 171 13 153 191 165 91 30 170 110 13 162 55 151 245 221 100 111 207 196 97 101 4 89 99 109 101 9 43 168 46
writing random n. in memory
176 3 199 3 234 46 68 117 33 24 ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
66 20 235 119 36 147 154 132 131 199 59 78 247 21 209 160 45 134 247 130 149 234 60 59 170 122 29 247 134 34 100 197 124 191 171 13 153 191 165 91 30 170 110 13 162 55 151 245 221 100 111 207 196 97 101 4 89 99 109 101 9 43 168 46
writing random n. in memory
175 136 181 119 135 71 52 74 219 49 ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
66 20 235 119 36 147 154 132 131 199 59 78 247 21 209 160 45 134 247 130 149 234 60 59 170 122 29 247 134 34 100 197 124 191 171 13 153 191 165 91 30 170 110 13 162 55 151 245 221 100 111 207 196 97 101 4 89 99 109 101 9 43 168 46
writing random n. in memory
115 17 170 167 8 10 147 130
“Всё страньше и страньше”(с)
Аааа. Пишет не равно сохраняет. Ясненько.
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
249 220 20 28 20 27 17 245 86 131 7 192 34 6 206 91 244 118 182 42 42 182 8 97 178 55 73 18 199 187 79 131 211 228 241 125 223 119 108 42 27 174 173 43 224 57 33 244 245 239 224 118 6 251 54 67 77 185 187 104 72 3 162 64
writing random n. in memory
135 18 110 180 246 68 231 33 197 222 64 21 63 231 135 196 206 201 72 33 119 6 171 41 181 21 106 192 228 102 181 125 252 80 116 16 191 153 244 80 188 40 220 94 117 11 74 80 13 68 151 215 186 44 78 18 206 171 128 216 157 221 191 75
64 bytes written on Flash . Values are:
135 18 110 180 246 68 231 33 197 222 64 21 63 231 135 196 206 201 72 33 119 6 171 41 181 21 106 192 228 102 181 125 252 80 116 16 191 153 244 80 188 40 220 94 117 11 74 80 13 68 151 215 186 44 78 18 206 171 128 216 157 221 191 75
----------------------------------
188 232 25 45 55 78 177 212 188 142 98 83 31 159 58 86 80 131 93 57 45 97 231 30 137 0 67 93 35 95 66 190 105 248 47 192 47 22 166 178 43 189 203 94 87 172 183 169 218 141 220 83 144 183 48 125 196 113 113 216 133 107 99 105
64 bytes written on Flash . Values are:
188 232 25 45 55 78 177 212 188 142 98 83 31 159 58 86 80 131 93 57 45 97 231 30 137 0 67 93 35 95 66 190 105 248 47 192 47 22 166 178 43 189 203 94 87 172 183 169 218 141 220 83 144 183 48 125 196 113 113 216 133 107 99 105
----------------------------------
57 109 153 28 48 243 48 122 165 84 6 230 102 222 183 133 223 175 107 159 118 190 201 243 251 233 134 178 22 123 72 67 168 223 144 123 171 129 193 108 233 145 48 158 124 151 220 185 96 126 60 164 234 2 54 244 81 42 22 191 136 148 151 250
64 bytes written on Flash . Values are:
57 109 153 28 48 243 48 122 165 84 6 230 102 222 183 133 223 175 107 159 118 190 201 243 251 233 134 178 22 123 72 67 168 223 144 123 171 129 193 108 233 145 48 158 124 151 220 185 96 126 60 164 234 2 54 244 81 42 22 191 136 148 151 250
----------------------------------
81 45 89 42 92 55 138 90 117 69 218 26 164 138 225 62 44 137 159 224 207 ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x109c
load:0x403c9700,len:0x4
load:0x403c9704,len:0xb50
load:0x403cc700,len:0x2fe4
entry 0x403c98ac
start...
bytes read from Flash . Values are:
57 109 153 28 48 243 48 122 165 84 6 230 102 222 183 133 223 175 107 159 118 190 201 243 251 233 134 178 22 123 72 67 168 223 144 123 171 129 193 108 233 145 48 158 124 151 220 185 96 126 60 164 234 2 54 244 81 42 22 191 136 148 151 250
writing random n. in memory
178 230 239 200 120 106 72 171 174 25 173 145 180 45 184 0 249 110 145 62 143 241 241 126 204 101 119 53 7 91 21 116 1 74 211 100 92 36 181 39 116 0 18 60 60 175 226 230 249 119 118 151 8 108 161 8 60 93 152 225 13 189 170 174
64 bytes written on Flash . Values are:
178 230 239 200 120 106 72 171 174 25 173 145 180 45 184 0 249 110 145 62 143 241 241 126 204 101 119 53 7 91 21 116 1 74 211 100 92 36 181 39 116 0 18 60 60 175 226 230 249 119 118 151 8 108 161 8 60 93 152 225 13 189 170 174
----------------------------------
141 149 23 190 32 34 72 45 68 201 198 191 26 42 163 207 127 20 245 106 103 27 74 125 116 18 2 162 112 217 89 229 115 202 5 23 185 96 102 31 203 252 29 57 172 253 199 135 198 48 73 146 103 225 150 250 234 86 136 64 79 70 133 67
64 bytes written on Flash . Values are:
141 149 23 190 32 34 72 45 68 201 198 191 26 42 163 207 127 20 245 106 103 27 74 125 116 18 2 162 112 217 89 229 115 202 5 23 185 96 102 31 203 252 29 57 172 253 199 135 198 48 73 146 103 225 150 250 234 86 136 64 79 70 133 67
----------------------------------
52 160 69 94 222 110 31 42 201 208 154 221 151 179 122 24 105 15 68 235 153 70 16 28 64 222 81 219 183 22 202 190 244 83 77 38 27 160 65 141 33 168 167 118 65 2 71 102 149 23 145 224 3 199 51 228 253 48 150 9 155 23 23 2
64 bytes written on Flash . Values are:
52 160 69 94 222 110 31 42 201 208 154 221 151 179 122 24 105 15 68 235 153 70 16 28 64 222 81 219 183 22 202 190 244 83 77 38 27 160 65 141 33 168 167 118 65 2 71 102 149 23 145 224 3 199 51 228 253 48 150 9 155 23 23 2
----------------------------------
199 226 2
Типа EEPROM типа работает