We have activated the USB mass storage function (in the mpconfigureport.h file) for our board in the MicroPython port, so we can copy Python files to the board in the same way as a USB stick.
#define MICROPY_HW_FLASH_STORAGE_BYTES (1024 * 1024)
This and the abstraction of the LoRaWAN class (see previous Log) makes development possible without just any IDE. When the RP2040 MiniPill LoRa Board is connected to your PC, tablet or smartphone it will power on and enter the start up process (the boot process).
Your PC should now recognise the RP2040 MiniPill LoRa Board. It depends on the type of PC you have as to what happens next:
- Windows: Your RP2040 MiniPill LoRa Board will appear as a removable USB flash drive. Windows may automatically pop-up a window, or you may need to go there using Explorer.
Windows will also see that the RP2040 MiniPill LoRa has a serial device, and it will try to automatically configure this device. If it does, cancel the process. - Mac: Your RP2040 MiniPill LoRa Board will appear on the desktop as a removable disc. It will probably be called “NONAME”. Click on it to open the RP2040 MiniPill LoRa Board folder.
- Linux: Your RP2040 RP2040 MiniPill LoRa Board will appear as a removable medium. On Ubuntu it will mount automatically and pop-up a window with the RP2040 MiniPill LoRa folder. On other Linux distributions, the RP2040 MiniPill LoRa Board may be mounted automatically, or you may need to do it manually. At a terminal command line, type
lsblk
to see a list of connected drives, and thenmount /dev/sdb1
(replacesdb1
with the appropriate device). You may need to be root to do this.
Okay, so you should now have the RP2040 MiniPill LoRa Board connected as a USB flash drive, and a window (or command line) should be showing the files on the RP2040 MiniPill LoRa drive.
The drive typically contains the following files:
- boot.py – this script is executed when the board boots up. It setsup various configuration options for the board.
- main.py – this is the main script that will contain your Python program.It is executed after boot.py.
- README.txt – this contains some very basic information about gettingstarted with the board.
Notice:
The description above is based on the official documentation of MicroPython, for more details please follow the link. The USB mass storage function also works very well with a tablet or smartphone. We did some tests in the forest and edited parameters in our Python script with an android smartphone without any IDE or so. For workshops, we don't have to install IDEs, libraries, etc. on each participant's device as before. We can start directly with the LoRa(WAN) itself, even in the field. This is great and makes the first steps in development much easier.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.