View previous topic :: View next topic |
Author |
Message |
bigseacow
Joined: 17 Jul 2009 Posts: 8
|
USB Device Not Recognized |
Posted: Fri Jul 17, 2009 3:04 pm |
|
|
I am new to USB and working with a 18F46J50. I am trying to run the CCS example bootloader code but when I run the code the "USB Device Not Recognized" message comes up on the PC. I made the necessary changes to the pins and fuses in the example so it would work on our board. I also tried a different computer and the same message shows up on the PC. Could someone guide me to what causes this message? Is this message related to a voltage issue/a file missing on the PC/or a particular setting for the PIC? It looks like it is caused by enumeration failing between the PC and device, but I am unsure what is required for enumeration to work.
Thanks |
|
|
jaderd
Joined: 26 Jun 2009 Posts: 19
|
|
Posted: Mon Jul 20, 2009 5:43 am |
|
|
In my case, the big problem was that the pins of d + and d- is reversed in the connector, because the source that I basically was not for the pinout reliable. |
|
|
Guest
|
|
Posted: Mon Jul 20, 2009 9:49 am |
|
|
Hi jaderd, thanks for the tip. I checked the d+/d- wiring and it is correct. I measured the voltages and d- came up as 0v and d+ as 2.9v, this should be a full speed device. Based on some documentation I read it looks like d- should be around .35v unless something is being transmitted. Is that correct? I checked the registers UCFG = 0x14 when UCON.USBEN = 1.
any help appreciated |
|
|
bigseacow
Joined: 17 Jul 2009 Posts: 8
|
|
Posted: Tue Jul 21, 2009 12:47 pm |
|
|
I have since tried the ex_usb_hid.c demo with the same issue resulting. I have checked my clock speed and fuses and believe they are correct, see below 12mHz crystal. The d+/- lines are wired correctly. With the USB analyzer it looks like no descriptor data is being sent to the PC yet it is included in the example program.
Changes to the example program
Code: | #include <18F46j50.h>
#fuses HSPLL,NOWDT,NOPROTECT,NODEBUG,PLLDIV3
#use delay(clock=12000000)
char ancon0;
#LOCATE ancon0=0xf48
char ancon1;
#LOCATE ancon1=0xf49
#define LED2 PIN_E0
#define LED3 PIN_E1
#DEFINE BUTTON PIN_B2
#define LED_ON output_high
#define LED_OFF output_low
#define USB_CON_SENSE_PIN PIN_C2
|
Changes in main
Code: | // Set Tristate buffer port b input
set_tris_b(4);
// Disable pullups on port b
port_b_pullups(FALSE);
// Setup the board for digital inputs
ancon0 = 0xFF;
//ancon1 = 0xFF;
ancon1 = 0x1F; |
Thanks for your help |
|
|
bigseacow
Joined: 17 Jul 2009 Posts: 8
|
|
Posted: Tue Jul 21, 2009 1:18 pm |
|
|
The example code now works. It turns out the PLLEN bit on the OSCTUNE register is by default set for input directly for the oscillator. The change is listed below.
Code: |
char osctune;
#locate osctune = 0xF9B
// in main
osctune = 0x40;
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jul 21, 2009 1:19 pm |
|
|
Quote: | #include <18F46j50.h>
#fuses HSPLL,NOWDT,NOPROTECT,NODEBUG,PLLDIV3
#use delay(clock=12000000) |
With your fuse settings, the CPU frequency will be 48 MHz, not 12 MHz.
You said you have a 12 MHz crystal connected to the PIC. You're using
PLLDIV3, to divide it down to 4 MHz, which is the required input frequency
for the PLL. The PLL puts out 48 MHz. The default CPU divisior is 1.
Therefore, your CPU frequency is the same as the PLL frequency of 48
MHz. Change the #use delay() to be 48 MHz.
See the entry for 12 MHz (in the 1st column) of this table in the 18F46J50
data sheet:
Quote: | TABLE 2-5: OSCILLATOR CONFIGURATION OPTIONS FOR USB OPERATION |
|
|
|
bigseacow
Joined: 17 Jul 2009 Posts: 8
|
|
Posted: Tue Jul 21, 2009 1:34 pm |
|
|
Thanks for clearing that up. I overlooked that table in the data sheet. There was some debate between myself and the board designer about how #use delay should be configured. I have changed the #use delay() to 48 000 000 and then everything looks good. |
|
|
LAXE Guest
|
Problem with serial communication using pic18f46J50 |
Posted: Fri Jul 24, 2009 3:42 am |
|
|
Hi,
I am using pic18f46j50, that is on the MA180024 board of Microchip. I am able to turn on leds but I can't get the serial communication works good.
Could somebody help me? I donĀ“t know if the problem is the fuses configuration or the crystal speed.
I am using the last configuration you (PCM programmer and bigseacow) proposed but I only see strange symbols in the hyperterminal.
thanks a lot |
|
|
|