Nucleo Boards

From RobolaboWiki
Revision as of 13:51, 30 July 2019 by Aguti (Talk | contribs)

Jump to: navigation, search


STM32CubeIDE

Installation

Linux

Last release of STM32CubeIDE can be obtained here: https://www.st.com/en/development-tools/stm32cubeide.html.
For Debian like distributions (e.g. ubuntu), download the STM32CubeIDE-DEB file. To download it, you will need to provide name and a valid email address.

Unzip the file (e.g. <FILE> = en.st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb_bundle)

unzip <FILE>.sh.zip

It will generate a .sh file. Give it permits for execution.

chmod 777 <FILE>.sh

Finally, execute the installation

sudo ./<FILE>.sh

You must accept all license agreements.


Windows

Last release of STM32CubeIDE can be obtained here: https://www.st.com/en/development-tools/stm32cubeide.html. .
For Windows like distributions, download the STM32CubeIDE-Win file. To download it, you will need to provide name and a valid email address.

Unzip the file and execute the binary. Follow all steps and accept all conditions.

MAC

Hello World

In this Section a Hellow World (led blinking) example will be programmed on a NUCLEO-F446RE board:

  • Open STM32CubeIDE
  • Select where to store the workspace. This will be the folder where different projects could be stored.
  • Select Start new STM32 project
  • A microcontroller or board should be selected. In our case, a NUCLEO-F446RE will be used. Then, select board selector and search part number Nucleo-F446RE . Once chosen, press Next
  • Chose a Project name (e.g. ledp) and keep the rest of parameters as they are. Press Finish
  • The STM32CubeIDE will ask if you want Initialize all peripherals with their default Mode. Answer Yes
  • The STM32CubeIDE will inform that yhis kind of projects is associated with the STM32CubeMx prespective and will ask if you want to open this perspective now. Answer Yes .
    Download of required libraries will start. It could take long for the first time depending on your connection settings.
  • Once the project is open, on the left side on the "Project Explorer", look for Src -> main.c .
    Inside the code, look for the while(1) sentence in the main(void) function, and fill it as follows:
    while (1)
    {
      HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
      HAL_Delay(100);
     /* USER CODE END WHILE */
    
     /* USER CODE BEGIN 3 */
    }
    /* USER CODE END 3 */
    
    
  • In order to compile, Go to Project -> Build All (Ctrl+B or Hammer) . It should compile the code without errors.
    If any error appears, previous steps should be reviewed.
  • In order to start the debugger, Go to Run -> Debug (F11 or bug)
    Select STM32 MCU C/C++ Application and Press OK
  • Leave all configuration propeties as they are and Press OK
  • The STM32CubeIDE will ask if you want to switch to the debug perspective say Switch
  • In order to execute the code, Go to Run -> Resume (F8 or Green Arrow) .
    The led should be blinking at 100 ms.