Why can I only use 2 GPIO pins?
I am only able to use 2 GPIO pins with an STM32F767ZI on a Nucleo-144 board. The issue doesn't appear to be with any specific pins, it's just that only 2 pins seem to output any voltage at all.
Take this code for example:
main.c
#include "./headers/stm32f767xx.h"
#include <stdint.h>
int main(void)
{
initMotor(0);
initMotor(1);
initMotor(2);
uint32_t a = 0;
while (1)
{
if (a >= 25000)
{
stepMotor(0);
stepMotor(1);
stepMotor(2);
a = 0;
}
a++;
}
}./drivers/motor.c
#include "../headers/stm32f767xx.h"
void initMotor(int step_pin)
{
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOGEN;
GPIOG->MODER |= (0b01 << (step_pin * 2));
GPIOG->OTYPER &= ~(0b1 << step_pin);
GPIOG->ODR &= ~(0b1 << step_pin);
}
void stepMotor(int step_pin)
{
GPIOG->ODR ^= (0b1 << step_pin);
}Using this code, only 2 of the 3 GPIO ports give out a voltage as I would expect them to. If main.c is modified to remove any of the three motors/pins, the other two will work (they give out a voltage which changes from HIGH to LOW every time period).
This issue extends even when adding LEDs which are already on the board.
Only a maximum of 2 GPIO pins (regardless of whether it is GPIOA, GPIOB, etc.) ever seem to work.
I am very unsure of the cause of this, and would appreciate any direction that people can point me in.
