Forum Discussion
Altera_Forum
Honored Contributor
9 years agoCheck FPGA / bridges before accessing them
I want to access the switches on the tersIC DE0-Naoo-SoC board from Linux. I load the appropriate FPGA and access the LW bridge (with a c program). Everything works fine.
But if, due to eg. misconfiguration, the FPGA is not loaded with the appropriate file the Linux programm will hang forever when accesing the bridge. Thus stopping the complete system! Is there a way to check from Linux if the address I want to access will work? Joachim6 Replies
- Altera_Forum
Honored Contributor
If I am not mistaken, you can check the status of the bridge via:
cat /sys/class/fpga-bridge/fpga2hps/enable cat /sys/class/fpga-bridge/hps2fpga/enable cat /sys/class/fpga-bridge/lwhps2fpga/enable https://rocketboards.org/foswiki/view/documentation/gsrd131programmingfpga - Altera_Forum
Honored Contributor
Hi sunshine,
the bridges are enabled: root@jwde0soc:~# cat /sys/class/fpga-bridge/lwhps2fpga/enable 1 root@jwde0soc:~# cat /sys/class/fpga-bridge/hps2fpga/enable 1 root@jwde0soc:~# cat /sys/class/fpga-bridge/fpga2hps/enable 1 Still the program hangs when reading from an lwhps2fpga-Address (mapped with /dev/mem). Joachim - Altera_Forum
Honored Contributor
--- Quote Start --- Hi sunshine, the bridges are enabled: root@jwde0soc:~# cat /sys/class/fpga-bridge/lwhps2fpga/enable 1 root@jwde0soc:~# cat /sys/class/fpga-bridge/hps2fpga/enable 1 root@jwde0soc:~# cat /sys/class/fpga-bridge/fpga2hps/enable 1 Still the program hangs when reading from an lwhps2fpga-Address (mapped with /dev/mem). Joachim --- Quote End --- Looks like checking the bridge status may not be a viable option... since the hang happen if the FPGA is misconfigured, perhaps another way is to use the HPS FPGA manager to ensure that the configuration is executed successfully? - Altera_Forum
Honored Contributor
You can check the state of the FPGA configuration with:
A well configured FPGA should return: "user mode".cat /sys/class/fpga/fpga0/status - Altera_Forum
Honored Contributor
Nope. The FPGA is configured sucessfully. But with the wrong rbf.
The main problem is if some setup is wrong the FPGA does not have a register at the address I access. I could figure out from my software if I get a valid result. But the whole systems hangs after an access. So I am looking for a way to check prior to accessing the address. My customers want to build a drives control system with this and they don't like that some Linux process can hang up the whole system by just accessing a wrong address. - Altera_Forum
Honored Contributor
This sounds like a design bug. Do you have any idea, why the the system hangs up? The only reasons i had so far are:
- unconfigured FPGA
- missing bridge in design
- FPGA Design in reset, or missing clock
- wrong handled waitrequest in design
- timing issue