USBD_STATUS_CANCELED in USB bulk transfer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USBD_STATUS_CANCELED in USB bulk transfer

1,355 次查看
ingdb
Contributor III

Dear all,

we're working on a RT1176 and we're testing USB communication

the firmware code is quite simple, we're using bulk transfer

 

 

 

uint8_t WriteUsb(const uint8_t *data, uint32_t size) {
	usb_status_t error = kStatus_USB_Error;
	error = USB_DeviceCdcAcmSend(s_UsbInterface0CicVcom.cdcAcmHandle,
	USB_DIC_VCOM_IN_ENDPOINT, data, size);

	if (error != kStatus_USB_Success) {
		if (error != kStatus_USB_Busy)
			PRINTF("kStatus :%d \n", error);
		return false;
	}
	return true;

}

#define bufSize  126
void DirectStream() {
	uint16_t val = 0;
	while (1) {

		static uint8_t buf[bufSize];
		for (int i = 0; i < 7500; i++) {
			for (int j = 0; j < bufSize; j += 2) {
				memcpy(buf + j, &val, 2);
				val++;
			}
			while (WriteUsb(buf, bufSize) == 0);
		}
	}
}

 

 

 

 

 

 

We're receiving and verifying the data on a Windows and Linux PC, but for both systems, we have after some seconds a USBD_STATUS_CANCELLED error.

ingdb_0-1675098181379.png

I am trying to understand this behavior, I found indications that this could be caused by the host PC but I am not sure if it's firmware related. The USB_DeviceCdcAcmSend function never returns an error (except kStatus_USB_Busy).

Can anyone shed some light on this?

best regards

Matthias

标记 (1)
0 项奖励
回复
2 回复数

1,326 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello
Hope you are well.

To check if this issue is caused by the firmware or the host I suggest you test it with one of our SDK examples.
USB_DeviceCdcAcmSend checks whether the endpoint is sending a packet if the pipe is busy, it ignores this transfer by returning an error code.

Best regards,
Omar

0 项奖励
回复

1,319 次查看
ingdb
Contributor III

Hello Omar,

thanks for your help.

I am using an SDK example as the base but as NXP doesn't have a streaming example I modified it a little bit. The normal non streaming SDK examples are running but that's an entire different use case, I can't draw conclusions from that.

Yes,  USB_DeviceCdcAcmSend  returns error codes, I am receiving ONLY  kStatus_USB_Busy  (that's making sense) but no other error code.

best regards

Matthias

 

 

 

0 项奖励
回复