From 85b818b8c3ff1d16ff7f6dec57a5b99acd75b763 Mon Sep 17 00:00:00 2001 From: Thomas Leister Date: Sun, 16 Jan 2022 15:56:08 +0100 Subject: [PATCH] EepromMcuReadBuffer: Read back from cache Read back information from cache instead of flash. The cache contains the latest context, whereas the flash is only updated periodically. This could cause issues if the flash is not (yet) updated while the context has been updated in the meantime and values are read by LoRaMAC. Therefore just read from flash initially after startup (EepromMcuInit()) and rely on write cache later. This commit effectively makes commit e31d3c133f0effca9d3660e35b383506018eca39 work for me and therefore is a fix. Previous attemps to use commit e31d3c13... without this commit failed. Error message: "Duty cycle restricted". The error message might not appear at the first startup, but will appear if Raspberry Pi Pico is restarted and values from "EEPROM" / Flash have been read. --- src/boards/rp2040/eeprom-board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boards/rp2040/eeprom-board.c b/src/boards/rp2040/eeprom-board.c index 7241819..069a59b 100644 --- a/src/boards/rp2040/eeprom-board.c +++ b/src/boards/rp2040/eeprom-board.c @@ -26,7 +26,7 @@ void EepromMcuInit() uint8_t EepromMcuReadBuffer( uint16_t addr, uint8_t *buffer, uint16_t size ) { - memcpy(buffer, EEPROM_ADDRESS + addr, size); + memcpy(buffer, eeprom_write_cache + addr, size); return SUCCESS; }