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

pkg/tinyusb: add usb_board_reset support #19006

Merged
merged 5 commits into from
Dec 6, 2022

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Dec 3, 2022

Contribution description

This PR provides tinyUSB support for module usb_board_reset when stdio_tinyusb_cdc_acm is used as stdio. The PR also provides some compilation fixes that occurred when adding usb_board_reset support and that are needed for successful compilation. In detail:

  • 6aa267c and d390b6c add the tinyUSB support of usb_board_rest.
  • ed585cf fixes a compilation problem when NDEBUG is defined.
  • b97da1b fixes a compilation problem when compiling tinyUSB for an application where USB_VID/USB_PID are not defined.
  • 4b32820 is a very small cleanup of tests/pkg_tinyusb_cdc_msc/app.config.test (out of scope of this PR but too small to fix as separate PR)

Testing procedure

Use any board that provides the tinyusb_device feature, e.g. the stm32f429i_disc1 and flash:

USEMODULE=' stdio_tinyusb_cdc_acm riotboot_reset usb_board_reset' \
BOARD=stm32f429i-disc1 make -C tests/shell flash

Once the USB port is recognized, execute

USEMODULE='riotboot_reset usb_board_reset stdio_tinyusb_cdc_acm' \
BOARD=stm32f429i-disc1 make -C tests/shell term PORT=/dev/ttyACM1

When using command

stty -F /dev/ttyACM1 raw ispeed 600 ospeed 600 cs8 -cstopb ignpar eol 255 eof 255

nothing should happen without commit 59e8ae8, but the board should restart with commit 59e8ae8. Without the other commits, the compilation fails completely.

Another example for testing would be:

FEATURES_PROVIDED=tinyusb_device USEMODULE='usb_board_reset stdio_tinyusb_cdc_acm' \
BOARD=nrf52840-mdk-dongle make -C tests/shell

When using command

stty -F /dev/ttyACM1 raw ispeed 600 ospeed 600 cs8 -cstopb ignpar eol 255 eof 255

the node restarts the application. With command

stty -F /dev/ttyACM0 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255

the node restarts in bootloader mode.

Issues/PRs references

Prerequisite for PR #18998

Modules `tinyusb_common` and `tinyusb_device` are enabled automatically when package `tinyusb` is used. There is no need to enable them manually.
@github-actions github-actions bot added Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework labels Dec 3, 2022
@gschorcht gschorcht added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 3, 2022
@riot-ci
Copy link

riot-ci commented Dec 3, 2022

Murdock results

✔️ PASSED

d390b6c sys/usb_board_reset: add stdio_tinyusb_cdc_acm support

Success Failures Total Runtime
117882 0 117882 01h:58m:05s

Artifacts

@github-actions github-actions bot added the Area: Kconfig Area: Kconfig integration label Dec 4, 2022
@benpicco benpicco merged commit 0d64cc2 into RIOT-OS:master Dec 6, 2022
@gschorcht
Copy link
Contributor Author

@benpicco Thanks for reviewing and merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants