View previous topic :: View next topic |
Author |
Message |
vtrx
Joined: 11 Oct 2017 Posts: 142
|
USB HID Two descriptor |
Posted: Wed Sep 04, 2019 10:31 am |
|
|
Is it possible to choose between two descriptors that will be selected depending on a value read from Eeprom or a button?
I'm using 18F4550. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19368
|
|
Posted: Thu Sep 05, 2019 12:16 am |
|
|
Yes it is perfectly possible to have a selectable descriptor, but the
problem is 'when'. Before you attach it to the USB bus. No problem. But
remember the device enumerates as soon as it is attached, and you cannot
change the descriptor once this is done.
Quote from the USB paperwork:
Quote: |
A device must not change the information contained in the device descriptor during the lifetime of a connection, including during power state changes.
|
So, 'yes' you can have a button to change the descriptor, but not after
it is connected. As soon as the USB connection is made, the descriptor
is _required_ to remain fixed. |
|
![](templates/subSilver/images/spacer.gif) |
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Thu Sep 05, 2019 4:18 am |
|
|
Quote: | So, 'yes' you can have a button to change the descriptor, but not after
it is connected. As soon as the USB connection is made, the descriptor
is _required_ to remain fixed.
|
If I use the RESET instruction, would the device not enumerate again? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19368
|
|
Posted: Thu Sep 05, 2019 7:19 am |
|
|
No.
The enumeration occurs when the USB device initially attaches to the bus.
The pull up resistors are sensed and trigger it.
Potentially if you switched the USB peripheral physically off, and made
sure the internal pull ups are also disabled, wait for a time, then re-enable it,
a new enumeration should result |
|
![](templates/subSilver/images/spacer.gif) |
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Fri Sep 06, 2019 2:11 pm |
|
|
How to enable and disable USB module or USB Pull Up resistors by CCS? |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Fri Sep 06, 2019 2:41 pm |
|
|
It _may_ be possible IF the USB module allows you access to it's 'internals' via something like a Hayes Modem Command set, though I've never seen any documentation that shows that ability.
IF the USB section is inside the PIC, then yes, you stand a good chance of controlling the module.
I only use USB<>TTL modules so I can't help with using the USB inside a PIC.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Sat Sep 07, 2019 8:47 am |
|
|
I'm using it this way:
Code: | #bit UTRDIS = getenv("BIT:UTRDIS")
UTRDIS = FALSE; //enable transceiver
UTRDIS = TRUE; //disable transceiver |
I still need to physically disconnect the device ... |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sat Sep 07, 2019 4:01 pm |
|
|
I'd think you also have to disable the USB bus internal pullup resistors. Without those the PC USB SW should 'see' the PIC go missing...and then release that USB port.
My understanding is it's those resistors that 'tell' the USB host 'I'm here and at this speed'.....
Those that still use the 4550 may be able to tell you better.
It's only a couple lines of code for you to add and try....
Jay |
|
![](templates/subSilver/images/spacer.gif) |
|