USB Midi stops working if using semi hosting

Hi Guys,

The USB Midi stops working if semi hosting is turned on.

The USB Midi device is still fine from the hosts side, no issues there.

Has anyone got any experience of getting this to work?



Hi @BobTheDog thanks for reporting an issue.

Could you give a bit more info about the workflow you’re using, and possibly include a snippet of code that triggers the behavior?

Which I/O are you attempting to use for semihosting?

It’s worth mentioning that at this time, Composite USB classes (setting up a single USB peripheral to have multiple interfaces like MIDI and Serial simultaneously) is not implemented yet.
So if you’re trying to use the same USB port for MIDI and for Serial Communication that could explain what you’re experiencing.


The semihosting is over st-link, just console output.

Linking with LDFLAGS = -lc -lrdimon --specs=rdimon.specs and calling in code initialise_monitor_handles(); causes the USB Midi code to stop working.

Semihosting logging does work though :slight_smile:

edit: Actually I think just changing the LDFLAGS will stop it working.

Interesting. I don’t think I have tried to do it with the approach you’ve mentioned, though I did have something working with printf at some point where I may have followed these same steps to do so.

However, I wasn’t attempting to use USB at the same time. So I don’t think I would have caught this issue.

I believe the Logger<LOGGER_SEMIHOST> accomplishes the same functionality, and would be my recommended usage (especially if it’s working for you).

The default LD flags for your project build are in the core/Makefile.

If changing/adding to that is causing the issue, it could possibly be an issue with combining rdimon with nosys, but I really haven’t experimented enough with those flags to know for sure.

I think it is quite easy to replicate, use LDFLAGS = -lc -lrdimon --specs=rdimon.specs and test USB Midi, it will not work.

Also Logger<LOGGER_SEMIHOST> will not work unless those linker flags are used, unless I am missing something.

Here is the code:

    if(CoreDebug->DHCSR & 0x01)


        Logger<LOGGER_SEMIHOST>::Print("Hello %u\n", uCount++); 

So that all works as long as the linker flags are set correctly but USB Midi does not work if those linker flags are set.

Thanks for the additional info, I’ve opened up a github issue on libDaisy, and our team will begin an investigation of the issue.

Thanks, I will try to dig out some more info…