UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
1,574 Views
Registered: ‎04-12-2016

Transfer very large file via UART

Hello,

 

I want to transfer a very large file (56 MB) to DRAM in FPGA Zynq UltraScale+. I will use UART for now with baud rate 115200.

 

I use TeraTerm but when I send the file I do not know when to start my application and start sending file from teraterm, so that will "catch" my file in serial port.

 

I have the following code to set the UART:

int initUart();
u8 ReadRawBytesFromImage();

u8 ReadRawBytesFromImage(){ u8 *image_buffer; int status=initUart(); if(status!=XST_SUCCESS){ xil_printf("Error initializing UART!\n"); } u32 bytes_received = XUartPs_Recv(&xuartps_0,image_buffer,XMAX*YMAX*SLICES); xil_printf("bytes received:%d\n",(int)bytes_received); return image_buffer; } int initUart(){ s32 status; /*xil_printf("Setting up UART!\n"); status = XUartPs_SetDataFormat(&xuartps_0, &xuarapsformat_0); if(status!=XST_SUCCESS){ xil_printf("Error setting up UART!\n"); return; }*/ xuartps_config_0 = XUartPs_LookupConfig(XPAR_XUARTPS_0_DEVICE_ID); if (NULL == xuartps_config_0) { return XST_FAILURE; } status = XUartPs_CfgInitialize(&xuartps_0,xuartps_config_0, xuartps_config_0->BaseAddress); if(status!=XST_SUCCESS){ return XST_FAILURE; } XUartPs_SetBaudRate(&xuartps_0, 115200); status = XUartPs_SelfTest(&xuartps_0); if (status != XST_SUCCESS) { return XST_FAILURE; } //int bytes_sent=send_finalbuffer(array); //printf("bytes sent=%d\n",bytes_sent); /*union {float C[XMAX*YMAX]; u8 C_micro[XMAX*YMAX];}sender; for(int i=0;i<XMAX*YMAX;i++) sender.C[i]=array[i]; u32 payload = XMAX*YMAX*8; status = XUartPs_Send(&xuartps_0,sender.C_micro, payload); if(status!=XST_SUCCESS){ xil_printf("\rError sending C in UART!\n\r"); return; }*/ return XST_SUCCESS; }

Do I have to use loop here? ---> u32 bytes_received =XUartPs_Recv(&xuartps_0,image_buffer,XMAX*YMAX*SLICES);

 

Is there any way to make the code blocking so that catch the file?

 

The baud rate is very low with UART, how can I set the ethernet to transfer the file?

 

Thank you in advance

0 Kudos
3 Replies
Scholar dpaul24
Scholar
1,562 Views
Registered: ‎08-07-2014

Re: Transfer very large file via UART

The baud rate is very low with UART, how can I set the ethernet to transfer the file?

 

You should use an Ethernet IP core at the data link layer.

Outside world --> Ethernet PHY --> Ethernet core --> FIFO --> DRAM Controller core --> DRAM.

--------------------------------------------------------------------------------------------------------
FPGA enthusiast!
All PMs will be ignored
--------------------------------------------------------------------------------------------------------
0 Kudos
Adventurer
Adventurer
1,535 Views
Registered: ‎04-12-2016

Re: Transfer very large file via UART

But how will I transfer the file via UART?

0 Kudos
Scholar ericv
Scholar
1,518 Views
Registered: ‎04-13-2015

Re: Transfer very large file via UART

@kostas23

 

Even with your app synchronized with Tera Term, you'll likely encounter some bits in error transferring that amount of data over an UART.

You should consider using (implying adding it in your app) XMODEM, YMODEM or a likewise transfer protocol.

Tera Term supports XMODEM & YMODEM and the start-up synchronization is dealt with by the protocol.

XMODEM and YMODEM are fairly simple, small code (about 100-200 lines of "C"), and openly available.

 

 

 

0 Kudos