[PIC32M]MicroPython port to the PIC32M

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
QuanLin
Posts: 9
Joined: Tue Oct 01, 2019 1:40 am
Location: Melbourne AU

[PIC32M]MicroPython port to the PIC32M

Post by QuanLin » Fri Nov 08, 2019 3:21 am

MicroPython port to the PIC32M
https://github.com/jacklinquan/micropyt ... rts/pic32m
This is an experimental port of MicroPython to the PIC32M series microcontroller from Microchip. The experiment is done with PIC32MX170F256B in 28-pin DIP package for easy hand soldering.

Supported features include:
REPL (Python prompt) over UART1.
The pyb module with 1 Led and 1 Switch.

I've opened pull request to micropython/micropython to add PIC32M port.

And here's a self-contained MicroPython port to the PIC32M MPLAB project
MicroPython port to the PIC32M MPLAB project
https://github.com/jacklinquan/MicroPython_PIC32M_MPLAB
Some workaround needed to generate genhdr folder manually when you need to configure it differently.

Some brief test result
----------------------

```
MicroPython v1.11 on 2019-11-07; EXPERIMENT with PIC32MX170F256B
>>> a,b=1,2
>>> c=a+b
>>> c
3
>>> 256*256
65536
>>> 100//3
33
>>> import pyb
>>> led=pyb.LED(1)
>>> led.off() # The LED turned off.
>>> led.on() # The LED turned on.
>>> sw=pyb.Switch(1)
>>> sw.value()
True
>>> sw.value() # The switch is pressed.
False
>>> list(5 * x + y for x in range(10) for y in [4, 2, 1])
[4, 2, 1, 9, 7, 6, 14, 12, 11, 19, 17, 16, 24, 22, 21, 29, 27, 26, 34, 32, 31, 39, 37, 36, 44, 42, 41, 49, 47, 46]
>>> import gc
>>> gc.mem_free()
13792
>>> gc.collect()
>>> gc.mem_free()
15392
```

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: [PIC32M]MicroPython port to the PIC32M

Post by mattyt » Fri Nov 08, 2019 5:15 am

Nice work!

I'd like to give this a try; is there a dev board you could recommend that uses this micro?

uCTRL
Posts: 47
Joined: Fri Oct 12, 2018 11:50 pm

Re: [PIC32M]MicroPython port to the PIC32M

Post by uCTRL » Fri Nov 08, 2019 8:27 am

Matt,

You don't need a development board.
These things come in 28pin DIP packages, plug straight in breadboard.
Only needs one external capacitor, plus another cap if you want power supply de-coupling.
Generally don't need crystal as they run OK on internal RC oscillator.

Although, you will need special programmer. Microchip have genuine PICKIT programmer, but you can get much cheaper clone from ali or ebay that works well. Boys at Backshed forum have developed/programmed an 8 bit pic ucontroller and integrate this on number of their development boards.

Geoff Graham (Ausie) has developed a nifty Basic interpreter for these called "Micromite" and have been very popular at Backshed forum.

http://geoffg.net/micromite.html

https://www.thebackshed.com/forum/ViewForum.php?FID=16

QuanLin
Posts: 9
Joined: Tue Oct 01, 2019 1:40 am
Location: Melbourne AU

Re: [PIC32M]MicroPython port to the PIC32M

Post by QuanLin » Fri Nov 08, 2019 10:19 am

mattyt wrote:
Fri Nov 08, 2019 5:15 am
Nice work!

I'd like to give this a try; is there a dev board you could recommend that uses this micro?
Hi mattyt,

So far I didn't find any dev board comes with this micro, but these two combined together could make one:
https://www.digikey.com.au/product-deta ... ND/2802029
https://www.digikey.com.au/product-deta ... ND/4902612
It's not very cheap for just curiosity. I did not try them, but looks promising.
And like uCTRL suggested, play with this micro on a bread board is very easy.

QuanLin
Posts: 9
Joined: Tue Oct 01, 2019 1:40 am
Location: Melbourne AU

Re: [PIC32M]MicroPython port to the PIC32M

Post by QuanLin » Mon Dec 16, 2019 4:52 am

QuanLin wrote:
Fri Nov 08, 2019 10:19 am
mattyt wrote:
Fri Nov 08, 2019 5:15 am
Nice work!

I'd like to give this a try; is there a dev board you could recommend that uses this micro?
Hi mattyt,

So far I didn't find any dev board comes with this micro, but these two combined together could make one:
https://www.digikey.com.au/product-deta ... ND/2802029
https://www.digikey.com.au/product-deta ... ND/4902612
It's not very cheap for just curiosity. I did not try them, but looks promising.
And like uCTRL suggested, play with this micro on a bread board is very easy.
No mattyt,
DM330013-2(Microstick II) from Microchip does NOT support PIC32MX170F256B.
I got one just now and tried, but failed. The largest PIC Microstick II can support is PIC32MX250F128B which has not enough flash.
So far the only way to try Micropython on PIC32MX170F256B is to make your own prototype board.

Post Reply