DEV_FRAMECNT always zero.

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

cross mob
cnlohr
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

I am trying to capture SOF events but need to know the ID of the SOF event.  I am able to successfully execute code in theCY_U3P_USB_EVENT_SOF_ITP callback. 

After CyU3PConnectState, I call

 

	/* Enable SOF events */
	CyU3PUsbEnableITPEvent( CyTrue );

 

I get my events in the callback,

 

	case CY_U3P_USB_EVENT_SOF_ITP:
	{
	//      Always zero.
	//	uint32_t DEV_FRAMECNT = *((volatile uint32_t*) 0xE0031404 );
		uint32_t DEV_FRAMECNT;
		CyU3PUsbGetDevProperty ( CY_U3P_USB_PROP_FRAMECNT, &DEV_FRAMECNT );  //also always zero.
		if( DEV_FRAMECNT == 0 )
		{
			gbSOFToggle = !gbSOFToggle;
			CyU3PGpioSimpleSetValue( GPIO_SOF_NR, gbSOFToggle );
		}
		break;
	}

 

According to the datasheet, the register DEV_FRAMECNT should contain the SOF id of the last SOF, but whether I use CyU3PUsbGetDevProperty  or read directly from the register, it's always zero.

Do I have to do something to enable the framecnt register?

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please confirm if the device enumerates as USB 2.0 device as CY_U3P_USB_PROP_FRAMECNT is only used for USB 2.0 frame count value. It will return a 32 bit unsigned integer value. Please check the return value of the CyU3PUsbGetDevProperty API. It would return CY_U3P_ERROR_BAD_ARGUMENT if the device is USB 3.0 and CY_U3P_USB_PROP_FRAMECNT is queried.

You can also check the USB speed by calling CyU3PUsbGetSpeed before calling the CyU3PUsbGetDevProperty function.

Regards,
Rashi

View solution in original post

1 Reply
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please confirm if the device enumerates as USB 2.0 device as CY_U3P_USB_PROP_FRAMECNT is only used for USB 2.0 frame count value. It will return a 32 bit unsigned integer value. Please check the return value of the CyU3PUsbGetDevProperty API. It would return CY_U3P_ERROR_BAD_ARGUMENT if the device is USB 3.0 and CY_U3P_USB_PROP_FRAMECNT is queried.

You can also check the USB speed by calling CyU3PUsbGetSpeed before calling the CyU3PUsbGetDevProperty function.

Regards,
Rashi