Skip to content

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
wants to merge 2 commits into from
Closed

NCS36510 deep sleep function fix #5396

wants to merge 2 commits into from

Conversation

danclement
Copy link
Contributor

@danclement danclement commented Oct 27, 2017

Description

This pull request is to fix an issues flagged in #5065.

Status

READY
Fully tested by mbed CLI tests.

@maclobdell
@0xc0170
@0x6d61726b

Removed the NOP commands and put in a FLASH ready routine to wait until the FLASH tells the system it's ready to execute code (i.e. read).
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 28, 2017

/morph build

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 28, 2017

@danclement Thanks for sending the fix.

Regarding merge commit: Is merge commit necessary for this changeset?

@mbed-ci
Copy link

mbed-ci commented Oct 28, 2017

Build : SUCCESS

Build number : 363
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5396/

Triggering tests

/morph test
/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Oct 28, 2017

@danclement
Copy link
Contributor Author

I am not power user of GitHub and Fork, branch, pull request flows, so sorry for the merge commit. I made a mistake somewhere in my branch of mbed OS and I was trying to fix it before doing the pull request.

Sorry if that messes things up for whatever reason. @0xc0170

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 29, 2017

I am not power user of GitHub and Fork, branch, pull request flows, so sorry for the merge commit. I made a mistake somewhere in my branch of mbed OS and I was trying to fix it before doing the pull request.

You can still squash those 2 locally and push with force to overwrite it , or we can in this case during integration.

Can you please check the test, it fails for IAR for lp ticker, seems like deepsleep test case for lp ticker time outs.

Copy link
Contributor

@c1728p9 c1728p9 left a comment

Choose a reason for hiding this comment

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

From the test results it looks like the problem still occurs with this fix. @danclement I don't think you'll be able to fix this problem with trial an error. This seems like it may be a more deeply rooted problem. I would recommend working with the ncs36510 design team to root cause this and ensure this problem is fixed.


// After waking from interrupt, wait for flash banks to be powered up and ready
// TODO: Later need to make sure this still works well for a dual stack or dual FLASH application
while ((FLASHREG->STATUS.BITS.FLASH_A_BUSY == 1));
Copy link
Contributor

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:

while ((FLASHREG->STATUS.BITS.FLASH_A_BUSY == 1)) {
    busy_count++;
}

Copy link
Contributor Author

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?

Copy link
Contributor Author

@danclement danclement Oct 31, 2017

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.

Copy link
Contributor

@0xc0170 0xc0170 Nov 2, 2017

Choose a reason for hiding this comment

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

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.

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.

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?

The ready signal is absolutely a part of the power up sequence, it's clearly documented in our FLASH design spec.

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).

Copy link
Contributor

Choose a reason for hiding this comment

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

The ready signal is absolutely a part of the power up sequence, it's clearly documented in our FLASH design spec.

@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?

@danclement
Copy link
Contributor Author

danclement commented Nov 9, 2017 via email

@mbed-ci
Copy link

mbed-ci commented Nov 9, 2017

Build : SUCCESS

Build number : 483
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5396/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 10, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 10, 2017

@cmonr
Copy link
Contributor

cmonr commented Jan 11, 2018

Closing due to inactivity. Feel free to reopen if more progress is made.

@cmonr cmonr closed this Jan 11, 2018
@cmonr cmonr removed the needs: work label Jan 11, 2018
@maclobdell
Copy link
Contributor

@danclement - any update on this one?

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.

6 participants