TI's SDK for the MSPM0 family has a set of examples. They are all targeting one of their LaunchPad dev kits. In this post, I'm porting another one to the EasyL1105.
The example, sysctl_shutdown, starts the MSPM0 in a selectable low power mode. You can then repeatedly wake it up by driving a GPIO input high. It's originally written for the LP-MSPM0L1117 LaunchPad. I'm porting it (just like I did in Port an SDK example to the EasyL1105 MSPM0 board ).
What does this project do?
It lingers in a selectable low power mode. You select the low power mode by wiring 2 GPIO inputs, named CONFIG_0 and CONFIG_1.
image source: the TI example referred to at the start of this blog
If you select SHUTDOWN, the MSPM0 wakes up when receiving a high signal on a GPIO pin. It 'll flash a led several times. 1 time for each time you've woken it up. Then back to SHUTDOWN.
The "flash a number of times" is interesting. This part of the example shows that we can preserve some active state (the variable counter) in SHUTDOWN mode
- Checks if it's woken up from SHUTDOWN
- If yes, increases counter, and flashes the green LED counter times.
- if not (usually, a power on or reset), it briefly flashes the blue LED.
- derives the desired low power level from the configuration pins
- sets the power policy
- saves state
- applies the set power policy
- low power
- if SHUTDOWN, wake up when GPIO pin driven high, then back to1.
Hardware resources
switch | PA17 | J3.2 (labeled UART TX). Connect a switch or a patch wire that allows you to either select GND or 3V3 |
LED1 | PA14 | Blue LED (on early rev 1, this is on PA26) |
LED2 | PA27 | Green LED |
CONFIG_0 | PA5 | J1.3 (labeled MOSI). Connect a switch or a patch wire that allows you to either select GND or 3V3 |
CONFIG_1 | PA6 | J1.2 (labeled SCK). Connect a switch or a patch wire that allows you to either select GND or 3V3 |
Testing
The low power modes are impossible hard to test with the debugger attached. Use a multimeter, oscilloscope or power meter to assess power use in low power and active mode.
- First set the two config pins to the combination High High (SHUTDOWN).
- Verify the current
- apply 3V3 to the switch pin. Each time you do that, the device will wake up and flash the green LED, for the amount of times you woke it up.
When you're finished
Low power designs can put your controller in a state, that makes it hard to reprogram it later. For this design, after you are done,
This will save you headaches later. |
Have fun!
ccs project adapted to EasyL1105: sysctl_shutdown_20250922.zip