Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2019
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
August Svensson
e7020e_2019
Commits
f4bf5bb0
Commit
f4bf5bb0
authored
6 years ago
by
August Svensson
Browse files
Options
Downloads
Patches
Plain Diff
bare7_2
parent
eb8a2f8b
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
examples/bare6.rs
+1
-2
1 addition, 2 deletions
examples/bare6.rs
examples/bare7.rs
+19
-6
19 additions, 6 deletions
examples/bare7.rs
openocd.gdb
+1
-1
1 addition, 1 deletion
openocd.gdb
pictures/bare_6_84mhz_high_speed.bmp
+0
-0
0 additions, 0 deletions
pictures/bare_6_84mhz_high_speed.bmp
with
21 additions
and
9 deletions
examples/bare6.rs
+
1
−
2
View file @
f4bf5bb0
...
@@ -82,8 +82,7 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) {
...
@@ -82,8 +82,7 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) {
// mco2 : SYSCLK = 0b00
// mco2 : SYSCLK = 0b00
// mcopre : divide by 4 = 0b110
// mcopre : divide by 4 = 0b110
rcc
.cfgr
rcc
.cfgr
.modify
(|
_
,
w
|
w
.mco2
()
.sysclk
()
.mco2pre
()
.div4
()
);
// w.mco2().bits(0b00).mco2pre().bits(0b110)
.modify
(|
_
,
w
|
unsafe
{
w
.mco2
()
.sysclk
()
.mco2pre
()
.div4
()
});
// w.mco2().bits(0b00).mco2pre().bits(0b110)
// power on GPIOC, RM0368 6.3.11
// power on GPIOC, RM0368 6.3.11
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpiocen
()
.enabled
()
);
//
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpiocen
()
.enabled
()
);
//
...
...
This diff is collapsed.
Click to expand it.
examples/bare7.rs
+
19
−
6
View file @
f4bf5bb0
...
@@ -30,10 +30,23 @@ fn main() -> ! {
...
@@ -30,10 +30,23 @@ fn main() -> ! {
let
p
=
hal
::
stm32
::
Peripherals
::
take
()
.unwrap
();
let
p
=
hal
::
stm32
::
Peripherals
::
take
()
.unwrap
();
let
rcc
=
p
.RCC
.constrain
();
// 16 MHz (default, all clocks)
let
rcc
=
p
.RCC
;
let
clocks
=
rcc
.cfgr
.freeze
();
// Output MCO2 to PC9 as SYSCLK/4:
rcc
.cfgr
.modify
(|
_
,
w
|
w
.mco2
()
.sysclk
()
.mco2pre
()
.div4
());
// Enable GPIOC:
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpiocen
()
.enabled
());
let
gpioc
=
p
.GPIOC
;
// Set Port C pin 9 to alternate function MCO2.
gpioc
.moder
.modify
(|
_
,
w
|
w
.moder9
()
.alternate
());
gpioc
.ospeedr
.modify
(|
_
,
w
|
w
.ospeedr9
()
.very_high_speed
());
// Now lock the clocks:
let
rcc
=
rcc
.constrain
();
let
clocks
=
rcc
.cfgr
.sysclk
(
84
.mhz
())
.pclk1
(
42
.mhz
())
.pclk2
(
42
.mhz
())
.freeze
();
let
gpioa
=
p
.GPIOA
.split
();
let
gpioa
=
p
.GPIOA
.split
();
...
@@ -145,15 +158,15 @@ fn main() -> ! {
...
@@ -145,15 +158,15 @@ fn main() -> ! {
//
//
// What is the frequency of MCO2 read by the oscilloscope.
// What is the frequency of MCO2 read by the oscilloscope.
//
//
// **
your answer here
**
// **
21.053 MHz
**
//
//
// Compute the value of SYSCLK based on the oscilloscope reading.
// Compute the value of SYSCLK based on the oscilloscope reading.
//
//
// **
your answer here
**
// **
MCO2 * MCO2PRE = 21.053 * 4 which is about 84 MHz.
**
//
//
// What is the peak to peak reading of the signal.
// What is the peak to peak reading of the signal.
//
//
// **
your answer here
**
// **
6.20 including the ringing, and without ringing 3.1 V
**
//
//
// Make a screen dump or photo of the oscilloscope output.
// Make a screen dump or photo of the oscilloscope output.
// Save the the picture as "bare_6_84mhz_high_speed"
// Save the the picture as "bare_6_84mhz_high_speed"
...
...
This diff is collapsed.
Click to expand it.
openocd.gdb
+
1
−
1
View file @
f4bf5bb0
...
@@ -16,7 +16,7 @@ monitor arm semihosting enable
...
@@ -16,7 +16,7 @@ monitor arm semihosting enable
# send captured ITM to the file (fifo) /tmp/itm.log
# send captured ITM to the file (fifo) /tmp/itm.log
# (the microcontroller SWO pin must be connected to the programmer SWO pin)
# (the microcontroller SWO pin must be connected to the programmer SWO pin)
# 16000000 must match the core clock frequency
# 16000000 must match the core clock frequency
monitor tpiu config internal /tmp/itm.log uart off 6
4
000000 #
16
000000
monitor tpiu config internal /tmp/itm.log uart off
1
6000000 #
64
000000
# OR: make the microcontroller SWO pin output compatible with UART (8N1)
# OR: make the microcontroller SWO pin output compatible with UART (8N1)
# 8000000 must match the core clock frequency
# 8000000 must match the core clock frequency
...
...
This diff is collapsed.
Click to expand it.
pictures/bare_6_84mhz_high_speed.bmp
0 → 100644
+
0
−
0
View file @
f4bf5bb0
422 KiB
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