Skip to content
Snippets Groups Projects
Commit 076f6039 authored by dwillmore's avatar dwillmore
Browse files

Add readme, graphs, and remove old comments from code

parent a20c6e97
No related branches found
No related tags found
No related merge requests found
examples/hsitrim/HSITRIM.png

21.7 KiB

examples/hsitrim/HSITRIM_graph.png

65.1 KiB

This example demonstrates the HSITRIM feature of the High Speed Internal clock. Upon startup, the HSICAL value
is loaded into the RCC_CTLR register and HSICAL is loaded with the value 16 i(0b10000). This example uses the MCO
feature to route the HSI clock signal to an external pin (PC4) and to allow the HSITRIM value to be varied by
interactive commands over the serial port.
<img src="./HSITRIM.png" alt="Serial console display showing HSITRIM register parsed into fields and a prompt to tune HSITRIM" width="550">
<img src="./HSITRIM_graph.png" alt="Example Data of HSITRIM register value versus frequency" width="550">
......@@ -21,7 +21,6 @@ int main()
SystemInit48HSI();
SetupUART( UART_BRR );
// SetupDebugPrintf();
Delay_Ms(50);
printf("\r\r\n\nHSITRIM example.\r\n");
......@@ -50,7 +49,6 @@ int main()
printf("Enabling HSI signal with MCO function on PC4\r\n");
regtemp = (RCC->CFGR0 & ~RCC_CFGR0_MCO) | RCC_CFGR0_MCO_HSI;
RCC->CFGR0 = regtemp;
// Delay_Ms(5000);
// Setup UART RX pin SetupUART() does most of the work. ###beware### if you use DebugPrintf, this will break!
// Input, GPIO D6, with AutoFunction
......@@ -62,7 +60,6 @@ int main()
while(1){
if(USART1->STATR & USART_STATR_RXNE){
key = (uint8_t)USART1->DATAR;
// printf("Got key '%c'\r\n", key);
if(key == '.'){
if(trim < 0x1f) trim++;
printf("Setting HSITRIM to: 0x%02lX\r\n", trim);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment