Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

Simplest method to transmit a file to FPGA

Provided that one has a file that is to be transmitted down to the FPGA and it will store every byte into internal or external memory (maximum size is around 1MegaByte). What is the preferred way of doing this?

Should one create a custom solution in whic the user sends the file down serial port from PC, the FPGA recieves it into a FIFO and then it stores it in internal/external memory on a per-byte or per-byte-block basis.

Or is it possible to utilize the JTAG port for this purpose such that the file can be streamed down the JTAG port and the design inside the FPGA can process the bytes as stated above?

I expected this to be a simple problem since we already transmit configuration data to the FPGA and possibly a connected configuration memory device. However, it seems that it is not. :|

13 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can use system console for this with a JTAG to avalon master: https://www.altera.com/en_us/pdfs/literature/hb/qts/qts_qii53028.pdf

    There are APIs called "master_read_to_file" and "master_write_from_file" that you can use to push a file down to memory in the FPGA and vice versa for the opposite direction. I also used to use Nios II for this sort of thing with something called host FS where I could have Nios open a file up on the host for read/write purposes over the JTAG channel but I have no clue if that's still supported. I suspect system console can move the data faster than host FS since I seem to recall host FS was only around 4kB/s back with the first generation USB blaster.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    On a second thought, as far as I vaguely understand, there is also a method by which such extra data can be bundled together with the FPGA configuration data and together with this configuration data be burned onto a configuration memory. Perhaps this will be a faster way to get this data onto a flash so the design can read it out and send it to the data converters?

    --- Quote End ---

    Don't know if this is still an issue for you but to bundle the data with configuration image, use the convert programming files... utility and click add hex data; select relative addressing and check the set start address checkbox - enter the location in the configuration flash where you want the file (after the configuration image); click browse (...) in the hex file sub-window and browse for your Intel-hex formatted data file and click ok. Since you say the file is >1MB, use 32-bit addressing when you generate the data file.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    G'day dglazar,

    Thank you for this suggestion. That's a good idea! Bundling the image BMPe with the rest of the configuration data, and allow Quartus Programmer to install it for me, would be easier than manually transferring the file to SDRAM before each run. (I know it initializes on-chip memory, but does Quartus also pre-write SDRAM?)

    My first project is a baseline iPipe into which I will subsequently insert the Circuit Under Evaluation.

    Ultimately, we'll want to connect a camera to the front end.

    For starters, I need to be able to play with a variety of 1080p test images.

    So manually downloading is OK.

    Thank you again for taking the time to comment on this issue.

    Cheers --todd