Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EepromMcuReadBuffer: Read back from cache #16

Conversation

ThomasLeister
Copy link
Contributor

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 e31d3c1
work for me and therefore is a fix. Previous attemps to use commit
e31d3c1... 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.

Might be related to #14 and also affects #15

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  e31d3c1
work for me and therefore is a fix. Previous attemps to use commit
e31d3c1... 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.
@ThomasLeister
Copy link
Contributor Author

Restoring context after Raspberry restart works fine with this PR:

First start with untouched Flash:

Initilizating LoRaWAN ... success!
Joining LoRaWAN network .......................................................................... joined successfully!
sending internal temperature: 19 °C (0x13)... success!

Second start is much quicker (context is used):

Initilizating LoRaWAN ... success!
Joining LoRaWAN network ............ joined successfully!
sending internal temperature: 19 °C (0x13)... success!

@ThomasLeister ThomasLeister changed the title EepromMcuReadBuffer: Read back from cache Fix EepromMcuReadBuffer: Read back from cache Jan 16, 2022
@ep1cman
Copy link
Member

ep1cman commented Jan 18, 2022

Tested using:

  • SX1276
  • The Things Indoor Gateway
  • EU Frequency

Everything seems to work as expected, joins seem to happen quickly.

Copy link
Member

@sandeepmistry sandeepmistry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThomasLeister thank you for submitting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants