-
Notifications
You must be signed in to change notification settings - Fork 3k
MIMXRT1050EVK: Fix Sleep support #7419
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
Conversation
cc @0xc0170 |
Is this connected to this changeset? |
I have looked closely at this changeset and cannot understand the cause of test framework crash. Can someone look at the green-tea failure log. |
It looks like deep-sleep test fails. In the test there is a special delay used before entering deep-sleep, so the green tea transmission can be successfully finished: mbed-os/TESTS/mbed_hal/lp_ticker/main.cpp Line 101 in f12afde
Maybe it is not sufficient for your target on ARM compiler and needs to be increased. Can you try to increase the delay? |
cc @maclobdell |
@mprse Thank you for your suggestion. I made the below change and don't see the crash anymore.
|
@mprse How shall we address this issue? |
This is workaround commonly used in tests. Since the required delay is target specific I had to increase the delay few times already. |
I'm implementing
I will appreciate if you could create this PR. |
Fix can be found here: PR #7494. Please let me know if this fix solves the issue. |
Depends on #7494 . |
83e53f1
to
aefae1b
Compare
Apologies for the delay, I have rebased this PR. I still see an issue with the glitch test, below change fixes it, could you please take a look.
|
@mprse Please review |
@mmahadevan108 This test checks if lp ticker does not glitch backwards due to an incorrectly implemented ripple counter driver. Additionally please check the pseudo code implementation of Lines 131 to 158 in f9862b8
As you can see counter is read in loop until the same value is read twice. Looking into implementation of
|
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 see that this PR not only changes implementation of sleep
functions and enables sleep support in targets.json
, but also adds some files, changes linker scripts, fixing codding style, etc. This is all done in one commit and it is hard to understand the changes. Could you please split this commit and add some note to describe the purpose of the changes.
All changes in this PR are related to adding sleep support on MRT1050 The sleep implementation on MXRT is a bit more involved than Kinetis and LPC devices. The changes to the linker script maps memory that stays active during DEEP SLEEP to hold certain functions. |
@mmahadevan108 Can you add that explanation to the commit ? How the commit fixes it (what problem there was and how it is addressed) |
aefae1b
to
33e6ac9
Compare
@0xc0170 . Done, update commit message to include more information. |
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.
Update below in the next review
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.
It would be better if this is separated to more commits as @mprse requested earlier. One commit changes multiple files for multiple reasons with one common goal - fix sleep.
Now the commit adds more details for fixing, it's more clear to me what is being changed however took me a while to go through changes.
Commits as follows (as I understand changes from this pull request - for illustration how it could be done):
- add lpm init (why are we adding lpm files, is this new driver update?)
- update sdk init: add copy function (what is being copied ? this requires some linker script changes?)
- SKIP_SYSCLK_INIT addition (why is this needed now ?)
- sleep: add pre/post processing steps
- enable sleep
Note: my previous review was supposed to be needs work rather than approval, as I can't change it, adding this new one
This is needed to support different Low-Power modes available in MXRT1050 Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
…l memory Low power functions related to powering off FLEXSPI and SDRAM needs to be copied to internal memory Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
SKIP_SYSCLK_INIT prevents reinitializing the SYS_CLK PLL used by SDRAM. This PLL is setup during bootup by the ROM code. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
33e6ac9
to
9cf2b76
Compare
The PR has been broken to smaller commits as suggested earlier. |
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.
@mmahadevan108 Thanks ! Looks good , much easier to review and understand changes
/morph build |
Build : SUCCESSBuild number : 2757 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2386 |
Test : SUCCESSBuild number : 2481 |
…upport MIMXRT1050EVK: Fix Sleep support
Description
Add support for SLEEP in MXRT1050EVK. Support for low power modes on MXRT requires
1. Updates to the CCM LPCR register to set the power mode
2. Enabling wakeup source in the GPC module
3. Ensuring the low power functions related to powering off
FLEXx SPI and SDRAM are executed from internal memory
4. Save PLL state before disabling them
5. Restore PLL state on resume
All tests passed under GCC_ARM and IAR toolchains.
With ARM toolchain, all tests passed except I see the below green-tea crash when running mbed-os-tests-mbed_hal-lp_ticker test. I have debugged this and the test is passing, however it crashes on exit. Also this happens only with ARM toolchain. Any ideas??
mbedhtrun: mbedhtrun -m MIMXRT1050_EVK -p COM50:9600 -f "BUILD/tests/MIMXRT1050_EVK/ARM/mbed-os/TESTS/mbed_hal/lp_ticker/lp_ticker.bin" -e "mbed-os\TESTS\host_tests" -d D: -c default -t 0227000041114e450004300ac2040020df91000097969900 -r default -C 4 --sync 5 -P 60
mbedgt: mbed-host-test-runner: started
[1530709453.47][HTST][INF] host test executor ver. 1.3.1
[1530709453.47][HTST][INF] copy image onto target...
[1530709453.47][COPY][INF] Waiting up to 60 sec for '0227000041114e450004300ac2040020df91000097969900' mount point (current is 'D:')...
1 file(s) copied.
[1530709463.43][HTST][INF] starting host test process...
[1530709465.57][CONN][INF] starting connection process...
[1530709465.57][CONN][INF] notify event queue about extra 60 sec timeout for serial port pooling
[1530709465.57][CONN][INF] initializing serial port listener...
[1530709465.57][PLGN][INF] Waiting up to 60 sec for '0227000041114e450004300ac2040020df91000097969900' serial port (current is 'COM50')...
[1530709465.57][HTST][INF] setting timeout to: 60 sec
[1530709465.66][SERI][INF] serial(port=COM50, baudrate=9600, read_timeout=0.01, write_timeout=5)
[1530709465.66][SERI][INF] reset device using 'default' plugin...
[1530709465.92][SERI][INF] waiting 1.00 sec after reset
[1530709466.92][SERI][INF] wait for it...
[1530709466.92][SERI][TXD] mbedmbedmbedmbedmbedmbedmbedmbedmbedmbed
[1530709466.92][CONN][INF] sending up to 5 __sync packets (specified with --sync=5)
[1530709466.92][CONN][INF] sending preamble 'c550c4f6-142d-41dd-8848-ac685a497706'
[1530709466.92][SERI][TXD] {{__sync;c550c4f6-142d-41dd-8848-ac685a497706}}
[1530709467.06][CONN][RXD] mbedmbedmbedmbedmbedmbedmbedmbed
[1530709467.10][CONN][INF] found SYNC in stream: {{__sync;c550c4f6-142d-41dd-8848-ac685a497706}} it is #0 sent, queued..
.
[1530709467.11][HTST][INF] sync KV found, uuid=c550c4f6-142d-41dd-8848-ac685a497706, timestamp=1530709467.102000
[1530709467.12][CONN][INF] found KV pair in stream: {{__version;1.3.0}}, queued...
[1530709467.13][HTST][INF] DUT greentea-client version: 1.3.0
[1530709467.15][CONN][INF] found KV pair in stream: {{__timeout;20}}, queued...
[1530709467.15][HTST][INF] setting timeout to: 20 sec
[1530709467.18][CONN][INF] found KV pair in stream: {{__host_test_name;default_auto}}, queued...
[1530709467.18][HTST][INF] host test class: '<class 'mbed_host_tests.host_tests.default_auto.DefaultAuto'>'
[1530709467.18][HTST][INF] host test setup() call...
[1530709467.18][HTST][INF] CALLBACKs updated
[1530709467.18][HTST][INF] host test detected: default_auto
[1530709467.21][CONN][RXD] >>> Running 3 test cases...
[1530709467.26][CONN][INF] found KV pair in stream: {{__testcase_name;lp ticker info test}}, queued...
[1530709467.30][CONN][INF] found KV pair in stream: {{__testcase_name;lp ticker sleep test}}, queued...
[1530709467.35][CONN][RXD]
[1530709467.35][CONN][INF] found KV pair in stream: {{__testcase_name;lp ticker glitch test}}, queued...
[1530709467.39][CONN][RXD] >>> Running case #1: 'lp ticker info test'...
[1530709467.43][CONN][INF] found KV pair in stream: {{__testcase_start;lp ticker info test}}, queued...
[1530709467.48][CONN][INF] found KV pair in stream: {{__testcase_finish;lp ticker info test;1;0}}, queued...
[1530709467.53][CONN][RXD] >>> 'lp ticker info test': 1 passed, 0 failed
[1530709467.53][CONN][RXD]
[1530709467.58][CONN][RXD] >>> Running case #2: 'lp ticker sleep test'...
Exception in thread Thread-3:
Traceback (most recent call last):
File "c:\python27\lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "c:\python27\lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_greentea_cli.py", line 489, in run_test_thread
verbose=verbose)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_test_api.py", line 318, in run_host_test
returncode, htrun_output = run_htrun(cmd, verbose)
File "c:\python27\lib\site-packages\mbed_greentea\mbed_test_api.py", line 134, in run_htrun
htrun_output += line.decode('utf-8')
File "c:\python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 28: invalid start byte
mbedgt: could not generate test report
mbedgt: completed in 20.36 sec
mbedgt: exited with code -1000
[mbed] ERROR: "mbedgt" returned error code -1000.
[mbed] ERROR: Command "mbedgt --test-spec C:\mymbed\BUILD\tests\MIMXRT1050_EVK\ARM\test_spec.json -n mbed-os-tests-mbed_
hal-lp_ticker -V" in "C:\mymbed"
Pull request type