Solved
GPIO strange issue
I have this code that works and i can turn an LED on:
#include "stm32f10x.h"
void RCC_Init(void){
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
}
void GPIO_Init(void){
GPIOC->CRH |= GPIO_CRH_CNF13_0 | GPIO_CRH_MODE13_0 | GPIO_CRH_MODE13_1;
}
int main(void){
RCC_Init();
GPIO_Init();
GPIOC->BSRR = GPIO_BSRR_BR13;
while(1){
}
return 0;
}but when i change my port it doesn't work:
#include "stm32f10x.h"
void RCC_Init(void){
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
}
void GPIO_Init(void){
GPIOA->CRL |= GPIO_CRL_CNF7_0 | GPIO_CRL_MODE7_0 | GPIO_CRL_MODE7_1;
}
int main(void){
RCC_Init();
GPIO_Init();
GPIOA->BSRR = GPIO_BSRR_BS7;
while(1){
}
return 0;
}Based on the datasheet and the clock table shown, it should work. Can anyone point out the problem to me?
