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 remote wake up

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



Joined: 06 Jul 2020
Posts: 2

View user's profile Send private message

USB remote wake up
PostPosted: Mon Jul 06, 2020 3:26 am     Reply with quote

Hi

I'm investigating support for USB remote wake up, but comments in CCS source code mention it is not supported

Code:

#if USB_CONFIG_BUS_POWER
         0x80, //bit 6=1 if self powered, bit 5=1 if supports remote wakeup (we don't), bits 0-4 unused and bit7=1         ==7
#else
         0xC0, //bit 6=1 if self powered, bit 5=1 if supports remote wakeup (we don't), bits 0-4 unused and bit7=1         ==7
#endif


I'm using CCS version 5.081.

Is there a way to support this feature? What would it take?

Kind regards,
Merijn
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Mon Jul 06, 2020 4:01 am     Reply with quote

You do understand what this feature actually 'is'?.

This allows the device to wake the PC.

The only devices that normally support it, under Windows currently are
mice, keyboards, network adapters, some USB hubs, and modems.
Basically largely only HID devices.

You need to set the bit in the config descriptor to say that the device
supports this. With this set, when Windows goes to sleep it will send the
USB device a RequestSet packet, saying that it is going to sleep (and
a requestClear when it next wakes). You should toggle a status bit
when these are received, so you know whether the host is awake.

Then when you want to wake the PC (so before doing a data send), you
have to issue a 'resume' on the USB bus. This is done by setting the USB
'K' state for about 10mSec (must be >1, and <15). This depends on your
PIC, but on the USB PIC18's, what you do is set the 'RESUME' bit in
the controller, then clear it 10mSec later.
You should then receive the requestClear packet from the host, when
it wakes.
merijn



Joined: 06 Jul 2020
Posts: 2

View user's profile Send private message

PostPosted: Mon Jul 06, 2020 4:59 am     Reply with quote

Thanks for your reply!

I know enough of this feature to be sure it's what I need in my project, but don't know how to implement it. Since CCS offers libraries for keyboard, mouse and CDC - all device types that support remote wake up - I would have thought it would be implemented in those libraries or somebody on this forum has added support for it and is willing to share.

I'll study the info you gave and hope I can get this implemented. Didn't have much luck with USB in the past, but I'll learn (eventually)

Merijn
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