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: 
Observer tish
Observer
588 Views
Registered: ‎08-20-2019

File transfer using UART

Hi! I am working with Zedboard. I was wondering how to perform file transfer using UART. I dont understand why the scanf function does not work in the sdk?  

0 Kudos
12 Replies
Xilinx Employee
Xilinx Employee
540 Views
Registered: ‎06-21-2018

Re: File transfer using UART

Hi tish,

Which OS are you running?

Have you seen this?:
http://zedboard.org/content/uart-application

Thanks,
Andres

 

0 Kudos
Observer tish
Observer
522 Views
Registered: ‎08-20-2019

Re: File transfer using UART

Thanx for replying. Though the post you shared doesnt solve my problem. I am actually willing to transfer a file from my computer to another computer using the Zedboard. I have included the UartLite IP in the block design. I have successfully printed a couple of letters in the same process. My intention is to program my zynq in such a way that I am able to send some files using a teminal application from my pc to another pc. Could you advice me regarding this?

0 Kudos
Scholar dpaul24
Scholar
516 Views
Registered: ‎08-07-2014

Re: File transfer using UART

@tish,

Could you advice me regarding this?

PC1 (TeraTerm/Putty) <---> Zynq PL section(UART IP1 -- FIFO1 -- glue-logic -- FIFO2 -- UART IP2) <--> PC2 (TeraTerm/Putty)

 I have successfully printed a couple of letters in the same process.

You build independent modules first and then merg them. 1st build a system that communicates b/w PC1 and UART IP1 of Zynq, then a similar system with another UART IP2 and PC2. Next design the FIFO1 -- glue-logic -- FIFO2 subsystem.                                  

          

--------------------------------------------------------------------------------------------------------
FPGA enthusiast!
All PMs will be ignored
--------------------------------------------------------------------------------------------------------
Scholar vanmierlo
Scholar
508 Views
Registered: ‎06-10-2008

Re: File transfer using UART

The scanf function is not intended for transferring files. It is for interpreting its contents.

What are the contents of the file that you intend to transfer? Is it pure ASCII or is it binary data? Have you considered using a transfer protocol like XMODEM? Or how will the receiving end know the file is done?

Observer tish
Observer
485 Views
Registered: ‎08-20-2019

Re: File transfer using UART

Hi @vanmierlo yes I understand that scanf is not a function intended to transfer files. I asked about it for another context. 

Actually, I am sending a text file from my PC to zedboard via UART1 using teraterm->send file option. The LD10 is illuminated accordingly which infers that the device is receiving the file but I cannot understand where the file gets stored in the board. How can I access it?

0 Kudos
479 Views
Registered: ‎07-23-2019

Re: File transfer using UART

scanf... I think it's meant for grabbing what slow, fleshy humans type at about 1 byte/sec and hit ENTER twice as much hard as needed. I'm also human, I just observe...

So, I mean, scanf might be slow at grabbing KB/s. Also, I think it waits for CR/LF and takes complete lines. If you are sending binary data, you may have just random CR/LF byte pairs.

I've actually sent large files (MB) using UART (an FPGA configuration) but didn't use those C functions, don't remember now what I used, maybe getc... the sw was inherited, but what I'm sure of is I was receiving one byte at a time (with some buffer)

0 Kudos
Scholar vanmierlo
Scholar
466 Views
Registered: ‎06-10-2008

Re: File transfer using UART

Data sent to the UART isn't stored anywhere. You have to listen for it when it comes or otherwise it's most probably dropped.

Have you tried to run microcom or minicom on /dev/ttyPS1 ?

0 Kudos
Observer tish
Observer
428 Views
Registered: ‎08-20-2019

Re: File transfer using UART

Well how do I listen to it? I am confused. :( 

0 Kudos
Scholar vanmierlo
Scholar
419 Views
Registered: ‎06-10-2008

Re: File transfer using UART

My apologies, I was thinking of using linux on the zedboard, but you're not doing that, I suppose.

I have little to no experience using the SDK to build bare metal applications. You'll have to look in the Xilinx library to find uart related functions. I'm sure there will be functions to read from a uart.

0 Kudos
Observer tish
Observer
414 Views
Registered: ‎08-20-2019

Re: File transfer using UART

@vanmierlo no problem. I know the functions related to uart provided in sdk. 

@archangel-lightworks how did you accomplish the file transfer? Normally when we perform file transfer we include functions like fopen, fclose, gets, puts etc. But Xilinx SDK doesnt directly support such functions I guess. I have checked out the stdio.h file. There, these functions are defined in a different way. Should I use them in that way?

0 Kudos
Scholar u4223374
Scholar
408 Views
Registered: ‎04-26-2015

Re: File transfer using UART

For transferring a file between two PCs, the "glue logic" is just "connect TX1 to RX2 and RX1 to TX2". You don't need an FPGA for this, you can do it with wires. If each PC is running a terminal program (eg. Tera Term), you can start a ZMODEM (or protocol of your choice) transmit on one PC and an equivalent receive on the other, and it'll happily (and very slowly) copy a file across. Keep in mind that the fastest standard baud rate gets you just about 10KB/s...

0 Kudos
Observer tish
Observer
395 Views
Registered: ‎08-20-2019

Re: File transfer using UART

@u4223374  hey I know that already. Why I am introducing the Zedboard in between is because my channel in between will be wireless free space optical channel and not wired connection. So before I place my system in the wireless channel I want to check whether the file is being sent correctly. And either way I need to send some files across to establish the communication. Any kind of help will be appreciated. 

0 Kudos