CyU3PConnectState prerequisites?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ThAl_4704151
Level 4
Level 4
25 sign-ins 25 replies posted 10 replies posted

Hello All,

I'm supposed to be writing firmware for the FX3, but I'm having a hard time getting started. I've tried to pick out the parts of the example code that I need to get a minimal example that I can then build on, but whenever I call CyU3PConnectState(true, false), I get CY_U3P_ERROR_NOT_CONFIGURED.

Now, maybe I've missed a manual, but I have not found a list of things that have to be configured before I can call this function. From the example code, I've gathered that I have to do the following things in the application thread:

  • Call CyU3PUsbStart()
  • Register a setup callback with CyU3PUsbRegisterSetupCallback()
    • For now, mine is called with fast enum, and just returns false
  • Register an event callback with CyU3PUsbRegisterEventCallback()
    • For now, mine does nothing
  • Register an LPM callback with CyU3PUsbRegisterLPMRequestCallback()
    • For now, mine denies all requests
    • I'm not sure if this one's mandatory
  • Set up an event log with CyU3PUsbInitEventLog()
  • Set up descriptors with CyU3PUsbSetDesc()
    • So far I've set up
      • CY_U3P_USB_SET_HS_DEVICE_DESCR
      • CY_U3P_USB_SET_DEVQUAL_DESCR
      • CY_U3P_USB_SET_HS_CONFIG_DESCR
      • CY_U3P_USB_SET_FS_CONFIG_DESCR
      • Several CY_U3P_USB_SET_STRING_DESCR
    • I'm not trying to run it in superspeed yet, so it should be fine that I don't have descriptors for CY_U3P_USB_SET_SS_DEVICE_DESCR, CY_U3P_USB_SET_SS_CONFIG_DESCR, CY_U3P_USB_SET_SS_BOS_DESCR, or CY_U3P_USB_SET_OTG_DESCR yet, right?

That's in addition to regular startup things like configuring the clock, setting up IO, and starting threads that happen before the threads are running.

I assume I've missed something because I'm getting CY_U3P_ERROR_NOT_CONFIGURED. Does anyone have an idea what that might be?

0 Likes
1 Solution

Hello,

I could successfully reproduce the issue at my end. I saw that in the defaultDescriptor.c file, the FS descriptors are commented out. Please uncomment the FS descriptors in defaultDescriptor.c file in your project. If FS or HS descriptors are NULL, then the CyU3PConnectState(CyTrue, CyFalse); can return CY_U3P_ERROR_NOT_CONFIGURED. Also, for the switch case DSCR_CONFIG, please change the parameter segmentLength as follows:

segmentLength = pos[2];

By making these changes, I could see that the API CyU3PConnectState(CyTrue, CyFalse); passed without any error code.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
4 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Everything looks fine from the description that you have shared for using CyU3PConnectState() API. Please share the complete project so that we can try reproducing the issue at our end. Also, please confirm that you are using FX3 SDK 1.3.4 which is the latest version of FX3 SDK.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

The version is 1.3.4, so that should be good.

Here's a temporary link to the project, but it's only good for 24 hours.

https://file.re/2020/08/18/fx3sx2substitute/

Thanks for your help!

0 Likes

Hello,

I could successfully reproduce the issue at my end. I saw that in the defaultDescriptor.c file, the FS descriptors are commented out. Please uncomment the FS descriptors in defaultDescriptor.c file in your project. If FS or HS descriptors are NULL, then the CyU3PConnectState(CyTrue, CyFalse); can return CY_U3P_ERROR_NOT_CONFIGURED. Also, for the switch case DSCR_CONFIG, please change the parameter segmentLength as follows:

segmentLength = pos[2];

By making these changes, I could see that the API CyU3PConnectState(CyTrue, CyFalse); passed without any error code.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

Ah, well now I feel dumb. Thanks a ton though. You're a lifesaver!

0 Likes