Now it waits correctly for usb configuration before sending or receiving any data. Wait function added.