Thanks for offering to help debug my code and private support. However I have stripped my code from everything except the USB code. Feel free to use this code as you wish.
First I made a VDK thread that just called the main function from the example, without reproducing my problem.
When I added VDK messaging I could reproduce the error. So the problem has to do with USB interrupts and messaging I suppose.
Best regards
Mårten