Hi.
I struggle with stm32f030r8 arm programming on atollic true studio ide.
I have some problem with reading correct data from idr register.
I make pull down PUPR register of GPIOB(0,1,2,3).
Other pins of GPIOB is output that i make with MODER register.
when i read idr data under loop every time i read F value but there is not any input.
Please help me to solve this problem
It takes my 25 days from my life.))
#include "main.h"
int main(void){ volatile static uint16_t PortDataInput=0x00; RCC->CR|=(uint32_t)0xF1; //set hsi clock source and with max speed GPIOB->PUPDR|=0xAA; //set firt 4 bit of portb as pull down GPIOB_RCC->AHBENR|=(1<<18); //enable portb clock source GPIOB->MODER|=0x55555500; //set firt 4 bit of portb as input GPIOB->OTYPER|=0x00000000; //set output pins of portb as push pull while (1) { PortDataInput=GPIOB->IDR; PortDataInput&=0xF;
}
I have put question to stack overflow but there was no the correct answer to my question.Finally i found the solution you can get the correct answer from this link
https://stackoverflow.com/questions/56828145/incorrect-value-when-reading-gpiob-idr-register/56922658#56922658