- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the following problem with device enumeration on a CY8CKIT-059:
Anytime I program the device from the kitprog and then connect the USB - everything works as expected.
However once I program the board and remove the kitprog usb the USBFS component fails to get past "while(!USBFS_GetConfiguration())".
I feel its not a power supply problem for the following reasons:
1. All code before "while(!USBFS_GetConfiguration())" runs when I connect the micro USB port to my computer
2. Even if I plug in the kitprog into the computer and then plug in the micro USB - the program halts at "while(!USBFS_GetConfiguration())".
I am using libusb on the host side to communicate with the device and the following code prints out "device not found" (unless of course I program the kit and then plug in the usb while the device is powered)
dev = libusb_open_device_with_vid_pid(NULL, 0x1111, 0x2222);
if (dev == NULL) {
cout << "device not found" << endl;
return false;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Never mind, I got it to work. I was making a smaller project to show the problem and realized in the process that shifting the usb startup code to the start of main solves the problem - I would like to know why it solves the problem though.
So instead of
int main(){
CyGlobalIntEnable;
#ifdef MPU
I2C_MPU6050_Start();
MPU6050_selectLowerArm();
MPU6050_initialize();
MPU6050_selectUpperArm();
MPU6050_initialize();
#endif
#ifdef USB
USBFS_Start(USBFS_DEVICE, USBFS_5V_OPERATION);
while (!USBFS_GetConfiguration());
USBFS_EnableOutEP(OUT_EP_NUM);
#endif
led_pin_Write(1);
....
I now have
int main(){
CyGlobalIntEnable;
#ifdef USB
USBFS_Start(USBFS_DEVICE, USBFS_5V_OPERATION);
while (!USBFS_GetConfiguration());
USBFS_EnableOutEP(OUT_EP_NUM);
#endif
led_pin_Write(1);
#ifdef MPU
I2C_MPU6050_Start();
MPU6050_selectLowerArm();
MPU6050_initialize();
MPU6050_selectUpperArm();
MPU6050_initialize();
#endif
There is no problem connecting to the I2C device so Im not sure why this hack solves the problem.