Table of Contents

Lab02 - Nucleo Intro

Using Terminal

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?

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.

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.

cd ../../Debug/

make clean

make
cp NUCLEO\ by\ Terminal.bin /media/YOUR_USER_NAME/NOD_F446RE

Using IDE

sudo bash FILENAME
Replace FILENAME with the name of the downloaded file.

Choose a project name and click Finish.

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?

Now your code has been transferred to the Nucleo Board, CONGRATUlATIONS!.

Lab tasks