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

TinyUSB HOST_HID issue on debug builds #649

Closed
dshadoff opened this issue Nov 2, 2021 · 11 comments · Fixed by hathach/tinyusb#1181
Closed

TinyUSB HOST_HID issue on debug builds #649

dshadoff opened this issue Nov 2, 2021 · 11 comments · Fixed by hathach/tinyusb#1181
Assignees
Milestone

Comments

@dshadoff
Copy link
Contributor

dshadoff commented Nov 2, 2021

I believe that something in the cmake hierarchy is overriding something important in TinyUSB's HOST_HID stack, leading to a runtime issue.

I had a project based on SDK 1.2.0 and TinyUSB's host_cdc_msc_hid example (any version from July 4 onward), which was working fine. Compiling with the new SDK 1.3.0 compiles fine, but no USB mouse messages reach the code.

Putting that aside, I decided to recheck that the TinyUSB example was still working properly:

  1. From inside the ($PICO_SDK)/lib/tinyusb/, I ran 'make BOARD=raspberry_pi_pico all', and tested the compiled .uf2 file, which worked perfectly.
  2. I then tried the corresponding pico_examples build, which appears in $(pico_examples)/build/usb/host/host_cdc_msc_hid after the full tree build. The output (using the same hardware) was:
TinyUSB Host CDC MSC HID Example
assertion "ep->active" failed: file "/home/pi/devel/pico/pico-setup/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c", line 164, function: hw_trans_complete

I would file this as an issue under pico_examples, but it also affects my project which is separate and not dependent on pico-examples.

@kilograham
Copy link
Contributor

is 1 vs 2 possibly a release build vs debug build thing?

@dshadoff
Copy link
Contributor Author

dshadoff commented Nov 2, 2021

I built as defaults; are you saying that the default build in pico-examples is debug ?
(I don't receive an assert on my (non-debug) build of my own project, but failing to react to mouse events is similar behaviour other than the lack of assert output)

Difference in operation between 1 and 2 is that displays mouse events, and 2 simply stops doing anything after the assert.

@kilograham
Copy link
Contributor

debug is not the default (well from the command line - might be in your IDE), but assert should do nothing in a release build. but yeah i was wondering if the only reason 1 does something is that the assertion is suppressed.

@dshadoff
Copy link
Contributor Author

dshadoff commented Nov 2, 2021

For context, I develop for pico on a Raspberry Pi 400 from command line in shell. To try out the new sdk 1.3.0, I started with a fresh git clone and run of pico-setup (after moving the top-level of the previous one aside by renaming it).

@kilograham kilograham removed their assignment Nov 2, 2021
@kilograham
Copy link
Contributor

OK - well i see the same issue with TinyUSB HID mode with a debug build, but not with a release build. With a release build mouse works fine for me.

Seems like TinyUSB have broken the debug version.

I didn't realize pico-setup defaults the build to Debug. Simplest thing is to create a clean build directory and run cmake .. again

@lurch
Copy link
Contributor

lurch commented Nov 3, 2021

Or you can create a clean build directory and run either cmake .. -DCMAKE_BUILD_TYPE=Release or cmake .. -DCMAKE_BUILD_TYPE=Debug to explicitly force the build-type.

@dshadoff
Copy link
Contributor Author

dshadoff commented Nov 3, 2021

Yes, this was the chain of events:

  • default build of pico-examples from pico-setup is a debug build
  • TinyUSB has some sort of issue on debug build

After this was shown to be the case, I examined changes to the Host HID example code, and it turns out that several of the axiomatic defines variables were changed in the intervening time (not just values, but also names !). So I have fixed my problem.

I feel like this issue should probably remain open until the TinyUSB issue on debug builds is fixed, however.

@dshadoff dshadoff changed the title SDK 1.3.0, CMake, and TinyUSB HOST_HID - OK compile but operation is wrong TinyUSB HOST_HID issue on debug builds Nov 3, 2021
@kilograham kilograham added this to the 1.3.1 milestone Nov 17, 2021
@kilograham
Copy link
Contributor

we will pick up the fixed upstream TinyUSB in 1.3.1

@kilograham
Copy link
Contributor

@liamfraser to decide what to include for 1.3.1 or wait for 1.3.2

@kilograham kilograham modified the milestones: 1.3.1, 1.4.0 May 10, 2022
@kilograham
Copy link
Contributor

Moving to 1.4.0 as we will not pick up new TinyUSB in 1.3.x branch

@kilograham kilograham modified the milestones: 1.6.0, 1.5.0 Jun 30, 2022
@kilograham kilograham modified the milestones: 1.6.0, 1.5.0 Jan 20, 2023
@kilograham
Copy link
Contributor

merged into develop

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 a pull request may close this issue.

4 participants