Setup commandline-based MicroPython development environment on Linux, macOS and Windows


#1

Hi there,

Introduction

We recently made some efforts to verify our commandline-driven MicroPython development environment on Linux, macOS and Windows.

Installation

We would like to outline some steps for a successful installation here. Please let us know about any obstacles you might encounter as it will indirectly help others by improving the documentation.

Install Linux on WSL for Windows10

Install the development sandbox on Linux

See also: Hiveeyes MicroPython Datalogger setup.

1. Prerequisites

We need some packages for our work:

apt update
apt install make patch wget git python python3 python-virtualenv

2. Make or go to your working directory

cd /home
mkdir cgruber
cd cgruber

You should now have a prompt similar to
root@XPS13-CGruber:/home/cgruber#

3. Acquire source code

First, let’s create a specific development folder called "sources" directory and go there.

mkdir -p hiveeyes/sources
cd hiveeyes/sources/

There, let’s clone the Git repository from GitHub and change into that folder.

git clone https://github.com/hiveeyes/hiveeyes-micropython-firmware
cd hiveeyes-micropython-firmware/

In case you have this done a time ago and want to grab the latest version use

git pull 

4. Configure your environment

Set your serial port with, in this case 16:

export MCU_SERIAL_PORT=/dev/ttyS16

You can check if this was done allready with

env

5. Go to the firmware dir and run setup

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware#

make setup

6. Edit your settings file

Finally make a local copy of your setting file for the LoPy or FiPy and edit your settins:

cp settings.example.py settings.py
nano settings.py

(of cause you can use emacs or vim instead of nano also ;-)

7. Upload the code to the LoPy or FiPy with

make recycle

Wie gewohnt kann mit git status der lokale branch mit dem auf github verglichen werden und bei Bedarf mit git pull die neueste Version heruntergeladen werden.


BOB on BeagleBone
#2

Dear Clemens,

thanks for caring about the stuff we are doing. In general, we are constantly trying to keep the Hiveeyes MicroPython Datalogger [Sandbox] setup documentation updated and we did so recently for the 0.2.0 release.

Setting up the environment should work like outlined there and we will be happy to receive ideas about which could be improved.

Please don’t forget about "make install-requirements" and "make upload-requirements" or its catch-all complement "make refresh-requirements". Otherwise, the Firmware will lack required dependencies after being uploaded to the device.

Cheers,
Andreas.


#5

How can I check what serial port is in use in case I forgot my port?


#9

You might try the "make list-serials" command for that. At least, this gives an idea of all possible values you might want to use on your machine.

On my workstation, the output looks like that:

$ make list-serials
Serial Device: /dev/cu.Bluetooth-Incoming-Port
USB Serial Device 04d8:ef98 with vendor 'Pycom' serial 'Pye090a1' found @/dev/cu.usbmodemPye090a1

So, my personal sandbox initialization command would be:

export MCU_SERIAL_PORT=/dev/cu.usbmodemPye090a1

P.S.: You might want to pull the repository first, as you will need Fix "make list-serials" · hiveeyes/hiveeyes-micropython-firmware@948b375 · GitHub which does what it actually pretends to do: It fixes the very command I was referencing above ;].


split this topic #14

A post was split to a new topic: Unstable serial port communication on Windows 10


#15

Another way would be to use the pycom-fwtool-cli tool shipped with the Pycom Firmware Updater for your platform. You have to move from the Linux Subsystem to the Windows shell and run there:

cd c:\Program Files (x86)\Pycom\Pycom Firmware Update

pycom-fwtool-cli.exe list
COM4 [Prolific USB-to-Serial Comm Port (COM4)] [USB VID:PID=067B:2303 SER=6 LOCATION=1-1.1]

If it displays COM4 here, the corresponding TTY mapped into WSL would be /dev/ttyS4.

Thanks, @tonke!