cancel
Showing results for 
Search instead for 
Did you mean: 

Can't acess peripheral memory with normal load/store instructions

sasapavlovic
Associate II
Posted on August 11, 2012 at 10:32

Hey guys, does someone knows why access to peripheral memory location (0x40000000 - 0x5FFFFFFF) can't be done with normal LDR and STR instructions. It works fine in simulation but when flashed in the chip, the memory accesses are bypassed (can't modify bits) in a peripheral register. Here's a simple example written in Keil where I attempt to access a GPIO register in modify the bits. The target is STM32F407VG

________________________________________________________

STACK_TOP     EQU       0x20000400    ; Top of the stack adress

GPIO_TOP      EQU       0x40020000       ; Start adresse of GPIO-D in stm32f407VG

        AREA  Reset, CODE, READONLY

       

               

__Vector_Table

        DCD  STACK_TOP               ;0x00

        DCD  Reset_Handler           ;0x04

       

        ENTRY

Reset_Handler

        

        LDR  r0, =GPIO_TOP                 

        MOV  r1, &sharp0x55555555         ; configuration to make the pins in outpout mode

        STR  r1, [r0]                          ; attempt to write to register...works in simulation not  when flashed in the chip

       

stop    B   stop

       

       

        END

#gpio-rcc
4 REPLIES 4
Posted on August 11, 2012 at 13:29

I don't have a board at hand, but I think you're writing to the GPIOA->MODER register and busting the JTAG/SWDIO

GPIOD base is at 0x40020C00 if I'm not mistaken.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sasapavlovic
Associate II
Posted on August 11, 2012 at 16:31

True, but it hasn't change anything when i changed the base register adresse. Thanks anyways

jpeacock2399
Associate II
Posted on August 12, 2012 at 18:52

Where do you enable the GPIO peripheral clock?  Not much will happen without it.

  Jack Peacock

sasapavlovic
Associate II
Posted on August 12, 2012 at 20:36

I love you jack ehehhe thank you very much