i.MX RT 105x/106x: Changing NXP example to boost USB video bandwidth fails - why?

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

i.MX RT 105x/106x: Changing NXP example to boost USB video bandwidth fails - why?

309 Views
tamir_michael
Contributor IV

Dear all (NXP personnel too...),

I have adjusted the function "USB_DeviceSetSpeed()" in the NXP example "evkbimxrt1050_dev_video_virtual_camera_bm" as follows, to enable 2 additional transfers per microframe (

HS_STREAM_IN_PACKET_ADDITIONAL_TRANSACTION = 2

).
However, I am afraid that despite the device enumerating properly, there is no more video played after this change.
Can you please tell me what is missing in the NXP USB firmware to get this done? I have been searching for a solution for a while now and reviewed the code again and again to no avail.
Thanks in advance.

 

usb_status_t USB_DeviceSetSpeed(usb_device_handle handle, uint8_t speed)
{
	usb_descriptor_union_t *descriptorHead;
	usb_descriptor_union_t *descriptorTail;

	descriptorHead = (usb_descriptor_union_t *)&g_UsbDeviceConfigurationDescriptor[0];
	descriptorTail =
		(usb_descriptor_union_t *)(&g_UsbDeviceConfigurationDescriptor[USB_DESCRIPTOR_LENGTH_CONFIGURATION_ALL - 1U]);

	while (descriptorHead < descriptorTail)
	{
		if (descriptorHead->common.bDescriptorType == USB_DESCRIPTOR_TYPE_ENDPOINT)
		{
			if (USB_SPEED_HIGH == speed)
			{
				if (USB_VIDEO_VIRTUAL_CAMERA_STREAM_ENDPOINT_IN ==
					(descriptorHead->endpoint.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK))
				{
					descriptorHead->endpoint.bInterval = HS_STREAM_IN_INTERVAL;
					USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS((HS_STREAM_IN_PACKET_SIZE | (HS_STREAM_IN_PACKET_ADDITIONAL_TRANSACTION << USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_SHFIT)),
													   descriptorHead->endpoint.wMaxPacketSize);
				}
				else
				{
					descriptorHead->endpoint.bInterval = HS_INTERRUPT_IN_INTERVAL;
					USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(HS_INTERRUPT_IN_PACKET_SIZE,
													   descriptorHead->endpoint.wMaxPacketSize);
				}
			}
			else
			{
				if (USB_VIDEO_VIRTUAL_CAMERA_STREAM_ENDPOINT_IN ==
					(descriptorHead->endpoint.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK))
				{
					descriptorHead->endpoint.bInterval = FS_STREAM_IN_INTERVAL;
					USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(FS_STREAM_IN_PACKET_SIZE,
													   descriptorHead->endpoint.wMaxPacketSize);
				}
				else
				{
					descriptorHead->endpoint.bInterval = FS_INTERRUPT_IN_INTERVAL;
					USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(FS_INTERRUPT_IN_PACKET_SIZE,
													   descriptorHead->endpoint.wMaxPacketSize);
				}
			}
		}
		descriptorHead = (usb_descriptor_union_t *)((uint8_t *)descriptorHead + descriptorHead->common.bLength);
	}

	if (USB_SPEED_HIGH == speed)
	{
		g_UsbDeviceVideoControlEndpoints[0].maxPacketSize = HS_INTERRUPT_IN_PACKET_SIZE;
		g_UsbDeviceVideoStreamEndpoints[0].maxPacketSize = HS_STREAM_IN_PACKET_SIZE | (HS_STREAM_IN_PACKET_ADDITIONAL_TRANSACTION << USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_SHFIT);
	}
	else
	{
		g_UsbDeviceVideoControlEndpoints[0].maxPacketSize = FS_INTERRUPT_IN_PACKET_SIZE;
		g_UsbDeviceVideoStreamEndpoints[0].maxPacketSize = FS_STREAM_IN_PACKET_SIZE;
	}

	return kStatus_USB_Success;
}

 

 

 

0 Kudos
0 Replies