|
|
View previous topic :: View next topic |
Author |
Message |
SteveW
Joined: 27 Sep 2005 Posts: 25
|
24FJ256GB406 USB Unplugged Detection |
Posted: Mon Sep 26, 2016 11:03 pm |
|
|
I am using a 24FJ256GB406 with HID operation with CCS 5.62. The PC recognizes the device, and my circuit recognizes that connection and communications is fine. The problem is that when the connection is broken (i.e., the USB connector removed) the device does not recognize the new status. With an earlier version of the design using a 24FJ256GB106 with CCS 4.141 all was well.
Prior to the initial USB connection, the VBUS pin is low, as expected, but after the USB session when the USB connector is unplugged, the voltage at VBUS stays around 2.2V (the board is running on 3.0V and I have a 10K pull-down resistor on VBUS). This voltage is apparently sufficient to keep the VBUS-level sensing comparator in the detected state. My assumption is that this is caused by the pull-up resistor controlled by SRP Charge (in figure 20-1, sheet 324 of the PIC24FJ256GA412/GB412 family data sheet), as no other source of current is shown in the data sheet.
I can makes things work by decreasing the pull-down resistor on VBUS to 1K (thus the pull-up resistor controlled by SRP Charge appears to have a value of a few k-ohms). As soon as the device senses that the USB link is broken, the voltage at VBUS returns to zero. I tried adding the following code to keep the SRP Charge pull-up off (assuming that is indeed the problem), to no avail.
Code: |
#bit U1OTGCON_VBUSCHG=getenv("BIT:VBUSCHG")
while (usb_attached()) {
U1OTGCON_VBUSCHG = 0; // Force Vbus pull-up off
stuff....
}
|
Does anyone have any ideas?
Steve |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Tue Sep 27, 2016 5:52 am |
|
|
re: With an earlier version of the design using a 24FJ256GB106 with CCS 4.141 all was well.
if it worked before....
1) hardware has changed ? maybe wrong value component ??
2) software issue? compiler has a 'bug' and wrong bit of a register is being diddled ?? did you really need to upgrade the compiler ??
Any chance you can 'turn back the clock', use the older compiler to confirm the new hardware config is correct ? If possible go ALL the way back to what did work,confirm, THEN just change the compiler and see what happens.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Tue Sep 27, 2016 6:53 am |
|
|
If you look at the data sheet, you will see that the internal circuit is different between the two chips.
Vbus on the original chip connects to the internal 3.3v regulator to power the transceivers. On the later chip you have to provide this power externally.
Vbus going low, is a signal to say 'not enough power to run the transceivers'. This can be used as connection sense, but only if Vusb3.3 goes off, when the external USB power is not present (which it does with the internal regulator).
So how are you driving the 3.3v USB transceiver power?. The transceivers, and the full speed pull-up signal, will drive power into the Vbus line, if they are enabled, and Vusb is maintained (which is what you are seeing).... |
|
|
SteveW
Joined: 27 Sep 2005 Posts: 25
|
|
Posted: Tue Sep 27, 2016 5:59 pm |
|
|
Ttelmah: My first reaction was indeed to go back to the old compiler, but upon seeing the resulting error message I quickly remembered that the reason for my going to the new compiler was that the old version doesn't support the new part. The 106 works fine, but the 406 uses significantly less power, and my application requires years of battery life, although most while sleeping.
Could my initial proof-of-concept design have just barely worked with a 10K pull-down on Vbus, and due to tolerances of the internal SRP Charge pull-up the new design doesn't quite work? Sure, that is possible.
My suspicion is a bug in the compiler because in the HID device mode there is no reason for the SRP Charge pull-up to be active, and I can't find a way to disable it. I might just live with a stiff pull-down for the time being (a few mA on the USB power line from a PC is not significant).
Now to the response from Jay dealing with power differences. Yes, I noted them. I am using the classic "self-power only" configuration with Vusb connected internally to 3V, and Vbus powered by the PC via the standard USB cable. Again, a connection is detected and communications is normal. The problem occurs when the USB cable is removed, and Vbus remains high via a pull-up somewhere. This results in a latch-up condition since the voltage at that point determines the connection status. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Wed Sep 28, 2016 1:31 am |
|
|
How are you supplying Vusb?.
The chips are fundamentally different in what has to be done with this pin. |
|
|
SteveW
Joined: 27 Sep 2005 Posts: 25
|
|
Posted: Wed Sep 28, 2016 4:08 pm |
|
|
Vusb is connected to Vdd, 3.0V, power on the board. This is exactly per figure 20-3, Self-Power Only, on the data sheet. |
|
|
|
|
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
|