- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I'm trying to change the Pclock frequency according to the USB connection speed, but it doesn't seem to be easy. Basically, I want to automatically set the division value at 4 for USB3 connections and 24 for USB2 connections. Is this possible?
Thanks!
Terry
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Terry,
The USB event CY_U3P_USB_EVENT_SETCONF will be received after a set configuration request is issued by the host to the device. At this point, we can understand if the connection is USB3 or USB2. So, when this request is received, call a function (appstart) which internally uses APIs for determining the speed of USB connection and then configures the PIB accordingly. If the GPIF II block is operating in slave mode, then the following steps can be used inside the function for meeting your requirements:
1. Use the API CyU3PUsbGetSpeed() to find the operating speed of USB connection.
2. Based on the speed, set the parameter clkDiv for the structure CyU3PPibClock_t.
3. Call the API CyU3PPibInit() for initializing the PIB. Please note that this should be the first P-port related function call and should be called before any GPIF related calls are made.
4. If the SET_CONF request is issued multiple times in your application, then the function appstop() should call the API CyU3PPibDeInit().
I have attached a modified version of SDK example project Gpiftousb which meets your requirements. Please use this as a reference for your custom project. If the GPIF II block needs to be operated in master mode, then the DLL parameters should also be configured in addition to those mentioned above. The following KBA can be used as a reference for configuring DLL :
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Terry,
The USB event CY_U3P_USB_EVENT_SETCONF will be received after a set configuration request is issued by the host to the device. At this point, we can understand if the connection is USB3 or USB2. So, when this request is received, call a function (appstart) which internally uses APIs for determining the speed of USB connection and then configures the PIB accordingly. If the GPIF II block is operating in slave mode, then the following steps can be used inside the function for meeting your requirements:
1. Use the API CyU3PUsbGetSpeed() to find the operating speed of USB connection.
2. Based on the speed, set the parameter clkDiv for the structure CyU3PPibClock_t.
3. Call the API CyU3PPibInit() for initializing the PIB. Please note that this should be the first P-port related function call and should be called before any GPIF related calls are made.
4. If the SET_CONF request is issued multiple times in your application, then the function appstop() should call the API CyU3PPibDeInit().
I have attached a modified version of SDK example project Gpiftousb which meets your requirements. Please use this as a reference for your custom project. If the GPIF II block needs to be operated in master mode, then the DLL parameters should also be configured in addition to those mentioned above. The following KBA can be used as a reference for configuring DLL :
Jayakrishna