2024-04-27 12:19 AM - edited 2024-04-27 12:22 AM
Hi all, I tried to configure the clock to run at 32MHz and I was using Systick to toggle the LED every 1 Sec by configuring the Systick reload value by 32Mhz -1. But, Somehow toggling is not happening for exactly 1 sec, and also used a logic analyzer to check the period and it was not 1 sec. Somehow, I am not able to figure out the problem.
I selected HSE(8MHz) and PLL as a System clock. PLLM = 2,PLLN=16,PLLP=2. AHB prescaler as 1.
RCC.h
#include <stdint.h>
#ifndef RCC_H_
#define RCC_H_
#define RCC_BASE_ADDR 0x40023800 /* Base Addr of RCC */
#define FLASH_INTR 0x40023C00 /* Base of Flash Interface Register */
#define RCC_CR *(volatile uint32_t*)(RCC_BASE_ADDR + 0x00)
#define RCC_PLLCFGR *(volatile uint32_t*)(RCC_BASE_ADDR + 0x04)
#define RCC_CFGR *(volatile uint32_t*)(RCC_BASE_ADDR + 0x08)
#define RCC_APB1RSTR *(volatile uint32_t*)(RCC_BASE_ADDR + 0x20)
#define FLASH_ACR *(volatile uint32_t*)(FLASH_INTR + 0x00)
void clock_init();
void clock_init1();
#endif /* RCC_H_ */
RCC.c