STM32 NUCLEO F401RE无法写入GPIO BSRR中的某些位

STM32 NUCLEO F401RE cannot write to some bits in GPIO BSRR

我最近买了一个 STM-NUCLEO,我正在尝试写入连接到 LED 的 PA0、PA1、PA2、PA3。连接到 PA0 和 PA1 的 LED 按预期点亮,但 PA2 和 PA3 没有。我用 PA4 试了一下,效果也不错。这是代码:

int main(void)
{

  /* Configure the System clock to 84 MHz */
  SystemClock_Config();

  RCC->AHB1RSTR |= RCC_AHB1RSTR_GPIOARST; // resetting GPIOA
    RCC->AHB1RSTR = 0; //exiting reset state
    RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN; //enabeling GPIOA clock
    GPIOA->MODER |= GPIO_MODER_MODER0_0;
    GPIOA->MODER |= GPIO_MODER_MODER1_0;
    GPIOA->MODER |= GPIO_MODER_MODER2_0;
    GPIOA->MODER |= GPIO_MODER_MODER3_0;
    //setting the pins
    GPIOA->BSRR |= (1<<0);
    GPIOA->BSRR |= (1<<1);
    GPIOA->BSRR |= (1<<2);
    GPIOA->BSRR |= (1<<3);
  /* Add your application code here*/

  /* Infinite loop */
  while (1)
  { 

  }
}

根据 Nucleo schematics,PA2 和 PA3 连接到内部 ST-Link 控制器,因此如果不先添加和删除一些桥,则不能用于 GPIO。

那是你的MCU,"SB62, SB63 Default open"表示没有连接。

这是连接到 ST-Link 接口的地方。