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 CCS Technical Support

USB HID Two descriptor

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



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

USB HID Two descriptor
PostPosted: Wed Sep 04, 2019 10:31 am     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Thu Sep 05, 2019 12:16 am     Reply with quote

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.
vtrx



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

PostPosted: Thu Sep 05, 2019 4:18 am     Reply with quote

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?
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Thu Sep 05, 2019 7:19 am     Reply with quote

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
vtrx



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

PostPosted: Fri Sep 06, 2019 2:11 pm     Reply with quote

How to enable and disable USB module or USB Pull Up resistors by CCS?
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Sep 06, 2019 2:41 pm     Reply with quote

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
vtrx



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

PostPosted: Sat Sep 07, 2019 8:47 am     Reply with quote

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 ...
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Sep 07, 2019 4:01 pm     Reply with quote

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
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