Search in Pinguino World !!

Monday, October 25, 2010

Pinguino beta 9-04

Pinguino beta 9-04 is now online with CDC support !!
http://www.hackinglab.org/pinguino/download/latestpinguino/

As usual, i didn't write a documentation :-) but a cdc example is in the
example folder.
What is CDC ?
A CDC is an USB serial port, on windows it will appear in the system as a
virtual com port ( COM7 for example ),
in linux, it will appear as a /dev/ttyACM0 device ( or /dev/ttyACM1 if 0
exist ).

Then you can use this device with a serial terminal ( hyperterminal,
teraterm on windows, putty, gtkterm on linux ).
Speed is 115200 bauds, 1 stop bit, no parity.

In Pinguino, you can use CDC.print(string,length) and CDC.read(string).
CDC.read(string) return the length of the received string.
length=CDC.read(receivedstr);

CDC is a non blocking device, USB is managed with interrupt, so you can use
all the functions in the loop.
No initialisation is needed.

I tested this code on:
windows XP,
windows 7,
linux.

With Linux be careful !! on some distribution, the modem manager send an
initialisation string to a new connected ttyACM device.
This string is:
AT+GCAP
AT+GCAP
AT+GCAP

i am working on a udev rule to stop this initialisation with Pinguino.
You can stop the modem manager if it is a problem
sudo killall modem-manager

Hope this code will be useful for the Pinguino community.
I wait for your report and suggestion.

Thanks to all the alpha-tester :-) of this release:
olivier
boops
vasi
sphynx
paintitblack
walterleonardo
pinguinoVE

21 comments:

Vasile Guta-Ciucur said...

A lot of major improvements as migration to sdcc 2.9.x and USB CDC stack! And this mean a lot of work from Jean-Pierre. Thank you!

Anonymous said...

I have this error (not in 8.01).
Traceback
import usb
ImportError: No module named usb
I work on Windows2000.

Could you tell me whatis the problem.

Thank you!

Anonymous said...

I have this error (not in 8.01).
Traceback (most recent call last):
File "c:\beta904\904.py", line87, in (module)
import usb
ImportError: No module named usb
I work on Windows2000.

Could you tell me whatis the problem.

Thank you!

Jean-Pierre MANDON said...

You are on windows,please install pyusb as said here:
http://sites.google.com/site/pinguinotutorial/installation/windows
( windows XP )
or here:
http://sites.google.com/site/pinguinotutorial/installation/windows-7

Anonymous said...

I's already installed long time, (pyusb) and pinguino 8.1 work well.

Anonymous said...

Hello,
It work, a have removed python25 and a have put python26 with all packages.
I have only on the console this bug "Debug: scr/helpers.cpp(140): 'CreateActCtx' failed with error 0x0000007f
thank you

Jean-Pierre MANDON said...

please give us:
- your operating system
- what package are installed ( python version, pyusb version, wxpyton version )

Jean-Pierre MANDON said...

and libusb version

Cristian Paul said...

CDC is a great Milestone !!

Cheers on thin Jean Pierre !

Cristian Paul said...

cat /dev/ttyACM0
MessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOMessageTOTOM

:D

Unknown said...

It's great that now CDC libraries are included!!

I do not know if happens in this version, but in the previous one I couldn't make interruption examples work without inserting "#define USERINT" manually. I've read the python code and (I don't know python very well, but..) it seems to be added, but in the practice, the code doesn't work without adding that line manually.

Thank you for this excellent work, guys!

Unknown said...

Ah! one question.

Which module do I need to load for serial to be detected? I've loaded usbserial but no tty is created.

Jean-Pierre MANDON said...

@mauri

you must load cdc-acm module.
With debian and ubuntu distribution it should be automatically loaded.

Olive said...

I have the same error as "Anonymous" mentioned:
Traceback (most recent call last):
File "pinguinobeta9-04windows.py", line 87, in
import usb
ImportError: No module named usb

I'm on Windows Xp, setup was done following the instructions on http://sites.google.com/site/pinguinotutorial/installation/windows
with python, wxpython, pyusb and libusb downloaded from that page.

9-01 is working fine.
But 9-04 crash with the above error.

I have tried to upgrade all components to python 2.6, but I get the exact same error.

Anonymous said...

Hello,

I have the same error with usb module, as mentioned :

Traceback (most recent call last):
File "c:\pinguinob904\pinguinobeta9-04windows.py", line 87, in import usb
ImportError: No module named usb

I have installed Python2.5.2, wxPython 2.8, pyusb 1.5 and libusb 0.1.12.1, then the driver pinguino and last pinguino beta9-04 from
https://sites.google.com/site/pinguinotutorial/installation/windows

Pinguino hardware is seen with the testlibusb-win.exe program...

Jean-Pierre MANDON said...

It seems that a problem exist with PyUSB. Be careful, for python 2.5 intall this pyusb version:
http://sourceforge.net/projects/pyusb/files/PyUSB%200.x/0.4.1/pyusb-0.4.1.win32-py2.5.exe/download
with python 2.6:
http://sourceforge.net/projects/pyusb/files/PyUSB%200.x/0.4.3/pyusb-0.4.3.win32-py2.6.exe/download

Anonymous said...

Ok, thank you a lot, it work perfectly!
By the way : any advantage or disavantage to upgrade to Python 2.6 ?

Olive said...

Working for me as well.
Thanks Jean-Pierre!

David Mendez said...

For newbies as me...
To make work CDC in Windows:

When you Compile and Load cdc.pde Windows ask for a new USB Device driver. Search for inf folder into Pinguino IDE folder.
In my case:
'C:\pinguino beta9-04 windows\inf'

It creates COM6 Virtual Serial Port.

Then I use putty over COM6.

How can I show the code of the pressed key in putty?.

thanks.

Ulises said...

In mac 10.6 exist a curious bug.

If you move the pinguino folder from "downloads" to other folder like desktop it doesn´t works. It works again if you put it into documents or downloads again.

A trouble into the editor: I can´t write the symbol "[" and "{" only the right version ( ], } ).

Thank you

Lejan said...

Hello, which library I have to use to implement the usb cdc in the pic18f4550 ?
Because I see in documentation there is some files making reference to cdc:

1) pinguino_beta9-05_linux/tools/share/sdcc/include/pic16/usb/usb_cdc.c

2) pinguino_beta9-05_linux/tools/share/sdcc/include/pic16/__cdc.c

I have not been succesfully with the usb cdc in sdcc yet.
Thanks!!