Intel® SoC FPGA Embedded Development Suite
Support for SoC FPGA Software Development, SoC FPGA HPS Architecture, HPS SoC Boot and Configuration, Operating Systems

DE10 STANDARD Linux issue

CAlex
New Contributor II
1,007 Views

Hi,

 

I wrote a code to test the latency of the SOC communication,

the result are as followed:

CAlex_0-1679482696726.jpeg

The blue line is the clock flag I made, it sends the 50us toggle flag to the pio of fpga,

The yellow line is a HPS code that detected edge change of the blue one and did something and show that it is done.

 

I seldom catch the above result and wonder how to fix that.

I suspect that it may duel to the Linux system interrupt.(but have no evidence)

The following is the interrupt list of my device

CAlex_1-1679483003481.png

Could you guys figure out why and how?

 

reguards.

 

 

0 Kudos
13 Replies
aikeu
Employee
964 Views

Hi CAlex,


From your picture, I see is a there is a 100us ++ in ur code detection in Linux application.

May I know it happens sometimes? Is your linux application solely running on a single task just to capture the toggling?


Thanks.

Regards,

Aik Eu


0 Kudos
CAlex
New Contributor II
958 Views

Hi,

This issue happens several seconds, I can't tell you the precise time but it seems will happen in a fixed time period.

 

And yes, my usersapce code only do the detect signal, count a number to 1000 and send the job done signal.

 

reguards.

0 Kudos
aikeu
Employee
950 Views

Hi CAlex,


Can share with me your project design?

Btw, I cant be sure this is related to the linuxsocfpga real time limitation or not, probably you can increase the time where your code detect an interrrupt triggerd to perform signal toggling. This will help to troubleshoot the running code because looks like for every 25us when an interrupt occured due to clock edge change and the linux application code must perform a signal toggling.

Another method is use a baremetal application to test your test code as a comparison.

I saw this document which talks about the latency issue:

https://www.rocketboards.org/foswiki/pub/Documentation/AlteraSoCLTSIRTKernel/ELC-Linux-RT.pdf


Thanks.

Regards,

Aik Eu



0 Kudos
CAlex
New Contributor II
937 Views

Hi,

The design is attached.

And I didn't do the interrupt this time.

I'll read through the resource you gave me.

Thank you for help.

 

Reguards.

0 Kudos
aikeu
Employee
895 Views

Hi CAlex,


I think I misunderstood that you are using interrupt previuosly from another case.

You are using HPS polling method to detected the changes in the PIO IP?

If you are using polling method, how fast that it tries to read the changes?

And you are not running baremetal application right?


Thanks.

Regards,

Aik Eu


0 Kudos
CAlex
New Contributor II
887 Views

Hi,

Yes you are right, there is no delay between polling,

and yes it is run on the linux.

0 Kudos
aikeu
Employee
876 Views

Hi CAlex,


Do you mean currently the issue is not occuring anymore if uses polling method?

May I know where is the application code in the project folder which you sent me?


Thanks.

Regards,

Aik Eu


0 Kudos
CAlex
New Contributor II
874 Views

Hi,

 

I mean the polling method causes the issue.

I attach the C project to you now.

The two FPGA PIO I use is GPIO 1 and GPIO 36 I suppose(the right top one and the right bottom one).

 

Reguards.

0 Kudos
aikeu
Employee
853 Views

Hi CAlex,


I see you have disabled the timer interrupt call in your code.

Do you mean if you use interrupt to call a function to set the changes of the output signal as indicator(observe on the oscilloscope) then there is no issue? But if you use while loop then there will be issue?


If I am correct for the below:

  1. Your polling method is using a while(1) loop.
  2. Everytime the clock signal edge(low->high) happened, there will be changes on the timer register which you will check within the while loop. Your output signal indicatoer will go high when it happened.
  3. Everytime you call the myfunction(), it is going into a for loop to perform counting. which creates a short delay that meant for the output signal indicator to go low again.
  4. your output indicator signal is taking longer time than usual to change from high to low.
  5. It looks like sometimes it is taking a longer time when running the while loop.


Thanks.

Regards,

Aik Eu


0 Kudos
CAlex
New Contributor II
848 Views

Hi,

 

you are basically right, what my code do is to:

1.check the edge change(high -> low or low->high) of the timer flag.

2.put start signal to 1 and jump to myfunction(),

3.when it is done(and let us cross fingers it is done in time),set the start signal to 0

 

Well, I didn't succeed in linux interrupt, still trying to figure out how an interrupt communicate with the userspace(and if it is reading/writing to userspace, it need to use another interrupt, I don't wish the timer signal is interruptted).

 

For this issue,when every edge changed(blue line,which is done by FPGA), a yellow signal(userspace signals) will be 1 and when myfunction() is done it set to 0. 

And then repeat the work.

 

But after several seconds of working progress, the issue will occur, which is an unstable disaster for my system.

 

So I want to know how to prevent this problem.

 

Thank you for your help.

 

Reguards.

 

0 Kudos
aikeu
Employee
834 Views

Hi CAlex,


The while loop method will not guarantee a consistent timing for sure.

The operation should be done with interrupt.


Thanks.

Regards,

Aik Eu


0 Kudos
CAlex
New Contributor II
827 Views

Okey, thank you then,

looks like I have to try interrupt if I want to have a stable process on linux.

No futther questions on that link, thank you again.

 

Reguards.

0 Kudos
aikeu
Employee
789 Views

Hi CAlex,


I will close this thread for now. Do consider open a new thread if there is any further question to follow up.

Do give a very good survey if receive any, Thanks a lot!


Thanks.

Regards,

Aik Eu


0 Kudos
Reply