Hi,
I am using K66F MCU to build USB HID to communicate with PC. And I have the problem:
1) When I provide VBUS by PC host, it works fine when USB cable is plugged in. But, if USB not plugged in, the firmware is hang up.
2) If I plugged in USB cable, start running, then I can plug or unplug without any problem.
3) If I power USB by 5VDC, not from VBUS, it works fine...
Can anyone help me to debug where the problem is and how to fix it?
Thanks,
Christie
Hi,
I found the following cause the problem:
The MCU is stalling after command execution
static void USB_DeviceEhciSetDefaultState(usb_device_ehci_state_struct_t *ehciState){
...
hciState->registerBase->DEVICEADDR = 0U;
}
Can anyone help me how to fix the problem?
Thanks,
Christie
Setting the USB Address to Zero at the start of enumeration is normal. That in itself isn't going to cause any issues.
What is the line before that doing? Sometimes the debuggers can be off by a line when there is a fault.
What is powering the device when this happens?
Is there a bus fault trap set up that would show the address of any bus faults? Could something be invalid with ehciState in this power configuration?
Another thing, it works fine if I remove set address command...
Hi bobpaddock,
Thanks.
If VREG_IN0, VREG_IN1, and USB1_VBUS of MCU are powered by 5V or Vbus(USB cable plugged in), it works fine.
If there is no power on VREG_IN0, VREG_IN1, and USB1_VBUS of MCU, it hangs on set address command. But, if I plug in USN cable, then it works again...
If there is any privilege to write this register(offset=0x0154)? Or need to enable something before writing to this register?
Thanks,
Christie
Hi bobpadock,
Yes. You are right. If there is power on VEG_IN0&1, it works fine.
I am using BUS_powered mode. If there is no power and should not initialize USB?
I have to know the USB1_VBUS pin status. Could you tell how to do that?
I am using usb_1.6.3 for K66F MCU for now?
Thanks,
Christie
Hi,
My problem is:
In bus-power mode USB device, if no USB cable connected to Host, there is no power and I am hanging on set to the default address line. But, if no power, USB drive is not normal, I can't read the USB1_VBUS register, right?
Can anybody tell me how to get USB1_VBUS status? Can I read this register even without USB power?
I am using K66F MCU...
Thanks,
Christie
Hi bobpaddock,
Thanks.
Do you have any detail for this recommendation?