08-22-2019 02:32 AM
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?
08-27-2019 12:35 AM
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?
08-27-2019 01:06 AM - edited 08-27-2019 01:07 AM
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.
08-27-2019 01:34 AM
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?
08-29-2019 06:49 AM
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?
08-29-2019 07:03 AM
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)
08-29-2019 08:32 AM
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 ?
08-30-2019 01:46 AM
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.
08-30-2019 02:52 AM
@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?
08-30-2019 02:56 AM
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...
08-30-2019 03:35 AM
@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.