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

MIDI Program Change broken in TinyUSB commit 42326428 (0.17.0 WIP) as used by the Pi Pico SDK 2.0.0? #2775

Open
1 task done
xoblite opened this issue Aug 25, 2024 · 6 comments
Labels

Comments

@xoblite
Copy link

xoblite commented Aug 25, 2024

Operating System

Others

Board

Raspberry Pi Pico 2 (RP2350)

Firmware

Pico SDK 2.0.0, which per its release notes includes TinyUSB commit 4232642 (0.17.0 WIP).

What happened ?

uint8_t midi_program_change[2] = { 0xc0 | channel, program};
tud_midi_stream_write(MIDI_cable, midi_program_change, 2);

This seems to change the program, but immediately after reverting back to program #0, possibly repeatedly (?) (i.e. getting stuck in some kind of loop doing so).

How to reproduce ?

See above.

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

See above.

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.
@liamfraser
Copy link
Collaborator

Is this still an issue? Have you tried updating the tinyusb submodule to latest master? We intend to move to 0.17.0 for the next SDK release

@xoblite
Copy link
Author

xoblite commented Nov 19, 2024

I will try to check and report back in the next couple of days if that's OK - is the next Pico SDK release imminent?

@liamfraser
Copy link
Collaborator

In the next week, but in the meantime you can go into pico-sdk, cd lib/tinyusb, git checkout 0.17.0 to test locally. Or you can clone my branch of pico-sdk here https://github.com/liamfraser/pico-sdk/tree/tinyusb_0_17

@xoblite
Copy link
Author

xoblite commented Nov 19, 2024

Got curious, checked out master and recompiled my application, and the issue is still there. However, it seems my original finding and the above reported issue may actually be a secondary effect; when I first noticed the repeating behaviour as outlined above, I was working on some Program Change related things, so my focus was on that specifically. However, looking at it again now, I see other things being repeated too, so I tried to trace further backwards, and it seems it could be related to my application sending periodic MIDI clocks...

uint8_t midi_clock[2] = { 0xf8, 0 };
tud_midi_stream_write(MIDI_cable, midi_clock, 2);

...because when I send these (nb. which happens continuously at 24 PPQN), it also seems to trigger repetitions of the latest other message type (first byte) but with the second and third bytes set to zero; cf. my prior observation of a program change reverting back to program #0 right after (it also happens to other message types, e.g. repeated note off messages with note and velocity set to zero). And, if I comment out the above lines i.e. do not send MIDI clock to TinyUSB, no such repetitions occur, so this does indeed seem to be the root cause.

As this is quite obscure a finding though, I think it would be good if someone else can replicate and confirm. @liamfraser do you have the tools to do this maybe? (I'll leave this issue as is until the updated root cause is confirmed by others).

PS EDIT: If anyone needs a good MIDI monitor application for the above purpose, see e.g. ShowMIDI.

@xoblite
Copy link
Author

xoblite commented Dec 4, 2024

@liamfraser Any updates from your side post SDK 2.1.0 release?
Have you been able to confirm the issue as described above, or should I try to find someone else to do so? Thanks :)

@liamfraser
Copy link
Collaborator

Do you have a full program which can demonstrate this issue? Even better if it is self checking. Unless this is an RP2350 specific issue then this is really an issue for @hathach to look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants