You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e2fcd11
Browse filesBrowse the repository at this point in the historyBrowse files
LindeAPI: test against a simulated lin_usb device, fix what it found
FakeLinUsbDevice transcribes the USB layer of the firmware's lin_usb.c
(STALL rules, one ACK per set-data packet, held ACK with the IN queue full,
dropped counter). The LIN engine is not in this repository; its part of the
fake was measured on a CANILFD adapter with the new hw_compare commands
linusb-probe / linusb-engine / linusb-driver (0 differences). Tests link
FakeUsbVendorInterface.cpp in place of UsbVendorInterfaceLibusb.cpp.
Driver fixes:
- selecting a schedule table that was never loaded stopped the master's
running schedule; it now keeps the current one and warns
- BUS_STATE.dropped counts since the device's last USB reset, so drops of an
earlier session showed up as overruns at measurement start (seen on the
adapter); counted from open() now
- device timestamps jumped 49 days back when HAL_GetTick() wrapped; the
difference is taken modulo 2^32
tests/support/LogCapture is thread safe now: drivers log from reader threads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Engine (`linusb-engine`) | protected IDs (0x21 -> 0x61); publisher frames RESPONDED + VALID; unanswered subscriber slots SUBSCRIBER + ERROR, data zero, BUS_STATE then ERROR; set data accepted only while started and only for an ID in the active table (publisher or subscriber), otherwise ERROR ACK; new payload from the next slot on; sleep: id 0, dlc 8, `00 FF..`, SLEEP, state SLEEPING; wakeup: id 0, dlc 0, WAKEUP; STOPPED until MODE START. Modelled in the fake, `linusb-probe` 0 differences (6 runs) |
110
+
|`LindeApiInterface` (`linusb-driver`) | opens in 40 ms; TX / RX direction, NotResponded errors, set data, rejected set data (TX error), timestamps, counters as in the unit tests; selecting a table that was never loaded keeps the schedule running (fixed driver) |
111
+
| BUS_STATE.dropped | counts since the last USB reset, across host sessions: 422 left over from an aborted run showed up in the next one. The driver now counts from its open() |
112
+
113
+
Found and fixed in the CANILFD firmware (`Libraries/LinIF/LinIF.c`,
114
+
`Libraries/USBClasses/lin_usb_engine.c`): a channel stopped by the host
115
+
(MODE STOP) restarted itself. `LinIF_Stop()` only cleared `isActive`, so the
116
+
RXNE edge from disabling the transceiver (or any bus activity) looked like a
117
+
slave wakeup to `LinIF_MasterWakeupISR()`, and 100 ms later `LinIF_Wakeup()`
118
+
restarted the schedule while BUS_STATE still said STOPPED; a stopped slave
119
+
came back on the next break. A host sleep / wakeup on a stopped channel was
120
+
queued or restarted it too, and reported events that did not match the command
121
+
(sleep -> wakeup). LinIF now has a `stopped` flag that only `LinIF_Start()`
122
+
clears, and the engine ignores sleep / wakeup for a channel the host has not
123
+
started. With the fixed firmware `linusb-probe` checks this (sleep / wakeup on
124
+
a stopped channel: no events, no stale go-to-sleep at the next START, nothing
125
+
sent after STOP): 0 differences in 12 runs; before, the spontaneous wakeup
126
+
showed up in about 3 of 5.
127
+
128
+
Not covered: a real slave on the bus (responses, checksum errors), slave and
0 commit comments