From 1daf87a621f1beb6efcb1e4644ea526646f9147f Mon Sep 17 00:00:00 2001 From: Per Lindgren <per.lindgren@ltu.se> Date: Tue, 8 Jan 2019 23:33:44 +0100 Subject: [PATCH] bare7 --- .vscode/launch.json | 93 +++++++++++++++++++++++++++++++++++++++++++++ .vscode/tasks.json | 12 ++++++ examples/bare6.rs | 44 +-------------------- 3 files changed, 106 insertions(+), 43 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index b26af04..1cc5296 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -408,6 +408,99 @@ }, "cwd": "${workspaceRoot}" }, + { + "type": "cortex-debug", + "request": "launch", + "servertype": "openocd", + "name": "bare7 (debug)", + "preLaunchTask": "cargo build --example bare7 --features stm32f4", + "executable": "./target/thumbv7em-none-eabihf/debug/examples/bare7", + // uses local config files + "configFiles": [ + "./stlink.cfg", + "./stm32f4x.cfg" + ], + "postLaunchCommands": [ + "monitor arm semihosting enable" + ], + "swoConfig": { + "enabled": true, + "cpuFrequency": 16000000, + "swoFrequency": 2000000, + "source": "probe", + "decoders": [ + { + "type": "console", + "label": "ITM", + "port": 0 + } + ] + }, + "svdFile": "STM32F413.svd", + "cwd": "${workspaceRoot}" + }, + { + "type": "cortex-debug", + "request": "launch", + "servertype": "openocd", + "name": "bare7 (debug) 64MHz", + "preLaunchTask": "cargo build --example bare7 --features stm32f4", + "executable": "./target/thumbv7em-none-eabihf/debug/examples/bare7", + // uses local config files + "configFiles": [ + "interface/stlink.cfg", + "target/stm32f4x.cfg" + ], + "postLaunchCommands": [ + "monitor reset halt" + ], + "swoConfig": { + "enabled": true, + "cpuFrequency": 64000000, + "swoFrequency": 2000000, + "source": "probe", + "decoders": [ + { + "type": "console", + "label": "ITM", + "port": 0 + } + ] + }, + "svdFile": "STM32F413.svd", + "cwd": "${workspaceRoot}" + }, + { + "type": "cortex-debug", + "request": "launch", + "servertype": "openocd", + "name": "bare7 (debug) 84MHz", + "preLaunchTask": "cargo build --example bare7 --features stm32f4", + "executable": "./target/thumbv7em-none-eabihf/debug/examples/bare7", + // uses local config files + "configFiles": [ + "interface/stlink.cfg", + "target/stm32f4x.cfg" + ], + "postLaunchCommands": [ + "monitor reset halt" + ], + "swoConfig": { + "enabled": true, + "cpuFrequency": 84000000, + "swoFrequency": 2000000, + "source": "probe", + "decoders": [ + { + "type": "console", + "label": "ITM", + "port": 0 + } + ] + }, + "svdFile": "STM32F413.svd", + "cwd": "${workspaceRoot}" + }, { "type": "cortex-debug", "request": "launch", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 39c537c..06b3cd1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -207,5 +207,17 @@ "isDefault": true } }, + { + "type": "shell", + "label": "cargo build --example bare7 --features stm32f4", + "command": "cargo build --example bare7 --features stm32f4", + "problemMatcher": [ + "$rustc" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, ] } \ No newline at end of file diff --git a/examples/bare6.rs b/examples/bare6.rs index 925ca53..cd278a6 100644 --- a/examples/bare6.rs +++ b/examples/bare6.rs @@ -149,7 +149,7 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) { // Make a screen dump or photo of the oscilloscope output. // Save the the picture as "bare_6_16mhz_high_speed". // -// commit your answaaasers (bare6_2) +// commit your answers (bare6_2) // // 3. Now run the example in 64Mz // You can do that by issuing a `monitor reset init` @@ -186,45 +186,3 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) { // // commit your answers (bare6_4) // -// 5. Now we will put the MCU in 84MHz using the function -// clock::set_84_mhz(rcc, flash); -// -// This function is part of the `f4` support crate (by Johonnes Sjölund) -// besides `rcc` (for clocking) it takes `flash` as a parameter to set -// up correct latency (wait states) for the flash memory (where our -// program typically resides). This is required since the flash cannot -// operate at the full 84MHz, so the MCU has to wait for the memory. -// -// Repeat the experiment 2. -// -// What is the frequency of MCO2 read by the oscilloscope. -// -// ** your answer here ** -// -// Compute the value of SYSCLK based on the oscilloscope reading. -// -// ** your answer here ** -// -// What is the peak to peak reading of the signal. -// -// ** your answer here ** -// -// Make a screen dump or photo of the oscilloscope output. -// Save the the picture as "bare_6_84mhz_high_speed" -// -// commit your answers (bare6_5) -// -// 6. Now reprogram the PC9 to be "Low Speed", and re-run at 84Mz. -// -// Did the frequency change in comparison to assignment 5? -// -// ** your answer here ** -// -// What is the peak to peak reading of the signal (and why did it change)? -// -// ** your answer here ** -// -// Make a screen dump or photo of the oscilloscope output. -// Save the the picture as "bare_6_84mhz_low_speed". -// -// commit your answers (bare6_6) -- GitLab