AnsweredAssumed Answered

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

Question asked by pavlovic.sasa on Aug 11, 2012
Latest reply on Aug 12, 2012 by pavlovic.sasa
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, #0x55555555         ; 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

Outcomes