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

Implement sleep function for external flash #2136

Merged
merged 5 commits into from
Jul 10, 2020

Conversation

YutingYou
Copy link
Contributor

Feature

Implement sleep function for external flash

Steps to Test

Test the sleep API with the example application, make sure the sleep API won't affect the behavior of the file system.

Example App

void setup(void) {
}

void loop() {
    static int index = 0;
    EEPROM.begin();
    EEPROM.write(10, '0' + index++ % 10);
    Log.info("Read: %c", EEPROM.read(10));
    EEPROM.end();
    hal_exflash_sleep(true, nullptr);
    delay(1000);
    hal_exflash_sleep(false, nullptr);
}

References

[CH55886]


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

hal/src/nRF52840/exflash_hal.c Outdated Show resolved Hide resolved
hal/src/nRF52840/exflash_hal.c Outdated Show resolved Hide resolved
@XuGuohui XuGuohui added this to the 2.0.0 milestone Jun 28, 2020
@YutingYou YutingYou force-pushed the feature/sleep_wakeup_exflash/ch55886 branch from ee7b031 to 9d53801 Compare June 28, 2020 13:05
hal/src/nRF52840/exflash_hal.c Outdated Show resolved Hide resolved
hal/src/nRF52840/exflash_hal.c Outdated Show resolved Hide resolved
@XuGuohui XuGuohui requested a review from avtolstoy July 8, 2020 13:33
hal/src/nRF52840/exflash_hal.c Outdated Show resolved Hide resolved
@XuGuohui XuGuohui requested a review from avtolstoy July 9, 2020 15:33
@XuGuohui XuGuohui force-pushed the feature/sleep_wakeup_exflash/ch55886 branch from fce7fa5 to dfe9494 Compare July 9, 2020 15:54
// It may fail as the flash chip might be in an ongoing program/erase operation. Suspend it.
hal_exflash_special_command(HAL_EXFLASH_SPECIAL_SECTOR_NONE, HAL_EXFLASH_COMMAND_SUSPEND_PGMERS, NULL, NULL, 0);
// Abort the suspended write/erase operation.
hal_exflash_special_command(HAL_EXFLASH_SPECIAL_SECTOR_NONE, HAL_EXFLASH_COMMAND_RESET, NULL, NULL, 0);
Copy link
Member

Choose a reason for hiding this comment

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

Just one minor thing: after this command you might need to send QSPI_STD_CMD_WRSR. Double check the datasheet.

@XuGuohui XuGuohui added ready to merge PR has been reviewed and tested and removed needs review labels Jul 10, 2020
@XuGuohui XuGuohui force-pushed the feature/sleep_wakeup_exflash/ch55886 branch from e1e8e1d to 43f186d Compare July 10, 2020 07:43
@XuGuohui XuGuohui self-requested a review July 10, 2020 07:43
@XuGuohui XuGuohui merged commit 11edcc3 into develop Jul 10, 2020
@XuGuohui XuGuohui deleted the feature/sleep_wakeup_exflash/ch55886 branch July 10, 2020 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ready to merge PR has been reviewed and tested
Projects
None yet
3 participants