cd NUCLEO\ by\ Terminal/Debug/ make clean make
Commands make
compiles your code and generates a .bin
file which is executable by your Nucleo board.
Note that if your machine cannot find the compiler, you may need to add it to append it to your PATH variable:
PATH=$PATH:*PATH TO COMPILER*In the labs, like this:
PATH=$PATH:/overlay/pivot/opt/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.17.0.201812190825/tools/compiler/bin
Go ahead and copy NUCLEO\ by\ Terminal.bin
file to your Nucleo board. You should know the proper command for this action so try it for yourself. Here is the answer:
cp NUCLEO\ by\ Terminal.bin /media/YOUR_USER_NAME/NODE_F446RE
Replace YOUR_USER_NAME
with your PC username. Congratulations, you have uploaded your first code to the Nucleo board. Wait what code?
main.c
by commands:
cd ../Core/Src/
The file main.c
is the file that you just uploaded to the board and your board is now executing this. Lets change this file and make our board blink an LED.
main.c
in an editor (preferably vim
but your choice). Replace line 99 of this code by the code below:
HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5); HAL_Delay(1000);The first line toggles your pin value connected to the LED, which means if your LED was on it would turn off and vice versa. The second line makes board wait for 1000ms and then again LED is toggled. As a result, you will see LED blinking every one second.
Go ahead and save the modifications of main.c
.
makefile
by
cd ../../Debug/
make clean
make cp NUCLEO\ by\ Terminal.bin /media/YOUR_USER_NAME/NOD_F446RE
.sh
.sh
file exist and write to terminal:
sudo bash FILENAMEReplace
FILENAME
with the name of the downloaded file.
y
to the first question and n
to the second question.
STMicroelectronics STM32CubeIDE
and open it.
File
on the top left corner. Click on New
and STM32 Project
. A window similar to the picture below must appear.
Board Selection
tab and in Part Number Search
search and click either NUCLEO-F401RE
or NUCELO-F446RE
. Choose your board in Board List
and click Next
.
Choose a project name and click Finish
.
yes
in the appeared dialog window.
core/src/main
.
while(1){}
block will be repeated by Nucleo board. For the sake of this introduction, we want to make the LED of the board blink. Insert the codes below to line 98.
HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5); HAL_Delay(1000);Any idea how these two lines make an LED blink? Any clue about periods of blinks?
/
otherwise your code will be deleted each time you compile your code.
Run
, Debug As
, STM32 MCU C/C++ Application
. In the appeared windows click on OK
and Switch
. If you face any error at this stage it is most probably because your board is not connected to the PC properly. If this is the case, please don't hesitate to inform instructors of the lab.
F8
key as shown below.
Now your code has been transferred to the Nucleo Board, CONGRATUlATIONS!.