Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
low-power-stm32f103c8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
low-power-stm32f103c8
Commits
547089f2
Commit
547089f2
authored
7 years ago
by
Per
Browse files
Options
Downloads
Patches
Plain Diff
standby 3uA
parent
31dff2f6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.vscode/launch.json
+25
-0
25 additions, 0 deletions
.vscode/launch.json
examples/standby.rs
+40
-2
40 additions, 2 deletions
examples/standby.rs
with
65 additions
and
2 deletions
.vscode/launch.json
+
25
−
0
View file @
547089f2
...
@@ -82,6 +82,31 @@
...
@@ -82,6 +82,31 @@
},
},
"cwd"
:
"${workspaceRoot}"
"cwd"
:
"${workspaceRoot}"
},
},
{
"type"
:
"cortex-debug"
,
"request"
:
"launch"
,
"servertype"
:
"openocd"
,
"name"
:
"standby (release)"
,
"executable"
:
"./target/thumbv7em-none-eabihf/release/examples/standby"
,
"configFiles"
:
[
"interface/stlink.cfg"
,
"target/stm32f4x.cfg"
],
"swoConfig"
:
{
"enabled"
:
true
,
"cpuFrequency"
:
8000000
,
"swoFrequency"
:
2000000
,
//
you
may
try
1000000
if
not
working
"source"
:
"probe"
,
"decoders"
:
[
{
"type"
:
"console"
,
"label"
:
"Name"
,
"port"
:
0
}
]
},
"cwd"
:
"${workspaceRoot}"
},
{
{
"type"
:
"cortex-debug"
,
"type"
:
"cortex-debug"
,
"request"
:
"launch"
,
"request"
:
"launch"
,
...
...
This diff is collapsed.
Click to expand it.
examples/standby.rs
+
40
−
2
View file @
547089f2
...
@@ -34,16 +34,54 @@ extern crate stm32f40x;
...
@@ -34,16 +34,54 @@ extern crate stm32f40x;
extern
crate
cortex_m_rt
as
rt
;
extern
crate
cortex_m_rt
as
rt
;
// makes `panic!` print messages to the host stderr using semihosting
// makes `panic!` print messages to the host stderr using semihosting
extern
crate
panic_semihosting
;
//
extern crate panic_semihosting;
extern
crate
panic_abort
;
use
cortex_m
::
asm
;
use
cortex_m
::
asm
;
use
rt
::
ExceptionFrame
;
use
rt
::
ExceptionFrame
;
use
cortex_m
::
peripheral
::{
Peripherals
,
SCB
};
use
stm32f40x
::
DBG
;
// the program entry point is ...
// the program entry point is ...
entry!
(
main
);
entry!
(
main
);
// ... this never ending function
// ... this never ending function
fn
main
()
->
!
{
fn
main
()
->
!
{
// let scb = p.core.SCB;
asm
::
bkpt
();
let
mut
p
=
Peripherals
::
take
()
.unwrap
();
p
.SCB
.set_sleepdeep
();
let
mut
r
=
stm32f40x
::
Peripherals
::
take
()
.unwrap
();
let
v
=
r
.DBG.dbgmcu_cr
.read
();
r
.DBG.dbgmcu_cr
.modify
(|
_
,
w
|
{
w
.dbg_sleep
()
.clear_bit
()
.dbg_stop
()
.clear_bit
()
.dbg_standby
()
.clear_bit
()
});
let
v1
=
r
.DBG.dbgmcu_cr
.read
();
asm
::
bkpt
();
// enable pwr
r
.RCC.apb1enr
.modify
(|
_
,
w
|
w
.pwren
()
.set_bit
());
// standby mode
r
.PWR
.cr
.modify
(|
_
,
w
|
w
.pdds
()
.set_bit
()
.cwuf
()
.clear_bit
());
// // pwr.cr.modify(|_, w| w.lpds().clear_bit()); // regulator in normal mode
// pwr.cr.modify(|_, w| w.lpds().set_bit()); // regulator in low power mode
// exti.pr.write(|w| unsafe { w.bits(0) }); // clear pending register
// pwr.csr.modify(|_, w| w.ewup().set_bit()); // clear pending wake up
asm
::
bkpt
();
loop
{
loop
{
asm
::
wfi
();
asm
::
wfi
();
asm
::
bkpt
();
asm
::
bkpt
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment