-
Notifications
You must be signed in to change notification settings - Fork 3k
NCS36510 deep sleep function fix #5396
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does flash actually become busy after deep sleep WFI, or is this only when erasing or programming flash? A quick test you could try is adding a count to the loop:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Russ, Martin,
I will have to look into it deeper apparently. I will add it to our backlog but it may take some time to get back into it.
Should I close this pull request and make a new one when the issue is solved or is it better to keep this one?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c1728p9 Russ,
I looked at this again yesterday and i think adding this while loop is needed and I think it needs to be in front of the oscillator code.
The ready signal is absolutely a part of the power up sequence, it's clearly documented in our FLASH design spec.
I moved the code to right after the WFI instruction and the test passes GCC and IAR. I tried to test using ARM but for some reason the path is not able to resolve itself.
Russ, you mentioned you did not think having the wait for ready code right after WFI is appropriate. I don't understand that. WFI is wait for interrupt so I assume the chip is in deep sleep at that point. As soon as the interrupt comes, the internal 32MHz oscillator will power up and the system will try to run code. If the FLASH isn't actually ready then I think this may be an issue and could cause a crash.
The code where it's waiting for the oscillator is only to switch the system over to the accurate crystal based 32MHz clock.
So I would like to move the wait for FLASH ready to right after the WFI and resubmit this pull request. If you don't agree let me know and we can discuss.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume this is the proper place - immediately after WFI call completes.
ARM then still failing tests with this patch . You can rebase this PR to accomodate your proposed changes, however what is with ARMCC?
It is always good to provide references that a reader can verify (even in the commit msg, so we can look it up via a reference there or add a brief description from the reference manual there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danclement so the ncs36510 returns from WFI before the flash isn't ready? Why does the program not crash immediately if it is executing from flash before flash is ready? Does reading from flash before it is ready return a dummy value without triggering a hardfault? If so is that dummy value random or a fixed value such as 0xff or 0x00? Also, how long does it take for flash to become ready?