Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
Hi all.
I'm going to use the Blink example from Arduino IDE 1.8.15 (my board is STM32F401RE).
How shall I put the names of the built-in LED into an Arduino sketch? Various names (D13, 13, LED_BUILTIN, etc.) don't work for me.
LED doesn't blink.
Upload via Mass Storage works (MBED Blink Example; .BIN export; DragNDrop to NUCLEO storage).
Thanks in advance,
Vadim.
I'm going to use the Blink example from Arduino IDE 1.8.15 (my board is STM32F401RE).
How shall I put the names of the built-in LED into an Arduino sketch? Various names (D13, 13, LED_BUILTIN, etc.) don't work for me.
LED doesn't blink.
Upload via Mass Storage works (MBED Blink Example; .BIN export; DragNDrop to NUCLEO storage).
Thanks in advance,
Vadim.
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
The LED_BUILTIN is a "board" selection in the IDE, not by chip architecture/model.Vadim777 post_[code wrote:[/code]id=7575 time=1624042360 user_id=1506]
Hi all.
I'm going to use the Blink example from Arduino IDE 1.8.15 (my board is STM32F401RE).
How shall I put the names of the built-in LED into an Arduino sketch? Various names (D13, 13, LED_BUILTIN, etc.) don't work for me.
The variant header sets the variable as below: (from Example)
Code: Select all
//On-board LED pin number
#ifndef LED_BUILTIN
#define LED_BUILTIN PC9
#endif
https://github.com/stm32duino/Arduino_C ... -64-boards
STM32F401RE Nucleo F401RE 0.2.1
or
STM32F401RB
STM32F401RC
STM32F401RD
STM32F401RE Generic Board 1.8.0
If you are using a generic board, you likely need to define your own LED_BUILTIN
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
So, this is the code:
It doesn't work for me.
What I'm doing wrong?
Thanks,
Vadim.
Code: Select all
//On-board LED pin number
#ifndef LED_BUILTIN
#define LED_BUILTIN PA5
#endif
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a 1000 millisecond
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a 1000 millisecond
}
What I'm doing wrong?
Thanks,
Vadim.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
simply use
where PAXX is your LED pin, and are you sure your LED is at PA5?
if you buy aftermarket stm32 boards, there are all kind of goofs like that the led is soldered reverse biased, check that out.
e.g. use a simple dry cell to test it, careful about blowing your mcu though.
there is one more possibility, the sketch failed to flash or failed to run, for that check the logs or use a debugger and a st-link v2.
Code: Select all
digitalWrite(PAXX, ! digitalRead(PAXX));
if you buy aftermarket stm32 boards, there are all kind of goofs like that the led is soldered reverse biased, check that out.
e.g. use a simple dry cell to test it, careful about blowing your mcu though.
there is one more possibility, the sketch failed to flash or failed to run, for that check the logs or use a debugger and a st-link v2.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
Yes, I'm sure. It's PA5 or D13, if I would like to use an Arduino convention.are you sure your LED is at PA5?
Yes, that is the first thing, that I was thinking of - I have an extra LED (with 1kOhm R) that I was connecting to the other pins (with the change of code).use a simple dry cell to test it
That was not working either. Furthermore, I have connected it to the Ground pin or to 3,3V pin with no results.
I have exported the .BIN file from Arduino IDE and have dragndropped it to the mounted NUCLEO. It was not working at all. The other .BINs (from online MBED compiler and from STM32CubeIDE) are working as expected.
Thanks,
Vadim.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
With the logs, is all OK. Once more, it works with the other .BINs, but not with Arduino's.the sketch failed to flash or failed to run
Thanks.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
If you select the generic F401RE then the LED_BUILTIN is defined as PNUM_NOT_DEFINED:
https://github.com/stm32duino/Arduino_C ... eric.h#L92
So you have to redefine it using build_opt.h
https://github.com/stm32duino/wiki/wiki ... uild_opt.h
Or if your board is a nucleo F401RE select it in nucleo64 board type.
https://github.com/stm32duino/Arduino_C ... eric.h#L92
So you have to redefine it using build_opt.h
https://github.com/stm32duino/wiki/wiki ... uild_opt.h
Or if your board is a nucleo F401RE select it in nucleo64 board type.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
It's a NUCLEO-64, not generic.
So, I have a partial success: the export of .BIN from Arduino IDE v2 (rev. beta 7) with the Arduino convention LED pin name D13 have succeeded.
Directly, I can not burn from Arduino IDE v2, because Arduino can not find the STM32CubeProgrammer executable, which in turn is needed for that. How can I tell IDE v2, where it is?
Thanks,
Vadim.
So, I have a partial success: the export of .BIN from Arduino IDE v2 (rev. beta 7) with the Arduino convention LED pin name D13 have succeeded.
Directly, I can not burn from Arduino IDE v2, because Arduino can not find the STM32CubeProgrammer executable, which in turn is needed for that. How can I tell IDE v2, where it is?
Thanks,
Vadim.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
You have to install it to the default location or add it to the path. See the wiki.
Re: Pin Names for LED_BUILTIN in Arduino 1.8.15 (STM32F401RE).
Anyway the simplest way is to use the mass storage upload method with a nucleo.