USB_DeviceSetSpeed() fix for usb_device_descriptor.c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB_DeviceSetSpeed() fix for usb_device_descriptor.c

1,036 Views
Don_Adams_HPE
Contributor I

We found a problem in the usb_device_descriptor.c file of the frdmmcxn947_dev_phdc_weighscale_freertos_cm33_core0 sample project for the FRDM-MCXN947 development board.  We used this project as the basis for a new project.  After an upgrade to MacOS version Tahoe 26.4 our USB communication stopped working.  The symptom of the problem was that communication from the Mac to the FRDM-MCXN947 development board worked, but communication from the development board back to the Mac stopped working.  The fix to the problem was the following code changes to the USB_DeviceSetSpeed() function in usb_device_descriptor.c:


-                if (((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==
+                if (((pDescStart->endpoint.bmAttributes & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK) ==
+                     USB_ENDPOINT_INTERRUPT) &&
+                    ((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==


-                else if (((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==
+                else if (((pDescStart->endpoint.bmAttributes & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK) ==
+                          USB_ENDPOINT_BULK) &&
+                         ((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==


-                else if (((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==
+                else if (((pDescStart->endpoint.bmAttributes & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK) ==
+                          USB_ENDPOINT_BULK) &&
+                         ((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==


-                if (((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==
+                if (((pDescStart->endpoint.bmAttributes & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK) ==
+                     USB_ENDPOINT_INTERRUPT) &&
+                    ((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==


-                else if (((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==
+                else if (((pDescStart->endpoint.bmAttributes & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK) ==
+                          USB_ENDPOINT_BULK) &&
+                         ((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==


-                else if (((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==
+                else if (((pDescStart->endpoint.bmAttributes & USB_DESCRIPTOR_ENDPOINT_ATTRIBUTE_TYPE_MASK) ==
+                          USB_ENDPOINT_BULK) &&
+                         ((pDescStart->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) ==


We no longer have problems with USB communication. I am posting this information in case it solves USB communication problems for others as well.

0 Kudos
Reply
1 Reply

974 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi @Don_Adams_HPE 

Thank you for your kind sharing.
I will report this to the internal SDK team for further review.
Thank you.
 

BR

Alice

0 Kudos
Reply