AnsweredAssumed Answered

STM32F3Discovery and Keil Uvision, how can I write to a register?

Question asked by fauth.jeremy.001 on Feb 8, 2014
Latest reply on Feb 8, 2014 by Clive One
I am trying to understand the stm32 at a low level, and I think I understand how most of the registers I need to modify work, but I am looking for some simple C code to write data to a register. Right now I am trying to do something like this:


volatile unsigned int *peripheral;
            peripheral=(unsigned int*)GPIO_MODER_MODER9_0; //address I want to write to
            *peripheral=GPIO_E_start //data I want to put into the register (where I have defined GPIO_e_start as 0x48001000.


When I run this the code goes to the hard fault catcher, and I'm not sure what I'm doing wrong. Ideally I just want a small simple piece of code that allows me to write data to a register, but I have been stuck for a while now without success.