Windows 10 quick start guide
These steps are to be carried out by the teacher with administrator rights under Windows 10 and this for each NUCLEO WB55 board used in the practical work.
Electronic settings
You will need a USB to micro USB cable.
This configuration is:
- Move the jumper to USB_MCU
- Move the SWDIO jumper and place it on pins 5 and 7 of the ARDUINO CN7 connector
- Connect a micro USB_USER cable to the port below SW4
Here is how the kit should be configured:
These modifications allow the STM32WB55 to be configured in bootloader mode. We will be able to update the firmware by USB.
Board programming
Download the “TP Python” folder on the Windows Desktop, available on the drive: TP_Python.zip
This file must be present on each workstation.
Here is the list of files in the folder:
Connect the NUCLEO-WB55 board to your computer with the USB cable .
The first step is to install the free USB drivers to communicate with the STM32WB55 board. For this we will use the Zadig software.
Installation of the free USB driver (Zadig)
Double-click on the “Zadig” software.
Allow the application to make changes by clicking the “Yes” button.
Here is the interface:
Go to “Options” then click on “List All Devices”.
Select “USB DFU in FS mode” from the drop-down list. If it doesn’t appear in the drop-down list, change the USB cable (some cables don’t work).
Select “libusbK (v3.0.7.0)” using the arrows:
Then start the driver installation by clicking on “Replace Driver”.
We are now using USB communication with the NUCLEO-WB55 board under Windows.
Exit to Zadig software.
Programming the board’s MicroPython firmware (dfu-util)
It is now mandatory to program the card with the MicroPython firmware. We will use the ** dfu-util ** software for this. This step could potentially be performed by the student, in the event that the MicroPython firmware needs to be updated.
Use the “flash_dfu-util” software by double-clicking on it. Then, allow Windows to run the program.
A command prompt windows opens (it may be too fast to see it), please wait for programming to finish:
When the window is closed, programming is complete
Now you need to move the jumper from connector CN7, PIN 5-7 to SWDIO:
Press the Reset button (SW4) above the USB_USER socket on the development kit.
A Windows message appears:
Don’t pay attention to the message: drive problem
If you see this message, the operation is done
You can now communicate with the MicroPython software via the USB link.
Let’s look at the files generated by the MicroPython system with the Windows explorer:
Open the PYBFLASH device with Windows Explorer.
We will see later how to edit the Python scripts available in the PYBFLASH filesystem.
First we will try to communicate with the Python command interpreter directly on the NUCLEO-WB55 development kit.
Installation of the programming environment
These manipulations should be mastered by the students so that they can communicate with the interpreter and edit MicroPython scripts on the NUCLEO-WB55 kit.
Setting of the communication terminal
Now, MicroPython is present on the NUCLEO-WB55 kit. We need to test communication with Python. The test consists in sending a python command and checking that the execution is OK.
Communication is done by USB through a serial port, we need software to send the python commands as text to the board and receive the result of the execution.
To do this, start Puttytel, available in the TP_Python directory:
Select the option Serial
:
Set the fields Serial Line
to COM3
and Speed
to 115200
. Then click on ʻOpen`.
If the following message appears:
Check if the kit is enumerated on the correct COM port, see ** Checking the COM port allocation **.
Otherwise, a new window is displayed:
Press CTRL + C to bring up the python command interpreter:
You can now run Python commands.
print("Hello World")
Programming MicroPython firmware is now done.
NUCLEO-WB55 development kit is now ready for use with Python.
Keep the Putty window open, it will be useful for you to see the execution of scripts.
** NOTE: ** Autocompletion (press TAB) is available during serial communication.
Setting of the python script editor
We will see, in this part, how to set up a MicroPython development environment.
Installation of the environment
Run the installer Portable Python-3.8.0 x64.exe
, the installer will ask you where to extract the Python environment.
Use the ...
button to select the TP_Python
folder on your Desktop.
Then wait the files extraction.
We now have a Python development environment with which the developer can write MicroPython scripts.
The environment is available in the TP_Python \ Portable Python-3.8.0 x64
folder:
Launch the PyScript-Launcher
tool:
This tool will allow you to debug and run your python scripts.
** Important notes: **
The
pyb
library, i.e. the grouping of micropython functions for accessing microcontroller peripherals, is not available when debugging scripts on Windows.
Be careful to use only the Python-3 libraries ported under micropython. For example the
numpy
library is not yet officially implemented in MicroPython, it will therefore be impossible to perform an ʻimport numpy` in a MicroPython script intended to be downloaded into the NUCLEO-WB55.
Here is the list of libraries that can be used with MicroPython: http://docs.micropython.org/en/latest/library/index.html#micropython-specific-libraries
The python script editor (PyScript) is useful for algorithm testing or automatic completion of python methods.
Write and run a MicroPython script
Return to the PyScript-Launcher script editor, then expand the PYBFLASH player:
Here we see 2 interesting files: boot.py
and main.py
.
Le script * boot.py *, à modifier par les utilisateurs avancés, est utilisé pour initialiser MicroPython.Il vous permet de choisir quel script sera exécuté après le démarrage de MicroPython, par défaut le script main.py
.
Leave the initial setup for now.
We will look at the main.py
script.
Double-click on it:
The first script will be to display the message MicroPython is awesome
10 times with the message number.
Write the following algorithm in the script editor:
Run and check the result of it by pressing
The script works fine on Windows, now we want to run it on the NUCLEO-WB55 board.
Save the script main.py
( CTRL + S
), then return to the Putty terminal.
The script will be executed when restarting MicroPython.
To restart, press CTRL + C
(to display the interpreter >>>
) then CTRL + D (to force the restart) in the Putty terminal:
The script is successfully executed ! The message is displayed 10 times in the terminal.
We are now ready to perform MicroPython commands to access the peripherals of the STM32WB55 microcontroller.
Appendix: Check the COM port allocation
A COM
port was created on Windows.
Write device manager
in the Windows search bar, then click on ʻOpen`:
A new window opens:
Note the number of the COM
port. In the example above, the NUCLEO kit is plugged into the COM3
port. It is this COMx
number that must be entered in Putty.