0

I have a fpga board and I write a VHDL code that can get Images (in binary) from serial port and save them in a SDRAM on my board. then FPGA display images on a monitor via a VGA cable. my problem is filling the SDRAM take to long(about 10 minutes with 115200 baud rate). on my computer I wrote a python code to send image(in binary) to FPGA via serial port. my code read binary file that saved in my hard disk and send them to FPGA. my question is if I use buffer to save my images insted of binary file, do I get a better result? if so, can you help me how to do that, please? if not, can you suggest me a solution, please? thanks in advans,

user3397145
  • 787
  • 1
  • 5
  • 16
  • Your question doesnt make any sense. No matter where you save the image, it will still be a binary file. You issue is probably on the FPGA side with caching the data properly. – DrBwts Aug 19 '15 at 17:23
  • I mean if I load the binary file in a buffer and then send it, does it make any progress? – user3397145 Aug 19 '15 at 18:12
  • Ahh OK, usually buffering is done on both sides. If you are wanting to move the data to SDRAM then I would have thought a buffer on the FPGA side would be essential. As for the PC side, I think buffering is handled for you. Have a look at [this post for implementing serial communications with Python & Pyserial](http://stackoverflow.com/questions/676172/full-examples-of-using-pyserial-package) – DrBwts Aug 19 '15 at 18:36
  • actually I know how to write python code for serial. I just need to speed up the process of the writing to SDRAM. according you, I dont need to use buffer in Python,am i? – user3397145 Aug 19 '15 at 20:01
  • Its my understanding that the serial buffering on the PC side is done for you so you can obtain the correct baud rate. That's assuming the PC is doing the sending. Your issue will more than likely be the buffering on the FPGA side. – DrBwts Aug 19 '15 at 20:35

1 Answers1

0

Unless you are significantly compressing before download, and decompressing the image after download, the problem is your 115,200 baud transfer rate, not the speed of reading from a file.

At the standard N/8/1 line encoding, each byte requires 10 bits to transfer, so you will be transferring 1150 bytes per second.

In 10 minutes, you will transfer 1150 * 60 * 10 = 6,912,000 bytes. At 3 bytes per pixel (for R, G, and B), this is 2,304,600 pixels, which happens to be the number of pixels in a 1920 by 1200 image.

The answer is to (a) increase the baud rate; and/or (b) compress your image (using something simple to decompress on the FPGA like RLE, if it is amenable to that sort of compression).

Patrick Maupin
  • 8,024
  • 2
  • 23
  • 42
  • thanks, my pixels are 8 bits. does make any difference to make a buffer in python and move the file into buffer and then read from buffer and send them? – user3397145 Aug 20 '15 at 06:32
  • I should have asked for an MCVE. Now you're making me drag it out of you. Yes, character at a time processing is slow, but OK -- what's the image size? If it's around 2M pixels, then it seems like you must be waiting on the echo from the FPGA to be that slow. – Patrick Maupin Aug 21 '15 at 02:09