Multiple Pyboard update on MAC

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Keja
Posts: 4
Joined: Sat Dec 19, 2020 9:56 am

Multiple Pyboard update on MAC

Post by Keja » Sat Jan 23, 2021 11:25 am

Hello,

I'm working on a project where I have 2 pyboard connected on my Macbook . The Mac only sees the latest one connected as a drive making it painful to update the code on both pyboards at the same time. I 'm able to have the REPL on both as both pyboard show up when I do

Code: Select all

ls /dev/tty.usb*
/dev/tty.usbmodem2075319E4E532	/dev/tty.usbmodem2081319D4E532
but as mentioned before only one of the pyboard appear as a disk

Code: Select all

diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            11.2 GB    disk1s1
   2:                APFS Volume Macintosh HD - Data     54.6 GB    disk1s2
   3:                APFS Volume Preboot                 82.9 MB    disk1s3
   4:                APFS Volume Recovery                528.9 MB   disk1s4
   5:                APFS Volume VM                      1.1 GB     disk1s5

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *245.8 KB   disk2
   1:                 DOS_FAT_12 PYBFLASH                114.7 KB   disk2s1

Has anyone managed to overcome this limiation on MAC ?

Thank you for reading
Nicolas

User avatar
dhylands
Posts: 3630
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Multiple Pyboard update on MAC

Post by dhylands » Sat Jan 23, 2021 4:55 pm

Try plugging in your first MicroPython board. Then go into Finder and Right Click on PYBFLASH and choose 'Rename "PYBFLASH"' and give it a new name.

Then when you plug in the second board it won't collide.

Keja
Posts: 4
Joined: Sat Dec 19, 2020 9:56 am

Re: Multiple Pyboard update on MAC

Post by Keja » Sat Jan 23, 2021 5:35 pm

thank you , that did the trick :)

User avatar
jimmo
Posts: 2262
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Multiple Pyboard update on MAC

Post by jimmo » Mon Jan 25, 2021 12:13 am

In general I'd avoid using the usb storage interface and instead transfer files using either rshell, pyboard.py or mpr. It's much more reliable and less likely to lead to surprises.

Keja
Posts: 4
Joined: Sat Dec 19, 2020 9:56 am

Re: Multiple Pyboard update on MAC

Post by Keja » Mon Jan 25, 2021 7:16 pm

Is it possible to use the tools you mentioned in parrallel of picocom (this is what I use for the REPL) ? I need access the REPL on both pyboards to make my tests.
I also have some WiPys and LoPys boards for which I use Pymakr Atom plugin and it's quite handy to update new code and have access at the REPL in on place.

User avatar
Roberthh
Posts: 2563
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Multiple Pyboard update on MAC

Post by Roberthh » Mon Jan 25, 2021 7:25 pm

All of pyboard.py or mpr us the USB interface for updating. rshell too, but can also be configured to use ftp. For Pyboard D, ESP32 or ESP8266 I prefer to use an ftp client, FileZilla, in combination with an ftp server on the target board (https://github.com/robert-hh/FTP-Server ... 2-and-PYBD), which uses teh same callback mechanism as WEBREPL to run in background.

User avatar
jimmo
Posts: 2262
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Multiple Pyboard update on MAC

Post by jimmo » Tue Jan 26, 2021 1:23 am

Keja wrote:
Mon Jan 25, 2021 7:16 pm
Is it possible to use the tools you mentioned in parrallel of picocom (this is what I use for the REPL) ?
Sort of, but it depends what you mean.

My most common use case is to do:

pyboard.py --device /dev/ttyACM0 path/to/code.py

Which will run code.py on the device and print the output.

If I want to get to the REPL, then I Ctrl-C that, and then use miniterm to connect.

rshell also has a way to switch in and out of REPL and transfer modes.

With mpr, you don't need to ever leave the REPL, because you don't copy files to the device. The files are accessed remotely from your PC.

User avatar
dhylands
Posts: 3630
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Multiple Pyboard update on MAC

Post by dhylands » Tue Jan 26, 2021 6:50 pm

In general, you only want one program to have the serial port open at a time. Otherwise when characters are sent from the pyboard some characters will go to one program, and some characters will go to the other program.

rshell has a `repl` command which will make it behave like a terminal editor. You need to use Control-X to exit from the repl and get back into rshell to say allow copying files again.

My typical workflow in rshell is to use a command like:

Code: Select all

cp somefile.py /flash; repl ~ import somefile
Then if I hit an error, I edit the file using my editor and back in rshell I do Control-X to exit the repl, press the up arrow to retrieve the previous command and press enter.

Post Reply