Skip to main content
M. Jeong
Associate III
May 3, 2018
Question

STM32L4 register setting

  • May 3, 2018
  • 2 replies
  • 680 views
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 }

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    May 3, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Andrei Chichak
    Lead
    May 3, 2018
    Posted on May 03, 2018 at 20:21

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