Good day
The problem:
What I have done:
PB0 = LD1, PB7 = LD2, PB14 = LD3
main.c
to blink the LED. Please note I have commented out the Ethernet Init due to the expected hard fault as I have not configured ethernet and memory. MX_GPIO_Init();
//MX_ETH_Init();
MX_SPI1_Init();
MX_USART3_UART_Init();
MX_USB_OTG_FS_PCD_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_GPIO_TogglePin(GPIOB, 0);
HAL_GPIO_TogglePin(GPIOB, 7);
HAL_GPIO_TogglePin(GPIOB, 14);
HAL_Delay(1000);
}
Observations:
With the above lines of code only LD3 will blink. IF I try blink only LD3 and comment out the other two blink commands, then LD3 no longer blinks
If I set the startup conditions of the three LEDs to high (in either the gpio.c or in CubeMX) then all three LEDs turn on, but they will not blink thereafter.
Does anyone know what is going on here?
With much embarrassment, this is the problem. The API HAL_GPIO_TogglePin() requires very specific arguments.
The following examples do not work:
HAL_GPIO_TogglePin(A,12);
HAL_GPIO_TogglePin(GPIOA,12);
HAL_GPIO_TogglePin(A,GPIO_Pin_12);
Please make sure you use the proper handles and arguments:
HAL_GPIO_TogglePin(GPIOA,GPIO_Pin_12);