Pinguino Forum

Full Version: Pinguino - adding a new board
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
New user here so I hope that my posting is appropriate for this forum.

I recently installed Pinguino on my Windows 7 machine and did a quick check using the blink code and my Olimex PIC32 Pinguino-Micro. All OK.

I have another PIC32 board (from a UK company) which has an Arduino pinout and a PIC32MX340F. It comes with some kind of Basic which I am not interested in using. It occured to me that I could possibly develop for it in the Pinguino environment.

In the Windows installation I see a number of Python source files. I am interested in learning the Python language and I am keen to get my hands dirty. So I wondered whether it might be possible to modify the code to add support for my PIC32 board. I did modify some of the .py code (boards.py in the wxgui folder) but when running the Pinguino GUI, I see no evidence that this code is being executed.

So the question is, is the Python source code just there for interest, or is it actually executed?

If I did want to experiment to add support for my PIC32 board how would be the right way to go about it?

Should it be successful I would be happy to contribute any new code to the Pinguino project.

regards...

--Gary
Gary,

If you installed Pinguino IDE on Windows PC using EasyPack, you are running a compiled version of py code and any changes you made will not be reflected. To get your hand 'dirty', you need to install Python interpreter and run from there. You can find out the version of Python and other required modules in the EasyPack_ReleaseNote_en.txt file.

Besides the py code, you will need to check the correct bootloader to install on your board that reflects the button and led io pin number and memory size.

DJ
Definitely can be done and yes you'll need a suitable bootloader. Getting it into the chip needs some sort of programmer such as PICkit 2 or 3. You can get by (slowly) with an FT232R-based USB-serial board if needs be.

Look at files such as digitalw.c and you'll see how pinguino "pins" convert to actual port bits.

John
Thanks for the pointers. I did suspect that the .py source had been compiled.

The target board has the 5 pin connector for a PicKit2/3. If I got as far as generating a binary which could be loaded by that means I would be delighted. There is also a RS232 interface (and I have the matching USB to RS232 module). So this might be another route to upload new software.

I do have python installed and I have just installed the wx library.

Immediately I am encountering problems.

G:\uP\PIC32\Pinguino\IDE\wxgui>python pinguino.py

Traceback (most recent call last):
File "pinguino.py", line 36, in <module>
from editor import IDE
File "G:\uP\PIC32\Pinguino\IDE\wxgui\editor\__init__.py", line 35, in <module>
from events import Events
File "G:\uP\PIC32\Pinguino\IDE\wxgui\editor\events.py", line 35, in <module>
from wxgui._trad import _
ImportError: No module named wxgui._trad

I see from a google search that someone else had this problem but didn't say what the solution was. Perhaps it is an environmental variable setting?

I do see the _trad.py file but I have no idea how modules are accessed. I don't know whether the underscore is some special Python syntax or a wierd filename.

I did try getting the source from the SVN for my Linux box, but the Xbuntu installation is so old that it isn't downloading packages [it hosts my mailserver and I am loathed to change anything while it is still working!]

--Gary
In reply to my own problem (in case anyone is googling for an answer in the future...) the solution is to set the PYTHONPATH environmental variable to one above the wxgui folder.

So if you have the installation sub-directory c:\pic32\pinguino\ide\wxgui (where pinguino.py is found and is executed from in the DOS shell [cmd.exe]) set PYTHONPATH=c:\pic32\pinguino\ide. You must of course have python installed. Execute with python pinguino.py.

So now I have spent time improving error messages in check.py in order to help me figure out what files are missing. This source file checks that various folders exist and that various files are present in various folders. A good idea, but as stands, not 100% helpful. I see that this class(?) is called from __init__.py with the statement CheckDependences() - which looks like a standard function call to me. This runs and exits the function (probably called something else in python!)... then nothing Huh . Damn. I can't see where the code is supposed to go next thanks to my lack of knowledge of python.

If I execute the python with some added parameters e.g. "-v" (for version) this is not acted upon, i.e. nothing gets printed to the DOS shell. I can see the code which checks the arguments, but I can't figure out how it gets called.

So I am stuck again.
OK. I temporarily installed the latest version of Ubuntu on a spare HDD. I downloaded the latest (X.4) version of Pinguino. I ran by  executing python pinguino.py and the splash graphic appeared and then the main window. I added my new board into bvoards.py (corrected some syntax problems!) and voila, my board appears in the Pic32 selection list. I loaded blink.pde and compiled. I get an error about a missing 32MX340F512H.o. OK. This is the processor on the new board. I can see the dot o files in p32/obj/non-free. At the moment I guess these are the USB bootloader binaries compiled for a specific processor. In a new task I go back to Win7 and download the Microchip bootloader software. To be continued.

I did note that the installation under Linux was not the same as I had under Win7. I did install Pinguino under Win7 some time ago when I got the Olimex board, so that explains why. I copy over the Linux files to Win7.

Tonight I try to run the pinguino.py in the copied Win7 area. I set up PYTHONPATH (although it doesn't seem to be necessary now). The splash screen appears - good! But then nothing  Sad . In the command window I see the message:-

Code:
C:\Users\gary\pip\pinguino32\x.4>python pinguino.py
pinguino.py:104: wxPyDeprecationWarning: Using deprecated class PySimpleApp.
 app = wx.PySimpleApp(0)

A quick check and python pinguino.py -h does list the help (and I see my new board!). So this was something not working under the older Win7 code (which I will now abandon).

For the moment until I get a spare PC I can't easily work under Linux, so I would like to pursue fixing the Win7 problems. Any help with the GUI not appearing or information on exactly what needs to go in the 32MX340F512H.o file would be appreciated.

--Gary