libopencm3 / libopencm3-examples

Simple example projects showing how to use libopencm3.
489 stars 326 forks source link

USB_MIDI doesn't work anymore after code changed. #204

Open imrahjel opened 4 years ago

imrahjel commented 4 years ago

Hello,

I'm working on Debian 10, using VS Code to edit the files and doing the rest command line. I'm new to stm32 and C programming.

I was successful to run the USB_MIDI example on STM32F4discovery board. I did "$ make -C libopencm3 #" once with success I did "$ make -C my-project" after I pasted the whole example source code in 'my-project.c' with success I did "$ st-flash write my-project/myfile.bin 0x08000000" with success, or at least without visible error. the board is then recognized as a USB MIDI device which I can assess with "$ amidi -l"

Now, if I alter the code in 'my-project.c' and this whatever the code, even a useless simple piece of code, everything runs exactly as mentioned above, with the only difference that the board is not recognized as USB MIDI device anymore.

This is really strange as I didn't modified any crucial part of the code, only adding some useless line(s) in the WHILE loop. And of course nothing I added required anything more than what is already part of #include. As an example of what I tried, I pasted a wait loop from ADC example as follows :

    int i;
    for (i = 0; i < 800000; i++) {    /* Wait a bit. */
        __asm__("nop");
    }

I'm totally lost with this issue, it's seems to me like if the USB MIDI example is designed to prevent adaptation, which is a non sense I know :).

I went through the other issues reported but found nothing relevant to my situation.

if anyone here has the smallest idea or direction, this will be more than welcomed as I start to drive crazy.

Many thanks, Imrahjel.

karlp commented 4 years ago

without seeing what yhou actually did, there's ~nothing that can be said further. Try sharing your modified project somewhere. Note that you cannot just start adding busy waits to a usb project, you must keep calling usbd_poll() regularly.