zhemao / zhemao.github.com

Github pages page
http://zhemao.github.com
Other
4 stars 1 forks source link

Programming the FPGA from HPS #3

Closed acourt closed 10 years ago

acourt commented 10 years ago

Hello!

I have been following this great tutorial but I am running into an issue when trying to program the FPGA from the HPS (Part III). I have followed exactly what has been described so far, in terms of flashing the FPGA from the USB blaster and the blinker program works perfectly.

The problem I am encountering is that when I am programming the FPGA directly from the USB blaster with the .sof file, the blinker program functions perfectly. However, when programming it from the HPS with the steps you described using the same .sof file that has been converted to raw binary, the lights do not light up at all.

I am a bit lost at the moment as to what I should try to debug this thing... Should I try to perform memory accesses and see what happens anyway? Although this might be dangerous... I have a feeling there is a step that has been ommitted in the "Programming the FPGA from HPS" section of Part 3 of the tutorial.

I also want to point out a typo in that particular section. It says to perform this command:

quartus_cpf -c output_files/sockit_test.sof output_files/sockit_test.rbf

and then copy this into /dev/fpga0:

dd if=sockit_test.rpf of=/dev/fpga0

However, the input file extension is not the same as the generated binary file by quartus_cpf. sockit_test.rbf vs sockit_test.rpf

Cheers!

Alex

acourt commented 10 years ago

Ok, so it seems that when I perform the dd if=sockit_test.rpf of=/dev/fpga0 command and I query the status of the FPGA using cat /sys/class/fpga/fpga0/status/

It tells me that the program is still in "configuration phase". Something is making it get stuck in the configuration phase for some reason. I will continue my investigation.

zhemao commented 10 years ago

Hey, thanks for telling me about these issues. I've fixed the "rpf" typo. I'm not sure what's causing the programming issue. It might be because your bridges are enabled when you try to program. Could you try programming using the program_fpga.sh script that I wrote and see if you get the same problem? The usage is

./program_fpga.sh binary_file.rbf
acourt commented 10 years ago

I get the same issue even when using the given script. I have checked out and compiled your github quartus project and generated an .rbf file with this and I get the same issue. I think the problem might have something to do with the configuration on my end. When configuring the FPGA from the HPS, do you have to have the jumpers in a particular configuration? Is there anything else I have to do on the end of my HPS?

The only difference between my procedure and the one you described is that I use scp over an ethernet link to transfer my binary files. I doubt this would actually create a problem though.

acourt commented 10 years ago

I am also using Quartus 13.1. I don't know if you are using the same tool. If you but the rbf file on the repo I can try it with that and make sure it's not a problem with the conversion process.

zhemao commented 10 years ago

Oh, actually I think it is the jumper settings. I remember I did change one of the settings. I'm traveling today and will be away from the board, but when I get back I'll take a look at how I have the jumpers and switches set and how they differ from the settings on RocketBoards.

zhemao commented 10 years ago

Actually, I remember now. I think I changed the MSEL switch settings (switch box on bottom of board). I used the settings listed on the following page.

http://rocketboards.org/foswiki/Documentation/GSRDProgrammingFPGA

You basically just have to flip switch 5 and 6 back to '0'. Could you try that and see if it works? If so, I will add it to the tutorial.

acourt commented 10 years ago

Yes, that was exactly the issue! Now I can program the FPGA from the HPS.

It would be a good idea to add a line in the tutorial: "Don't forget to set the MSEL settings to 00000!"

Thanks!

Alex

zhemao commented 10 years ago

Great! I'm glad that worked out. Sorry I forgot about that. I'll add it to the tutorial right away.