Skip to content

Commit

Permalink
eptri: use EventSourceProcess to signal usb reset
Browse files Browse the repository at this point in the history
USB resets may be prolonged -- we detect them after 2uS, but they can be
as long as 2mS.  Previously, we were using an EventSourcePulse for this,
which meant we were generating an endless stream of interrupts during a
reset condition.

Use an EventSourceProcess with an inverted signal to turn the
level-triggered USB reset event into an edge-triggered one.

Signed-off-by: Sean Cross <sean@xobs.io>
  • Loading branch information
xobs committed Nov 29, 2019
1 parent 97ac21d commit b262b99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions valentyusb/usbcore/cpu/eptri.py
Expand Up @@ -487,14 +487,14 @@ def __init__(self, usb_core):
description="""
Indicates a ``SETUP`` packet has arrived
and is waiting in the ``SETUP`` FIFO.""")
self.ev.submodules.reset = ev.EventSourcePulse(name="reset",
self.ev.submodules.reset = ev.EventSourceProcess(name="reset",
description="""
Indicates a USB ``RESET`` condition
has occurred, and the ``ADDRESS`` is now ``0``.""")
self.ev.finalize()
self.trigger = trigger = self.ev.packet.trigger
self.pending = pending = self.ev.packet.pending
self.comb += self.ev.reset.trigger.eq(self.usb_reset)
self.comb += self.ev.reset.trigger.eq(~self.usb_reset)

self.data_recv_payload = data_recv_payload = Signal(8)
self.data_recv_put = data_recv_put = Signal()
Expand Down

0 comments on commit b262b99

Please sign in to comment.