PDA

View Full Version : USB 18F2550 Problem



mackrackit
- 5th August 2010, 07:30
I went from the 4550 to the 2550 and have an interesting problem.
Went back to the basics http://www.picbasic.co.uk/forum/showthread.php?t=5806 and I still do not see what I am doing wrong.

In order for the device to connect I have to move the USBINIT below the FOR/NEXT loop...If USBINIT is in the "correct" place the device will not connet.
Doing that the device connects and will send data but the data looks like this.

` ($#_H! c 8 X- &X6USB CONNECTED!
The same happens on a 32 or 64 bit machine.
I have a 1.0uF cap on VUSB and I am running the chip at 3.3 volts as I do with a 4550.
The machine I am on tonight is running PBP 2.50
The code.

'USB_2550
@ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L
DEFINE OSC 48

Buffer VAR BYTE[16]
Cnt VAR BYTE
B0 VAR BYTE
B1 VAR BYTE

ADCON1 = 15 ' Set all I/Os to Digital
CMCON = 7 ' Disable Comparators
Cnt = 16

for b0 = 0 to 15
lookup b0,["USB CONNECTED!",10,13],B1
BUFFER(B0) = B1
NEXT B0
USBINIT
' Main Program Loop
Loop:
USBService ' Must service USB regularly
USBOut 3, Buffer, Cnt, loop
goto loop
END
Same code, same machine(s) with a 4550 works fine.

rsocor01
- 5th August 2010, 21:26
I have a 1.0uF cap on VUSB and I am running the chip at 3.3 volts as I do with a 4550.

Hi,

I don't think you need a cap on VUSB when Vcc=3.3V. I connected VUSB to 3.3V directly when using Vcc=3.3V, and it works great. Do you have the internal regulator disabled?

Robert
4669

mackrackit
- 6th August 2010, 02:34
If the regulator is not off by default then I guess not :o
I hope to be someplace tonight where I can look into that.
Thanks!

mackrackit
- 6th August 2010, 12:59
Like I say, once a newbie always a newbie.

Robert,
Your suggestion made me go back and look at the configs.
Here is my new set. That part that fixed it is in red. No other changes were made.
Thank you!!

@ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG2L, _PWRT_ON_2L & _VREGEN_ON_2L
@ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L

rsocor01
- 6th August 2010, 19:27
Like I say, once a newbie always a newbie.

I'm the newbie here :). I still have to learn a lot from you guys ;).

Did you fix the problem by disabling the internal regulator and by feeding 3.3V to VUSB? Did that fix the problems?

Robert

mackrackit
- 6th August 2010, 20:03
The problem was fixed by adding this to the configs
_XINST_OFF_4L
And I made sure the internal regulator is on to feed the internal USB pullups.

Power wise I am running the chip at 3.3 so the only thing I have connected to VUSB is the capacitor to VSS.

Now I do have some more reading to do as there is mention in the data sheet about VDD has to be higher than VUSB.
But it is working for now. Long term ????

Newbies---- IMHO Compared to two or three here we all are some newbie. But we can learn from anyone if we care to listen.

rsocor01
- 6th August 2010, 20:45
Well, I have a different setup. I disabled the internal regulator and fed 3.3V directly to VUSB. I assume the internal pullup resistors are enabled because my setup works fine. Otherwise, if they were disabled the USB interface wouldn't work because I believe the pullups are a requirement for USB.

I think the internal regulator function is to convert Vcc=5V to 3.3V which is necessary by the USB module. But, since you already have the 3.3V, then why the need to use the internal regulator?



Now I do have some more reading to do as there is mention in the data sheet about VDD has to be higher than VUSB.
But it is working for now. Long term ????

I have been through that pain already :eek:. Take a look at post# 4 in the following link.

http://www.microchip.com/forums/tm.aspx?m=493862&high=rsocor01

Please, let me know if you find out something else about this whole thing.

Robert