Page 1 of 1

[PIC32M]MicroPython port to the PIC32M

Posted: Fri Nov 08, 2019 3:21 am
by QuanLin
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
```

Re: [PIC32M]MicroPython port to the PIC32M

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

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

Re: [PIC32M]MicroPython port to the PIC32M

Posted: Fri Nov 08, 2019 8:27 am
by uCTRL
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

Re: [PIC32M]MicroPython port to the PIC32M

Posted: Fri Nov 08, 2019 10:19 am
by QuanLin
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.

Re: [PIC32M]MicroPython port to the PIC32M

Posted: Mon Dec 16, 2019 4:52 am
by QuanLin
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.