Passing a signal from FPGA to microprocessor

Applications, development tools, FPGA, C, WEB
Post Reply
tom.zhang
Posts: 10
Joined: Sat Aug 01, 2015 1:09 pm

Passing a signal from FPGA to microprocessor

Post by tom.zhang » Sun Jan 24, 2016 6:46 am

Hi,

I'm developing an application that monitors the analog input and if the input is higher than a certain threshold, activates the PID application.

So far I've managed to monitor the input and check if it is higher than a certain threshold (done in FPGA). Now I'm stuck on how to pass a signal from the FPGA to the microprocessor to activate the PID controller (I believe the microprocessor is the place that controls whether an application is enabled or not), namely change the value of pid_11_enable from 0 to 1 in main.c.

I can see how a value is pass from the microprocessor to the FPGA in the PID application, but I don't know how the reverse can be accomplished. Any help appreciated.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: Passing a signal from FPGA to microprocessor

Post by Nils Roos » Mon Jan 25, 2016 9:39 pm

Hi,
I can see how a value is pass from the microprocessor to the FPGA in the PID application, but I don't know how the reverse can be accomplished. Any help appreciated.
One way to achieve this is to define a new register in the address space of one of the modules and wire your "threshold crossed" signal to this register. You would then have to poll the register and take actions when its value changes. This is relatively easy to implement but requires to do "busy-waiting" on the CPU side.
That's not neccessarily a bad thing, you could start a timerthread that queries the register periodically without being too much of a burden on system resources.

The only way to really "pass a signal" to the CPU is by using one of the PL-to-PS interrupt lines. This is far more complicated on the software side, because only kernel modules can accept these interrupts. If you've never written kernel code for linux, you'll have a steep learning curve ahead of you. I have a working example in this development branch.

tom.zhang
Posts: 10
Joined: Sat Aug 01, 2015 1:09 pm

Re: Passing a signal from FPGA to microprocessor

Post by tom.zhang » Thu Feb 04, 2016 3:35 pm

Hi Nils,

The first method you said sounds good to me. However, I'm not sure how to write to an register inside the Verilog code, and how to access that same address in the C code.

Could you please give me an example code of how these can be done?

Thank you.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: Passing a signal from FPGA to microprocessor

Post by Nils Roos » Sat Feb 06, 2016 1:08 pm

Hi Tom,

Here is an example where I added a configuration register (trig_evt) to the DAC module. The first six diffs are the librp changes and the remainder is the neccessary verilog modifications. On the logic side, all you have to do is to define storage (reg ...), connect the storage to your new signal, and create address mappings for reading and writing the register with the sys_* bus.

Greetings
Nils

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 111 guests