Closed fulvioalessio closed 1 year ago
Hi, it seems to me that the EEPROM.h of LGT8F328P sdk lacks the [] operator. From what I've read, this micro is also different because it doesn't have a real EEPROM and creates one by simulating it with Flash memory. So I can say that the LGT8F328P is not supported by the EEWL library. I have not found board support for LGT8F328P in the Arduino IDE. Have you compiled for LGT8F328P or for an other micro in the Arduino IDE? Anyway, PlatformIO compiles fine the countPowerCyclesDebug example for the ATmega328 with the following .ini
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
lib_deps = fabriziop/EEWL
Hi Fabrizio,
I've changed my eewl.h in this way, now countPowerCyclesDebug compile and works with LGT8F328P cpu with platformio.ini configuration of the previous message:
#ifdef EEWL_RAM
#define EE_WRITE( addr , val ) (buffer[(int)( addr )] = val)
#define EE_READ( addr ) (buffer[(int)( addr )])
#else
#ifdef __AVR__
#if defined(__LGT8FX8P__)
#define EE_WRITE( addr , val ) (EEPROM.write((uint16_t)( addr ), val))
#define EE_READ( addr ) (EEPROM.read((uint16_t)( addr )))
#else
#define EE_WRITE( addr , val ) (EEPROM[ (int)( addr ) ].update( val ))
#define EE_READ( addr ) (EEPROM[(int)( addr )])
#endif
#elif defined(ESP8266) || defined(ESP32)
#define EE_WRITE( addr , val ) (EEPROM.write((int)( addr ),( val )))
#define EE_READ( addr ) (EEPROM[(int)( addr )])
#else
#error ERROR: unsupported architecture
#endif
#endif
output:
power cycles = 8
blk_size: 5
blk_num: 10
blk_addr: 33
blk_mark: FE
start_addr: 10
end_addr: 42
10: FF-1 0 0 0
15: FF-2 0 0 0
1A: FF-3 0 0 0
1F: FF-4 0 0 0
24: FF-5 0 0 0
29: FF-6 0 0 0
2E: FF-7 0 0 0
33: FE-8 0 0 0
38: FF-10 A0 FF 2
3D: FF-FF C8 B4 FF
I have found this EEPROM library (https://raw.githubusercontent.com/dbuezas/lgt8fx/master/package_lgt8fx_index.json), installed on arduino IDE and updated to version 2.0.0 it has full API compatibility with ATMega EEPROM library. The EEWL example compiles fine both on Arduino IDE and on PlatformIO with this library. So no changes are needed to EEWL. Since I have no experience with PlatformIO library upgrade, I copied EEPROM files manually as follow cp ./.arduino15/packages/lgt8fx/hardware/avr/2.0.0/libraries/E2PROM/EEPROM.h ./.platformio/packages/framework-lgt8fx/libraries/E2PROM/EEPROM.h cp ./.arduino15/packages/lgt8fx/hardware/avr/2.0.0/libraries/E2PROM/EEPROM.cpp ./.platformio/packages/framework-lgt8fx/libraries/E2PROM/EEPROM.cpp I hope this can help.
Hi Fabrizio, thank you. I'll use your tips until LGT8F* receive an update
Hi, using platformio:
When I try to compile the code copied from countPowerCyclesDebug, I get this error:
(I added on top of example)
Using Arduino IDE, example works fine. I'm missing something ? TIA f.