View previous topic :: View next topic |
Author |
Message |
gangi
Joined: 14 Feb 2011 Posts: 2
|
USB low-speed mode with a PIC18F2550 with a 4MHz crystal |
Posted: Mon Feb 14, 2011 11:15 am |
|
|
Hello!!
I'm trying to use a pic18f2550 as a low-speed usb device. In the example codes I only found high-speed examples so it didn't helped me. Looking in the datasheet 2.2.1 section seems I have to put FSEN to 0 and FOSC3:FOSC0 to 1 but i didn't find any fuses with a similar name in the 18f2550.h file. Anyone knows what fuses I have to use to set low-speed mode?
Thanks in advance. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Feb 14, 2011 1:41 pm |
|
|
Read the Datasheet's chapter titled "Oscillator" -- that should have what you need.
In cases of special oscillator settings, you'll also want to review the .H file for that PIC as well as the setup_oscillator() command.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Mon Feb 14, 2011 3:47 pm |
|
|
XTPLL, PLL1, CPUDIV3
Two things confusing here, you have to select CPUDIV3, to get /4 (this is because the same bit pattern gives /3, when not using the PLL), and no fuse for FSEN.
FSEN, is not a fuse, but a software configured bit. Bit 2 of the UCFG register.
In USB.H, look for the line 'USB_USE_FULL_SPEED TRUE', and change this to 'FALSE'.
Obviously NOXINST, VREGEN, if using the internal regulator etc., are also needed.
Best Wishes |
|
|
gangi
Joined: 14 Feb 2011 Posts: 2
|
|
Posted: Wed Feb 16, 2011 9:13 am |
|
|
Thanks Ttelmah!!
I didn't find the line 'USB_USE_FULL_SPEED TRUE' in the usb.h file but i found it in the pic18_usb.h file. Probably because my compiler version(4.088) is different than yours.
Thank you! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Wed Feb 16, 2011 9:38 am |
|
|
Yes, they changed the USB includes around V4.100. The newer ones have the define I gave.
Best Wishes |
|
|
|