CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Slow USB comm. with 18F47J53

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ombrastein



Joined: 14 Jul 2007
Posts: 7

View user's profile Send private message

Slow USB comm. with 18F47J53
PostPosted: Sat Nov 10, 2012 3:38 pm     Reply with quote

Hi

I have a very strange problem that I'm hoping someone can shed some light on.

I have built a HID usb device using 18F47J53. If i connect this to an UN-powered usb hub it all works perfectly fine.

However if I connect it to a POWERED hub communication becomes very slow, about 1/10th of the usual speed.

It is not the hub itself that causes the problem. I've got it working with the same hub, simply by unplugging its power, and its back to full speed.

I also tried it on other hubs, and directly to computer(which would count as powered hub). The problem is consistent across 3 computer with 4 different hubs. If the hub has power (or its a port directly on the computer, which is powered from inside computer), I get the slow communication. If the hub is unpowered, it works just fine.

I don't actually draw any power from the Vbus pin on the usb hub. it is connected through an inline 100k resistor to pin D4, and its pulled down to usb gnd(same as on-board gnd ofc), via 100k. The board has an isolated power supply via a dc/dc converted with LDO 3.3V regulator to smooth it out. The cpu is getting a nice clean 3.3V, and its GND is not connected to any external supply, so it cant be a ground loop issue.

The descriptors I use are virtually identical to the CCS example ones, except for some text and size of messages. I've previously used the same descriptor file with 18F4550 and did not have a similar problem.

One thing I noticed was that Vbus is 5V on the powered hub and 3.3V on the un-powered hubs. I'm using D4 as connection sense, which is 5.5V tolerant. Also I'm using the inline resistor and pull-down resistor as per datasheet self powered configuration.

Where should i begin to look? Anyone have any ideas what could be causing this?

This all worked fine before I changed my cpu from 18F4550 to 18F47J53.

I also have an EN28J60 NIC running on SPI on the same CPU and this works perfectly no matter what the usb is connected to, so it seems the cpu itself is doing fine. Just somehow the powered hub is making the communication slow down by 90%. Is it something in the device descriptor that could be set incorrectly?


Any suggestions, or even remote hunch at this point would be most welcome. Thanks Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19469

View user's profile Send private message

PostPosted: Sat Nov 10, 2012 4:31 pm     Reply with quote

Are you #defining USB_CONFIG_BUS_POWER to be zero?. Otherwise the default HID descriptor will be asking for power even if it isn't used.
How are you connecting and bypassing Vusb?.

Best Wishes
ombrastein



Joined: 14 Jul 2007
Posts: 7

View user's profile Send private message

PostPosted: Sat Nov 10, 2012 4:39 pm     Reply with quote

I tried with USB_CONFIG_BUS_POWER set to 0,10,100,400,500.
Neither helps.

Vusb is connected to my onboard 3.3V supply, like in Figure 23-10 of the datasheet.

What is really confusing is how it works so well when the hub I plug into is not powered, but if it is a powered hub (or computer internal usb port) it still works, only 10 times slower... very strange.
ombrastein



Joined: 14 Jul 2007
Posts: 7

View user's profile Send private message

PostPosted: Sat Nov 10, 2012 5:19 pm     Reply with quote

Thanks for your suggestion about Vusb. Don't know how I missed this, but I went back to check my circuit to make sure Vusb was actually connected according figure 23-10 like I stated, and of course it was not.


On 18F4550 Vusb is decoupled to GND, but on 18F47J53 Vusb needs to be connected to external 3.3V in self powered mode.


Now it works just fine, tho how this worked so well with hub's not powered is still confusing. I actually had no power supplied to Vusb, so how could the usb module still work?


Anyways, I got it working perfectly now, thx to your suggestion.

Cheers Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19469

View user's profile Send private message

PostPosted: Sun Nov 11, 2012 3:14 am     Reply with quote

Glad you got it.
The reason for asking about Vusb, is it's 'dual nature'.
You have to remember that anything like a bus transceiver will 'tend' to act as a diode if there are signals on it's input/output, but no supply. So once the bus is 'running', the USB bus would tend to power this line, if there is some capacitance present. However during connection, Vusb serves a different purpose, feeding the two resistors that configure the bus speed. At this point the bus is not being driven by the other end. If the D- line is seen as being above the D+ line, the USB bus will switch to low speed operation to the device. Now the behaviour will be very close to 'indeterminate', but I can quite see the possibility that changing the voltages being treated as the sense point at the hub (remember if it is only outputting 3.3vish, the hub itself is only running on 3.3vish), could affect which line is 'seen' as higher.....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group