If I understand correctly, you have not yet built the USB portion (diodes and resistors) of the circuit? If this is accurate, it will hang every single time you make a call to write to the USB bus as there is no USB connection.
This got me during testing as well ![]()
PS, I also don't see the main loop in your code where you would make that call...