cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 register setting

M. Jeong
Associate II
Posted on May 03, 2018 at 19:43

I'm trying to program STM32L4-discovery board using the registers of ST32L4 only. I wanted to modify flash latency and see if the register value really changes by using gdb. However, it turned out that the following simple program doesn't make any change in FLASH->ACR and PWR->CR2. Is it normal that you cannot just write to the registers?

   1 #include 'main.h'

    2 #include 'stm32l4xx.h'

    3

    4

    5 int main(void)

    6 {

    7     PWR->CR2 = 1U;

    8     FLASH->ACR |= 1U <<2;

    9 }

2 REPLIES 2
Posted on May 03, 2018 at 19:58

Shouldn't exit main ()

Need to make sure synchronous peripherals have their clock enabled, PWR may also need to be unlocked. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 03, 2018 at 20:21

What does the boot code do before control is passed to main?