Yet Another USB Application

Visto 12 veces
Saltar al primer mensaje no leído

paintitblack

no leída,
6 oct 2010, 14:42:266/10/10
a Pinguino
Hi,
I just made a little python program to get temperature from a DS18B20
connected to pinguino.
Just download 18b20.tar.gz in files section, upload temp18b20.pde and
run temp18b20.py
It's also an example how I use my own libraries.
All comments are in English and I hope it's clear enough.
Any comments are welcome.

Sphinx

no leída,
7 oct 2010, 12:33:267/10/10
a Pinguino
Great code paintblack!

I've notice you have used your own delay. I think you could use the
pinguino delay routines, for a precise delays without using TMR0.
JP comment in other thread that the delay bug would be fixed in 9-03
release, but I'm not sure if it was included yet; i've not tested that
part. Let me check the code for 9-03 and I will confirm you.

I will reuse your python code for some other Pinguino IDE improvements
that I would like to suggest here.

Many thanks & Regards,
Sphinx.

paintitblack

no leída,
7 oct 2010, 12:43:447/10/10
a Pinguino
Thanks :o)

jp mandon

no leída,
7 oct 2010, 13:29:167/10/10
a pingui...@googlegroups.com
Hi guys

fine USB code Regis !!
I didn't yet integrate your fixed delay code Jesus, sorry but i focused on windows 7 for the last release.
but i didn't forget you did this great job and i think we should have a new release soon.
I am still busy with usbserial code on windows ( it works on Linux ) and some progress have been done but it's not yet finished.
I found 2 solutions to make it work:
- write a windows driver for usbserial with Pinguino descriptor
- adapt pinguino code to the microchip CDC code to use microchip driver.
I chose the second solution because i don't have the windows DDK and i didn't write a driver for windows since 2004 :-)

JP

Le 7 octobre 2010 18:43, paintitblack <rbla...@gmail.com> a écrit :
Thanks :o)

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Pinguino.
Pour envoyer un message à ce groupe, adressez un e-mail à pingui...@googlegroups.com.
Pour vous désabonner de ce groupe, envoyez un e-mail à l'adresse pinguinocard...@googlegroups.com.
Pour plus d'options, consultez la page de ce groupe : http://groups.google.com/group/pinguinocard?hl=fr


paintitblack

no leída,
7 oct 2010, 14:15:507/10/10
a Pinguino
Thanks again.
On my point of view, 1wirelib.c from Pinguino is incomplete and it
uses a fixed pin.
If you think my code is good enough you could replace it with what
i've done. It's up to you.

@Sphinx : may I test your delay code ?

Sphinx

no leída,
7 oct 2010, 19:00:297/10/10
a Pinguino
JP, Thank for the info and for your words.

paintiblack, yes of course. I've uploaded the files in a tar.z file
here: http://groups.google.es/group/pinguinocard/files
(it's called pinguinodelay_newfiles.tar.z )

You have to do >tar xvf of that file within your pinguino folder.
And these files will be copied to their respective places:

<pinguinopath>/tools/share/sdcc/lib/pic16/pinguinodelay.lib
<pinguinopath>/tools/share/sdcc/include/pic16/pinguinodelay.h
<pinguinopath>/tools/share/sdcc/include/pic16/arduinodelay.c

The asm sources os the lib are not mandatory but are good to keep
there just in case:
<pinguinopath>/tools/share/sdcc/lib/src/pic16/pinguinodelay/
delay12tcy.S
<pinguinopath>/tools/share/sdcc/lib/src/pic16/pinguinodelay/
delay120tcy.S

And you have to do one more thing:

->Edit the main python script, and within the "def link(self)",
include a new line (it could just below this existing one: "-
llibm18f.lib",")
add this one: "-lpinguinodelay.lib,"

When you use delayms or delaymicroseconds functions, and compile it,
you will see at the debug box the following messages:
"link library pinguinodelay.lib
compilation done"
That's fine. There are no problems on that.

NOTES:

if you check the library and the .h file, you will notice that
delayMicroseconds function only accepts value from 1 to 255. That's
because it's a byte the maximum size that is possible to pass to the
asm routine. So in case you want to achieve a delay from 255 to 1000
microseconds, this function has to be called several times. So, for a
780 microseconds delay you should code it as:

delayMicroseconds(250); // first quarter of milisecond.
delayMicroseconds(250); //half a milisecond up to here.
delayMicroseconds(250); // 3/4 of a milisecond up to here.
delayMicroseconds(30); //a total of 780 microseconds finally here.

I've been struggling with that, but it's the only way to really
generate accurate microseconds delays. To handle values bigger than a
byte (unsigned char) within the delayMicroseconds routine makes
impossible to obtain exactly 1 microsecond (which is the most critical
value) and even 10 or 100. I've tested several possibilities with an
oscilloscope to get that really accurate microsecond delay. That's why
it was discarded variables bigger than a byte size.

For delays greater than a milisecond, you can use the already known
delayms function. This one accept values up to 4.294.967.295 (unsigned
long).


As soon as JP includes this modifications in the IDE code, I will
update this information at the Pinguino wiki pages.


Regards,
Sphinx.

paintitblack

no leída,
8 oct 2010, 15:06:268/10/10
a Pinguino
Thank you.
delayus and delayms work great for me.

Sphinx

no leída,
10 oct 2010, 15:40:4310/10/10
a Pinguino
Hello again paintiblack,
I'm trying your code, I've noticed that you are using from python
script the usb config number 3. But when using usbview and look into
the Pinguino, I only see two config.
Are you using a different bootloader ?
When I run your python script says that config doesn't exist... ¿?

Thanks in advance,
Sphinx.

paintitblack

no leída,
11 oct 2010, 9:11:5511/10/10
a Pinguino
Hi,
I used BootloaderARDE and BootloaderV2.12 with success.
I don't know what's your problem and this bootloader remains
mysterious for me.
Sorry.
Maybe Jean-Pierre can help you ?

Sphinx

no leída,
18 oct 2010, 4:59:1218/10/10
a Pinguino
Hi again paintiblack,

Could you tell me if you are using Linux or Windows when running this
USB application ?
I've been using Linux, and I was thinking that there should be some
problems with USB and Linux that I've not managed correctly.

Thanks,
Sphinx.

paintitblack

no leída,
22 oct 2010, 10:04:0822/10/10
a Pinguino
Hi,
Sorry for the late response.
I use Linux (Mandriva 2010.1).

Sphinx

no leída,
22 oct 2010, 10:17:3022/10/10
a Pinguino
Thanks.
Then it is something else what is happening to me.

paintitblack

no leída,
24 oct 2010, 4:17:0824/10/10
a Pinguino
I was thinking I got the same problem with usb application until I
installed pyusb.
You can get last version here : https://sourceforge.net/projects/pyusb/files/

Sphinx

no leída,
24 oct 2010, 14:10:0424/10/10
a Pinguino
Thanks, i finally got communication between PC and Pinguino.

I have some troubles with Python version in my machine.

/J.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos