MODER register

Post here first, or if you can't find a relevant section!
Post Reply
poivretjulien
Posts: 3
Joined: Wed Jul 20, 2022 1:52 pm

MODER register

Post by poivretjulien »

Hello,
i'm trying to learn the board STM32F3DISCOVERY from the reference manual
but I need a quick hint on why the stm32core library from Arduino app doesn't allow to modify the GPIOE->MODER
( at 0x48001000 ) so if someone can tell me how I can take the control of my register board ?

Code: Select all

volatile uint32_t* _GPIOE = (volatile uint32_t *) 0x48001000;
volatile uint32_t* ODR = (volatile uint32_t *) 0x48001014;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Program start");
  Serial.println(*_GPIOE,HEX);
  *_GPIOE |= 0x40000; // writing fail disappointed...
  
  // the stm32 core doesn't allow a direct writing at the adress
  
  Serial.println(*_GPIOE,HEX);
  GPIOE->MODER |= 0x40000; // writing fail again...
  
  // even with it's own structure crazy...?
  
  Serial.println(*_GPIOE,HEX);
  pinMode(PE9,1); // the only way why?.
  Serial.println(GPIOE->MODER,HEX);
  Serial.println("There->");
  Serial.println(*_GPIOE,HEX);
}

void loop() {
  // put your main code here, to run repeatedly:
  *ODR ^= 0x200;
  Serial.println(*ODR,HEX);
  Serial.println(GPIOE->ODR,HEX);
  delay(500);
}
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: MODER register

Post by fpiSTM »

You have to enable the clock of the port G
poivretjulien
Posts: 3
Joined: Wed Jul 20, 2022 1:52 pm

Re: MODER register

Post by poivretjulien »

oh ! thinks I have forgotten that !
Post Reply

Return to “General discussion”