I was looking for an answer to a question posted on the Hackster.io community site concerning support for Python on an Infineon PSoC board. My initial web search led me to Zerenth.com, where I found out that unfortunately Zerynth no longer supports PSoC. Later I discovered that there is an incomplete port of MicroPython on the web:
Anyone can give it a try if they have a CY8CPROTO-062-4343W around and 10 min -> https://ifx-micropython.readthedocs.io/en/latest/psoc6/intro.html
Well, if there is a Github repo and documentation I might as well give it a try and see what MicroPython can do.
My experience with Python is quite limited; I have made small changes to existing Python programs, but I have never developed a full system in Python. Moreover, my experience with MicroPython is even more limited, since I have never even tried it on any development board.
The obvious place to start with any new programming language is with the classics: Hello_World, and Blinky. Let’s see if I can create a MicroPython program that prints Hello World on the screen, and blinks the LED on the board.
Of course, it is normally considered ‘cheating’ to read the documentation before trying and failing, but since I have no idea what I am doing, I suspect that reading the provided documentation is the best place for me to start. Maybe the documentation will have a Hello_World or Blinky program.
Starting here: https://ifx-micropython.readthedocs.io/en/latest/psoc6/intro.html I checked the supported board list. The list is really short (one board, CY8CPROTO-062-4343W), but fortunately that is a board I happen to have on my desk. The getting started guide has Linux instructions so, since I normally do all of my development under Linux, I fired up a VM with Ubuntu 22.04. Here is what I did to get started:
𝚌𝚞𝚛𝚕 -𝚜 -𝙻 https://raw.githubusercontent.com/infineon/micropython/ports-psoc6/tools/psoc6/mpy-psoc6.sh > 𝚖𝚙𝚢-𝚙𝚜𝚘𝚌𝟼.𝚜𝚑
𝚌𝚑𝚖𝚘𝚍 +𝚡 𝚖𝚙𝚢-𝚙𝚜𝚘𝚌𝟼.𝚜𝚑
And as expected my VM told me that curl was not installed. After installing curl I tried again. Things happened, beautiful ASCII art appeared:
After connecting the board hitting the ANY KEY (apparently the spacebar is not an ANY KEY, I had to press the ENTER key) many more things happened, and code was installed onto my board:
I wasn’t fooled by the ‘any key’ this time, I pressed the enter key and many more things happened, then the Arduino Lab for MicroPython popped up on my screen, just like the instructions said would happen.
Pressing the connect button told me that /dev/ttyACM0 was available, clicking on the text opened the port and the console started up:
I won’t bore you with the rest of the details, but when I tried writing a Blinky program I discovered that the sleep function has not been implemented yet (just like the documentation says), the following program runs, but VERY quickly. Update: The sleep() function now works.
from time import sleep
from machine import Pin
p1 = Pin("P13_7") # LED pin for CY8CPROT-062-4343W
for i in range(0, 100):
I am looking forward to the next release. Update: The next release is now available, the links above have been updated. Hopefully the sleep function will work and the board will be able to do more useful things. 😉 Update: The next version has been released, WiFi also works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.