mirror of
https://github.com/ComNets-Bremen/WUSN.git
synced 2025-08-03 02:00:04 +02:00
.. | ||
README.md |
This manual worked on Manjaro Linux, no guarantee for other distros/operations systems.
Installing Micropython on STM32 board
- Install micropython unix from https://github.com/micropython/micropython
-
Clone repository
git clone https://github.com/micropython/micropython
-
Build micropython
$ cd ports/unix $ make submodules $ make
-
check installation
$ ./micropython
-
Run complete testsuite
$ make test
-
- Install STM32 version
-
Build:
$ cd ports/stm32 $ make submodules $ make
-
Install pyusb if not done already
$ pip3 install pyusb
-
put board in DFU mode
- Either by running the command
machine.bootloader()
in REPL - Or by pulling BOOT0 to 3.3V and reset the board
- Either by running the command
-
Flash the code via USB DFU to your device
$ make BOARD=NUCLEO_L073RZ deploy-stlink
-
If 4. doesn’t work:
- install STM32CubeProgrammer
- press connect and go to Erasing & Programming then install /micropython/ports/stm32/build-NUCLEO_L073RZ/firmware.bin which you built in step 4
-
Running Code
-
Connect board to PC
-
Find the path the Board is connected to
- usually it is at ttyACM0
- sudo dmesg | grep tty often helps, the entire list of devices can be found using /sys/class/tty
-
For testing purposes you can install rshell
- run rshell -p /dev/ttyACM0 (adjust the path name accordingly)
- enter the command repl
- now you can run some commands for testing, for example:
-
Hello World
print(„Hello world“)
-
Toggle LED:
>>> import pyb >>> pyb.LED(1).on() >>> pyb.LED(1).off()
-
-
Now configure your IDE i.e. VS Code by installing the pymakr extension
-
If you have troubles, try adding yourself to the dialout group
sudo usermod -a -G dialout <your-username>
-
-
If 4 doesn’t work, files can be uploaded via rshell by using the command
cp filename.py /pyboard