Skip to content

Commit 6f12772

Browse files
committed
Revert "Use board's last flash sector for eeprom storage"
This reverts commit e31d3c1, because it seems to cause trouble with the OTAA join process. If left in, the join process results in: Initilizating LoRaWAN ... DevEui : XX-XX-XX-XX-XX-XX-XX-XX JoinEui : 00-00-00-00-00-00-00-00 Pin : 00-00-00-00 success! Joining LoRaWAN network ... ###### =========== MLME-Request ============ ###### ###### MLME_JOIN ###### ###### ===================================== ###### STATUS : Duty-cycle restricted Next Tx in : 3599930 [ms] Reason: Still unknown. The join process works without those new eeprom features.
1 parent bda1ce8 commit 6f12772

File tree

2 files changed

+2
-41
lines changed

2 files changed

+2
-41
lines changed

src/boards/rp2040/eeprom-board.c

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,15 @@
55
*
66
*/
77

8-
#include <string.h>
9-
10-
#include "pico/stdlib.h"
11-
#include "hardware/flash.h"
12-
138
#include "utilities.h"
149
#include "eeprom-board.h"
1510

16-
#define EEPROM_SIZE (FLASH_SECTOR_SIZE)
17-
#define EEPROM_OFFSET (PICO_FLASH_SIZE_BYTES - EEPROM_SIZE)
18-
#define EEPROM_ADDRESS ((const uint8_t*)(XIP_BASE + EEPROM_OFFSET))
19-
20-
static uint8_t eeprom_write_cache[EEPROM_SIZE];
21-
22-
void EepromMcuInit()
23-
{
24-
memcpy(eeprom_write_cache, EEPROM_ADDRESS, sizeof(eeprom_write_cache));
25-
}
26-
2711
uint8_t EepromMcuReadBuffer( uint16_t addr, uint8_t *buffer, uint16_t size )
2812
{
29-
memcpy(buffer, EEPROM_ADDRESS + addr, size);
30-
31-
return SUCCESS;
13+
return FAIL;
3214
}
3315

3416
uint8_t EepromMcuWriteBuffer( uint16_t addr, uint8_t *buffer, uint16_t size )
3517
{
36-
memcpy(eeprom_write_cache + addr, buffer, size);
37-
38-
return SUCCESS;
39-
}
40-
41-
uint8_t EepromMcuFlush()
42-
{
43-
uint32_t mask;
44-
45-
BoardCriticalSectionBegin(&mask);
46-
47-
flash_range_erase(EEPROM_OFFSET, sizeof(eeprom_write_cache));
48-
flash_range_program(EEPROM_OFFSET, eeprom_write_cache, sizeof(eeprom_write_cache));
49-
50-
BoardCriticalSectionEnd(&mask);
18+
return FAIL;
5119
}

src/lorawan.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ static LmHandlerAppData_t AppRxData =
185185

186186
static bool Debug = false;
187187

188-
extern void EepromMcuInit();
189-
extern uint8_t EepromMcuFlush();
190-
191188
const char* lorawan_default_dev_eui(char* dev_eui)
192189
{
193190
uint8_t boardId[8];
@@ -205,8 +202,6 @@ const char* lorawan_default_dev_eui(char* dev_eui)
205202

206203
static int lorawan_init(const struct lorawan_sx12xx_settings* sx12xx_settings, LoRaMacRegion_t region)
207204
{
208-
EepromMcuInit();
209-
210205
RtcInit();
211206
#if defined sx1276
212207
SpiInit(
@@ -395,8 +390,6 @@ static void OnNvmDataChange( LmHandlerNvmContextStates_t state, uint16_t size )
395390
if (Debug) {
396391
DisplayNvmDataChange( state, size );
397392
}
398-
399-
EepromMcuFlush();
400393
}
401394

402395
static void OnNetworkParametersChange( CommissioningParams_t* params )

0 commit comments

Comments
 (0)