cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
goodlman
Visitor
Visitor
442 Views
Registered: ‎07-28-2019

ZCU102 USB working in SDK and host

Hi all,

 

I recently joined HW design filed and currently I am working on a project using ZCU102 board. 

I am trying to implement USB communication b/w host (windows) and FPGA board(SDK). 

And here are my questions. 

 

1. There are some usb drivers in SDK, such as usb_v5_2, usbps_v2_4, usbpsu_v1_3. What are difference b/w them?

2. I'd like to send data to FPGA from host and process (ex. multiply) then send back the result to host. 

So, I made a code to initialize usb in SDK, and it looks like communicate with the host. but, data is not transferring. 

XUsbPsu_Start(&UsbInstance);

while(1){}

during "while(1){}", FPGA is waitng for the host sending data to FPGA. Once data has arrived to FPGA, the FPGA is supposed to send back reply to the host.

And then they are talking each other. Below is a part of my code in SDK. and It's now working propoperly. 

Can anyone help me to debug it?

 

void XUsbPsu_BulkOutHandler(void *CallBackRef, u32 RequestedBytes,
u32 BytesTxed)
{
unsigned int rcv_addr = 0x50000000;
unsigned int tx_addr = 0x60000000;
unsigned int tx_addr1 = 0x102A3000;

struct XUsbPsu *InstancePtr = CallBackRef;


xil_printf("bulkout start\n");


if(number==3){
XUsbPsu_EpBufferRecv(InstancePtr, 1, (u8*)rcv_addr, 1);
xil_printf("number : %d\n", number);
number = number - 1;
}

else if(number==2){
xil_printf("number : %d\n", number);
XUsbPsu_EpBufferRecv(InstancePtr, 1, (u8*)rcv_addr, 4*4);
xil_printf("%x\n", ((u32*)rcv_addr)[0]);
number = number - 1;
}

else if(number==1){
xil_printf("ready to receive cmd \r\n");
XUsbPsu_EpBufferRecv(InstancePtr, 1, &cmd_rx, 1);
xil_printf("cmd_rx : %d \r\n", cmd_rx);
xil_printf("H_BOOT_START : %d \r\n", H_BOOT_START);
xil_printf("cmd received \r\n");
number = number - 1;
xil_printf("number : %d\n", number);

}
else{
// get coefficients from host
xil_printf("BOOT_START \r\n");
u32 ReceivedCount = 0;
xil_printf("Ready to Receive Coeff value \r\n");

XUsbPsu_EpBufferRecv(InstancePtr, 1, (u8*)((u32)RCV_ADDR + ReceivedCount), (4*T_COEF_SIZE - ReceivedCount));
xil_printf("Coff_received_0 \r\n");

}
xil_printf("Coff_received_1 \r\n");
}

}

0 Kudos
0 Replies