STM32F3 GPIO Bit-banding question
Hello, I have purchased and used the NUCLEO-F303RE board.
I am trying to control the LED (PA5) using bit-banding.
With reference to the reference manual, I confirmed that the address of GPIOA starts from 0x48000000.
Then, I found and read the PM0214 document, which seems to say that only Peripheral in the area of 0x40000000-0x400FFFFF can be controlled.
So you are saying that my f303re board can't control gpio using bit_banding? And if so, how can I control it directly? Thank you.
This is my code.
/*
* bitband.h
*
* Created on: Jul 23, 2025
* Author: giwon30
*/
#ifndef INC_BITBAND_H_
#define INC_BITBAND_H_
#include "main.h"
//giwon 250723
//bit banding
//STM32F303RC
#define GPIO_PORT_A 0x48000000UL // GPIOA 베이스 주소
#define FIXED_GPIO_PIN_5 5 // PA5 핀
// GPIOA의 ODR 레지스터 주소 (출력 데이터)
#define GPIOA_ODR (GPIO_PORT_A + 0x14)
// 비트밴딩 별칭 영역 매크로 정의 (SRAM 영역)
#define BITBAND_SRAM_BASE 0x40000000UL
#define BITBAND_SRAM_ALIAS_BASE 0x42000000UL
// 비트밴딩 주소 계산 매크로
#define BITBAND_SRAM(address, bit) (BITBAND_SRAM_ALIAS_BASE + ((address - BITBAND_SRAM_BASE) * 32) + (bit * 4))
#define GPIOA_ODR (GPIO_PORT_A + 0x14)
#endif /* INC_BITBAND_H_ */
*(volatile uint32_t*)BITBAND_SRAM(GPIOA_ODR, FIXED_GPIO_PIN_5) = 1; // LED ON