Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AVoye
Beginner
1,694 Views

Interrupt with Qsys component (DE0-Nano-SoC)

I have create a component with Qsys in Quartus and I would like send a interrupt from this component to the HPS with linux.

But I don’t hnow how my C program can received a interrupt (with request_irq(...) ?).

Can you help me with example ?

 

Thanks,

Arnaud

 

0 Kudos
4 Replies
JOHI
New Contributor II
57 Views

Hello,

 

https://people.ece.cornell.edu/land/courses/ece5760/DE1_SOC/DE1-SoC-UP-Linux/Linux.pdf (see last pages)

 

You will need to compile a kernel module.

 

I would be happy to learn from your expericences, I play with the idea to do the same thing some time.

 

Best regards,

Johi.

AVoye
Beginner
57 Views

Hello,

 

This document is very interresting but I wanted to make a C program with a main so I am going test the request_irq function.

 

Thanks for you answer.

Arnaud.

Ahmed_H_Intel1
Employee
57 Views

Hi,

Please check the following document witch show how to write a simple interrupt routine.

https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/an/an284.pdf

 

Also you can go with the VIC (Vectored Interrupt Controller)for advanced interrupt routines

https://www.intel.com/content/www/us/en/programmable/support/support-resources/design-examples/intel...

 

Regards.

Ahmed_H_Intel1
Employee
57 Views

BTW, The DE0 nano SOC has a SPI connection with ADC on board, use the following example to understand how to use the SPI ADC.

I have created this example before, not officially released

 

Here is the main code to read from the ADC (DE0_Nano_SoC)

/* * "ADC" example. * * This example gets the data of the ADC and convert it to digital to implement on LEDs * Developer: Embedded guy * Nov 2018 * DE0 Nano SoC */   #include <stdio.h> #include "system.h" #include "altera_up_avalon_adc_regs.h" #include "altera_up_avalon_adc.h" #include "altera_avalon_pio_regs.h" #include "alt_types.h"   alt_up_adc_dev * ADC_DEV; unsigned int ADC_DATA=1;   int main() { printf("Starting \n"); //Enable ADC auto update alt_up_adc_auto_enable(ADC_DEV);   //Open the ADC device ADC_DEV= alt_up_adc_open_dev("/dev/adc_0"); if (ADC_DEV==NULL){ printf("Cannot open ADC"); }   while (1){ unsigned ch=0; ADC_DATA = alt_up_adc_read(ADC_DEV,ch); printf("ADC data of CH0= %d \n",ADC_DATA);   int delay=0; while (delay<5000000){ delay++; } }     return 0; }

Please feel free to ask for support if needed.

Regards.