Waking host with USB driver Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Waking host with USB driver

Post by e_l_tang »

Is there a way to wake up the host during suspend? I did not find any function which could do this in the API.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Waking host with USB driver

Post by Giovanni »

Hi,

It is the host that wakes up the device if I remember well.

Giovanni
e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: Waking host with USB driver

Post by e_l_tang »

Some classes of devices need to be able to wake up the host as well. For example a keyboard or mouse needs to wake up the host when the user provides input.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Waking host with USB driver

Post by Giovanni »

How is the host signaled?

Giovanni
e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: Waking host with USB driver

Post by e_l_tang »

On an AVR the USB hardware does it when a bit is set in a register. I imagine that other chips don't do it much differently.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Waking host with USB driver

Post by Giovanni »

Moving this topic under "change request".

Giovanni
e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: Waking host with USB driver

Post by e_l_tang »

For your reference, here is some example AVR code. Hope it helps.
User avatar
FXCoder
Posts: 403
Joined: Sun Jun 12, 2016 4:10 am
Has thanked: 188 times
Been thanked: 134 times

Re: Waking host with USB driver

Post by FXCoder »

One this topic...
We had a thread going that discussed the RWUSIG bit in the last posts.

The primary matter was RWUSIG being set by the USB driver instead of being cleared....
viewtopic.php?f=38&t=4076&start=10#p29927

In the case of an application level setting RWUSIG then the RWUSIG bit would need to be explicitly cleared by the driver (which it currently isn't - it is set instead).
If RWUSIG is set by the core (from L1 sleep state) then it is cleared automatically 50us later.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Waking host with USB driver

Post by Giovanni »

Hi,

I added a tentative usbWakeupHost() API to trunk, I have no way to test it, could you give a feedback?

I will back-port the change to 17.6.x if it is OK.

Giovanni
e_l_tang
Posts: 33
Joined: Sun Jul 03, 2016 7:58 pm
Been thanked: 2 times

Re: Waking host with USB driver

Post by e_l_tang »

I took a look at the code and I think the high level driver could be made more general. On AVR the software simply sets the bit and the hardware takes care of the rest. It is not necessary for it to wait or clear the bit.
Post Reply