[jallib] r2748 committed - Samples for PICs with USB module (with 20 MHz crystal but running at ...

26 views
Skip to first unread message

jal...@googlecode.com

unread,
Jul 26, 2011, 1:13:23 PM7/26/11
to jal...@googlegroups.com
Revision: 2748
Author: robhamerling
Date: Tue Jul 26 10:12:10 2011
Log: Samples for PICs with USB module (with 20 MHz crystal but
running at 48 MHz via PLL)


http://code.google.com/p/jallib/source/detail?r=2748

Added:
/trunk/sample/18f2450_usb_blink.jal
/trunk/sample/18f2455_usb_blink.jal
/trunk/sample/18f2458_usb_blink.jal
/trunk/sample/18f24j50_usb_blink.jal
/trunk/sample/18f2550_usb_blink.jal
/trunk/sample/18f2553_usb_blink.jal
/trunk/sample/18f25j50_usb_blink.jal
/trunk/sample/18f26j50_usb_blink.jal
/trunk/sample/18f26j53_usb_blink.jal
/trunk/sample/18f27j53_usb_blink.jal
/trunk/sample/18f4450_usb_blink.jal
/trunk/sample/18f4455_usb_blink.jal
/trunk/sample/18f4458_usb_blink.jal
/trunk/sample/18f44j50_usb_blink.jal
/trunk/sample/18f4550_usb_blink.jal
/trunk/sample/18f4553_usb_blink.jal
/trunk/sample/18f45j50_usb_blink.jal
/trunk/sample/18f46j50_usb_blink.jal
/trunk/sample/18f46j53_usb_blink.jal
/trunk/sample/18f47j53_usb_blink.jal
/trunk/sample/18f65j50_usb_blink.jal
/trunk/sample/18f66j50_usb_blink.jal
/trunk/sample/18f66j55_usb_blink.jal
/trunk/sample/18f67j50_usb_blink.jal
/trunk/sample/18f85j50_usb_blink.jal
/trunk/sample/18f86j50_usb_blink.jal
/trunk/sample/18f86j55_usb_blink.jal
/trunk/sample/18f87j50_usb_blink.jal
/trunk/sample/18lf24j50_usb_blink.jal
/trunk/sample/18lf25j50_usb_blink.jal
/trunk/sample/18lf26j50_usb_blink.jal
/trunk/sample/18lf26j53_usb_blink.jal
/trunk/sample/18lf27j53_usb_blink.jal
/trunk/sample/18lf44j50_usb_blink.jal
/trunk/sample/18lf45j50_usb_blink.jal
/trunk/sample/18lf46j50_usb_blink.jal
/trunk/sample/18lf46j53_usb_blink.jal
/trunk/sample/18lf47j53_usb_blink.jal
Modified:
/trunk/CHANGELOG

funlw65(Vasi)

unread,
Jul 26, 2011, 7:34:39 PM7/26/11
to jal...@googlegroups.com
It also needs
pragma target VREGEN        ENABLED     -- USB voltage regulator
but ignore it if that pragma is enabled by default...

Vasi

Sebastien Lelong

unread,
Jul 27, 2011, 1:30:37 AM7/27/11
to jal...@googlegroups.com
AFAIK not every PIC needs it (eg. 18f27j53 doesn't). It depends on how wired is USB module internally. If I remember correctly, if Vusb is tied to GND (18f4550), then internal voltage regulator (VREGEN) is required. For 18F27J53, Vusb must be tied to Vdd, in this case, no VREGEN.

Cheers,
Seb

2011/7/27 funlw65(Vasi) <fun...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "jallib" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jallib/-/czWTqdByLRkJ.
To post to this group, send email to jal...@googlegroups.com.
To unsubscribe from this group, send email to jallib+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jallib?hl=en.



--
Sébastien Lelong


Rob Hamerling

unread,
Jul 27, 2011, 3:34:17 AM7/27/11
to jal...@googlegroups.com

Hi Vasi,


[Seb]


> AFAIK not every PIC needs it (eg. 18f27j53 doesn't). It depends on

> howwired is USB module internally. If I remember correctly, if


> Vusb is tied to GND (18f4550), then internal voltage regulator
> (VREGEN) is required.

I'm willing to add this (for the about 10 PICs which have VREGEN), but
does it need a comment? Would it harm when always enabled or always
disabled? Would it be better as 'comment' only?

About 'default' fuse settings:
The Jallib device files contain fuse settings which may not be equal to
those as described in the datasheets as 'Default/Unprogrammed' value'.
Therefore 'default' must be considered as 'undefined'.
I'll improve the text in devicefiles.html to make this clearer (for the
few who read documentation).

Regards, Rob.

--
R. Hamerling, Netherlands --- http://www.robh.nl

funlw65(Vasi)

unread,
Jul 27, 2011, 8:40:52 AM7/27/11
to jal...@googlegroups.com
Hi guys,

I understand that a simple blink a led example does not need all of these.
I also understand that we need a fuse template for USB "engine" where is needed and a handy Blink a Led example can be used for this.
I also understand that for every PIC needs some specific fuse settings in order to work.
If for 4550 VREGEN is required to work, then must be there. if 27j53 have different needs, then those must be specified in his template/sample.
I know that all requested are already in datasheet and be sure that anyone are starting to read them even if is slow and sometimes don't help at all a bewildered/perplexed beginner - jallib was always there to help. If is too much, then is ok. I already know how to work with my microcontroller and I can make on my site the required modifications to help my visitors. So, no problem.

Maybe the required advices/tutorials are better to be contained by the jallib book...

Vasi

P.S. In my opinion, the jallib blog was very helpful to many, don't know how many make comments on justanotherlanguage and jallist is not jallib...

mattschinkel

unread,
Jul 28, 2011, 5:48:04 AM7/28/11
to jallib
Thanks Rob for the samples. One of the most frequent issues is setting
up a PIC's OSC settings for USB, usually directed to Rob (I don't see
many others reply to this kind of question). Thses samples should
resolve this issue. I'd say it's up to Rob here. Would Rob rather
answer questions or create a working blink sample?

Maybe we also need a tutorial for setting OSC speed through these
settings, and how to read a datasheet.

Blogging is not needed so much when you have tutorials. Many people do
add comments to the tutorials & Jaluino which usually get answered by
Seb or myself. Some of blogspot's blogs are now obsolete due to the
related updated tutorial. Let us know what you would like to see on
justanotherlanguage.org. We do have a blog section if you wish to add
one.

Matt

Rob Hamerling

unread,
Jul 28, 2011, 10:43:38 AM7/28/11
to jal...@googlegroups.com

Hi Matt,

On 07/28/11 11:48 am, mattschinkel wrote:
> Thanks Rob for the samples. One of the most frequent issues is setting
> up a PIC's OSC settings for USB, usually directed to Rob (I don't see
> many others reply to this kind of question). Thses samples should
> resolve this issue. I'd say it's up to Rob here. Would Rob rather
> answer questions or create a working blink sample?

Developing working samples is much more interesting. And I hope it
prevents questions or makes answering questions easier!

I agree that it is not so easy to chose the correct and complete
oscillator settings! Today I did some tests with 18f2450,2455,27j53. All
worked as designed, but a test with 18f66j55 failed at first. The LED
blinked at about 4 Hz in stead of 2 Hz.
After some experimenting with different fuse settings and switching PLL
off and on I finally concluded that the PLL block must have gotten its
input from the internal oscillator (not from the crystal oscillator).
INTOSC runs at 8 MHz, thus the output of the PLL block must have been
192MHz and the CPU was running at 96 MHz which explains why the LED
blinked at 4 Hz! Even though the datasheet says that OSCCON_SCS is 0b00
after reset, specifying OSCCON_SCS = 0b00 (select primary oscillator)
solved the problem: now the LED blink at 2 MHz. So <don't trust
defaults> is appropriate for datasheets too!

I'll update the samples soon.

Regards, rob.

Reply all
Reply to author
Forward
0 new messages