Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alternative way of handling USB Mode Protocol #315

Draft
wants to merge 22 commits into
base: cth
Choose a base branch
from

Conversation

mchack-work
Copy link
Member

@mchack-work mchack-work commented Feb 6, 2025

read()/write() hides all the details of handling the USB Mode Protocol.

Unfortunately this also introduces 4 bytes to the .bss segment which was removed because of lack of FW_RAM, originally just 1 kB. We add back support in start.S and the linker script.

Would like to change the order of the stack and .bss, though. Will do an experiment with that in a moment.

@mchack-work mchack-work force-pushed the cth+usbmode branch 2 times, most recently from 0f0971c to c49b7da Compare February 6, 2025 12:15
@mchack-work mchack-work force-pushed the cth branch 4 times, most recently from 80e4101 to f777321 Compare February 6, 2025 14:42
agren and others added 14 commits February 6, 2025 16:20
Throwing away mode and length from incoming data. Adding mode and
length to outgoing data.

Splitting responses into frames small enough for the USB<->UART
transceiver to handle.
Add incoming and outgoing CTS (Clear To Send) signals for the FPGA to
let the CH552 and FPGA signal each other that it is OK to send UART
data. The CTS signals indicate "OK to send" if high. If an incoming
CTS signal goes low, the receiver of that signal should immediatly
stop sending UART data.
  - Use CTS signals to let the FPGA and CH552 signal each other that
    it is OK send UART data.
  - Update the CH552 rx and frame handling logic.
  - Fix minor spelling errors and indentation
Reconfigure the baudrate to keep 500 kbaud.

Correct a forgotten test in testfw that wasn't updated the last time
frequency was raised in commit
75b0285 in June 17, 2024.
Fix off-by-one UART bitrate counter value that will make the RX
sampling and TX sending drift. The impact gets higher as the baudrate
increases and the bitrate counter value gets smaller.
Make the CH552 present a new HID endpoint used for debug data.
Fix CDC configuration problem on Windows when we have a composite
device (multiple different Device Classes). Add "Interface Association
Descriptor" to make it work.
Update USB polling period (bInterval) for CDC, HID and TKEYCTRL
endpoints.
Set UART1 IRQ to high priority to not miss any incoming bytes
and tune USB polling period (bInterval).
Breaking change! The introduction of the USB Controller Protocol means
we have a breaking change that makes device apps unable to
communicate.
Instead of repeated RUNs in Dockerfile, move the entire build of
specific tools to a script.

- Make commands more shell script-like.
- icestorm: Make sure we checkout the right commit.
- Add checks for the right digest for all git clones, so no history
  has been changed.
- Add digest file and check for the downloaded tarball.
To get bash to source /etc/profile and get the goodness of
/etc/profile/bash_completion.sh, run bash as a login shell.
Use the release candidate for tkey-builder:5
For ages we have had a comment saying:

  For Verilator 5.019 -Wno-GENUNNAMED needs to be added to LINT_FLAGS for the
  cell library.

With the new tkey-builder we have 5.028, so it's time to apply this flag.
- Change checkfmt make target to run both Verilog formatting check and
  C code formatting check.

- Make check formatting it's own job in the CI.
@mchack-work mchack-work force-pushed the cth+usbmode branch 3 times, most recently from f021149 to 8a327c8 Compare February 10, 2025 10:46
Make read()/write() hide all the details of handling the USB Mode
Protocol.

Unfortunately this also introduces 4 bytes to the .bss segment which
was removed because of lack of FW_RAM, originally just 1 kB. We add
back support in start.S and the linker script.
Firmware and FPGA bitstream built with tkey-builder:5rc1.
Since we test the FW_RAM we can't keep anything there, not the stack
(already fixed by different start.S), nor the .bss, which we fix now
with a different linker script that uses app-RAM for .bss.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants