2026-03-01 4:46 AM
One small issue I have. I have a custom STM32F411CEU6 board, quite similar to the WeAct Black Pill in terms of connections, except for the fact that I have a LED on pin PB13, and whenever I try to blink it using:
while (1)
{
/* USER CODE END WHILE */
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_13);
HAL_Delay(500);
/* USER CODE BEGIN 3 */
}in the STM32CubeIDE, everything works fine and dandy
The moment i switch to using the Arduino Framework, albeit with the Arduino IDE or PlatformIO, with parameters of:
platform = ststm32
board = genericSTM32F411CEusing the code:
#define LED PB13
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1000);
}or anything similar, it just doesn't work! It always says the upload is successful, and it verifies successfully too! But why then, it refuses to work? Any suggestions?
Solved! Go to Solution.
2026-03-01 4:52 AM
Hello @4896jazz and welcome to the ST community,
Unfortunately, you have an issue with Arduino environnement which is not an ST one (CubeIDE). You need to ask your question in the Arduino forum:
https://www.stm32duino.com/index.php
2026-03-01 4:52 AM
Hello @4896jazz and welcome to the ST community,
Unfortunately, you have an issue with Arduino environnement which is not an ST one (CubeIDE). You need to ask your question in the Arduino forum:
https://www.stm32duino.com/index.php
2026-03-01 9:27 AM
What board was selected to compile a code?
https://github.com/stm32duino/Arduino_Core_STM32#boards-available
Navigate to Variants in the installation directory
https://github.com/stm32duino/Arduino_Core_STM32/tree/main/variants/STM32F4xx/F411C(C-E)(U-Y)
to verify pins definition. You also have to confirm clock configuration.
BTW, you can use CubeMX code under arduino IDE:
static void cfg_Pins(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
/**TIM16 GPIO Configuration
PB8-BOOT0 ------> TIM16_CH1 :MSCLK
*/
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStruct.Alternate = GPIO_AF1_TIM16;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
//DEBUG
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
}than call function from setup() to config GPIO, same way as pinMode().
And drive pin by
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_15, GPIO_PIN_SET);
delay(200);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_15, GPIO_PIN_RESET);
2026-03-02 7:00 AM
@4896jazz wrote:The moment i switch to using the Arduino Framework, ?
Did you follow the instructions to set up your "Arduino Framework" for STM32?
https://github.com/stm32duino/Arduino_Core_STM32/wiki/Getting-Started
As @mƎALLEm suggests, this forum isn't really the place for Arduino questions.
Apart from the general Arduino forums, see https://www.stm32duino.com/ for questions specifically related to the STM32 Arduino Core