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

Add sleep features for MSP430 and MSP432 boards #75

Closed
wants to merge 5 commits into from

Conversation

elominp
Copy link

@elominp elominp commented Jun 9, 2019

Hello,

I modified a little bit your library to enable MSP430 and MSP432 based boards to use the sleep feature. It doesn't require a lot of change, just calling the sleep function on MSP430 boards and delay on MSP432 (as it uses TI-RTOS, delay yields the current thread and if there aren't any other TI-RTOS threads than the main Energia thread, it will put the board to sleep until the delay expires)

@arkhipenko
Copy link
Owner

Thank you. Will definitely look into this.
I think I need to extend the scheduler API to include a way to register a "sleep" callback method.
This would be a more generic and immediate solution for all the MCs out there...

@arkhipenko
Copy link
Owner

Please test the "testing" branch. I updated with your changes and overall support with custom sleep function.

@elominp
Copy link
Author

elominp commented Jun 12, 2019

I tried your testing branch with one of my MSP430 boards using the two first examples to see if the sleep works and it works OK :)

Here is the power trace of the Scheduler_example01 (without sleep) running:

example01_power_trace

Here is the power trace of the Scheduler_example02 (with sleep) running:

example02_power_trace_1

I can confirm the sleep is working as the mean current and total energy usage of the sketch running for 60 seconds is way below without the sleep and the Serial.println of Task2 does occur every around 500ms.

I don't have the time right now to test the MSP432 board but there shouldn't be any problem, the delay call does all the work.

@arkhipenko
Copy link
Owner

arkhipenko commented Jun 12, 2019 via email

@elominp
Copy link
Author

elominp commented Jun 12, 2019

I tried the example 6 IDLE (with sleep disabled and enabled) and the example23 on my MSP430 board, then ran them again on my MSP432 board and they all seem to run ok.

I took some screenshots of the results if you're interested:

Example 6 (without uncommenting the _TASK_SLEEP_ON_IDLE_RUN:

example06_scenario1_not_sleeping

The same example with the define uncommented (the mcu used less power and c1 result is inferior to the previous run as expected:

example06_scenario_2_sleep

Running the example 23 the timings using the empty sleep are identical to the delayed one by 1 millisecond but used more power, so the mcu sleep also worked here:

example23

For the MSP432, the tests also ran OK:

Example 1:

Scheduler_example01_msp432

Example 2:

Scheduler_example02_msp432

Example 6 with _TASK_SLEEP_ON_IDLE_RUN commented:

Scheduler_example06_msp432_without_sleep

Example 6 with _TASK_SLEEP_ON_IDLE_RUN uncommented:

Scheduler_example06_msp432_with_sleep

Example 23:

Scheduler_example23_msp432

So in conclusion: everythings works OK and I think your addition of the setSleepMethod callback is the great idea :)

@arkhipenko
Copy link
Owner

Thank you! This is the most thorough test I have received so far from anyone!!!

@arkhipenko arkhipenko closed this Jun 12, 2019
@elominp elominp deleted the energia branch June 13, 2019 04:46
@elominp
Copy link
Author

elominp commented Jun 13, 2019

You're welcome :)

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.

2 participants