Results 1 to 9 of 9

Thread: DE10-Nano Handling FPGA interrupts

  1. #1
    Join Date
    Jan 2017
    Posts
    15
    Rep Power
    1

    Default DE10-Nano Handling FPGA interrupts

    Hello,

    I'm trying to find info on how to handle an IRQ from FPGA to HPS via f2h_irq0 Interrupt Receiver.
    For now I don't have a clue. I just found info on how to handle GPIO like KEY0 or KEY1 but they are mapped to the HPS region.

    I hope to capture edge interrupts from SW[4..0]. Maybe I can find somebody with experience with this here.

    Regards!

  2. #2
    Join Date
    Aug 2016
    Posts
    6
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    Quote Originally Posted by nhasbun View Post
    Hello,

    I'm trying to find info on how to handle an IRQ from FPGA to HPS via f2h_irq0 Interrupt Receiver.
    For now I don't have a clue. I just found info on how to handle GPIO like KEY0 or KEY1 but they are mapped to the HPS region.

    I hope to capture edge interrupts from SW[4..0]. Maybe I can find somebody with experience with this here.

    Regards!
    Hello.
    For baremetal application use hardware libs routines for interrupt control and ISR handler registration.

  3. #3
    Join Date
    Jan 2017
    Posts
    15
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    Hey thanks !

    I'm trying to catch interrupts under linux. I was reading the altera documentation for HWLIB and SoCAL APIs without success.
    This is a simple starting program with a strange error:

    Code:
    #include <stdio.h>
    #include "hwlib.h"
    #include "alt_interrupt.h"
    
    int main() {
      ALT_STATUS_CODE status;
      status = alt_int_global_init();
      if(status == ALT_E_SUCCESS) printf("exito...");
      return 0;
    }
    I got this error:
    Code:
    $ make build
    arm-linux-gnueabihf-gcc -g -Wall -Werror -ID:/intelFPGA/17.0/embedded/ip/altera/
    hps/altera_hps/hwlib/include -ID:/intelFPGA/17.0/embedded/ip/altera/hps/altera_h
    ps/hwlib/include/soc_cv_av -Dsoc_cv_av -c main.c -o main.o
    arm-linux-gnueabihf-gcc -g -Wall -Werror   main.o -o ledtest
    main.o: In function `main':
    C:\Users\nhasbun\Desktop\C/main.c:7: undefined reference to `alt_int_global_init
    '
    collect2.exe: error: ld returned 1 exit status
    make: *** [ledtest] Error 1
    And I'm using this makefile that I got from Altera examples for this board. Not sure what the problem is, since the header is being read.

  4. #4
    Join Date
    Dec 2009
    Location
    USA
    Posts
    368
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    It's very simple from a hardware standpoint. f2h_irq0 is a 32-bit input. Connect SW[4:0] to f2h_irq0[4:0] (or whichever 5 bits you want to use) and tie the remaining f2h_irq0 bits to logic 0 if you're not using them for other interrupt sources.

  5. #5
    Join Date
    Jan 2017
    Posts
    15
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    Hey thanks!

    I should stated that I was working under linux!. I was reading the altera documentation for HWLIB and SoCAL APIs without success.
    This is a simple starting program with a strange error:

    Code:
    #include <stdio.h>
    #include "hwlib.h"
    #include "alt_interrupt.h"
    
    int main() {
      ALT_STATUS_CODE status;
      status = alt_int_global_init();
      if(status == ALT_E_SUCCESS) printf("exito...");
      return 0;
    }
    I got this error:

    Code:
    main.o: In function `main':
    C:\Users\nhasbun\Desktop\C/main.c:7: undefined reference to `alt_int_global_init
    I guess it's a linker problem on my makefile ?
    Attached Files Attached Files

  6. #6
    Join Date
    Jan 2017
    Posts
    15
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    Ok, so I solved that error by copying the alt_interrupt.c file to folder and improving a little my makefile.

    But now I got this error:

    Code:
    C:\Users\nhasbun\AppData\Local\Temp\ccJaPb6S.s: Assembler messages:
    C:\Users\nhasbun\AppData\Local\Temp\ccJaPb6S.s:91: Error: Thumb encoding does no
    t support an immediate here -- `msr CPSR_c,#(0x12|0x80|0x40)'
    make: *** [alt_interrupt.o] Error 1
    This is my makefile:

    #
    TARGET = main

    #
    ALT_DEVICE_FAMILY ?= soc_cv_av
    HWLIBS_ROOT = $(SOCEDS_DEST_ROOT)/ip/altera/hps/altera_hps/hwlib

    #
    SRCS=$(wildcard *.c) $(wildcard */*.c)
    OBJECTS=$(SRCS:.c=.o)

    CFLAGS = -g -Wall -Werror \
    -I$(HWLIBS_ROOT)/include \
    -I$(HWLIBS_ROOT)/include/$(ALT_DEVICE_FAMILY) \
    -D$(ALT_DEVICE_FAMILY)
    LDFLAGS = -g -Wall -Werror \
    -pthread -lpthread -lm

    CROSS_COMPILE = arm-linux-gnueabihf-
    CC = $(CROSS_COMPILE)gcc
    LD = $(CROSS_COMPILE)gcc
    ARCH = arm

    .PHONY: build
    build: $(TARGET)

    $(TARGET): $(OBJECTS)
    $(LD) $(LDFLAGS) $^ -o $@

    %.o : %.c $(HEADERS)
    $(CC) $(CFLAGS) -c $< -o $@

    .PHONY: clean
    clean:
    rm -f $(TARGET) *.a *.o *~
    rm -f $(UART_CORE_LIB_ROOT)/*.o

  7. #7
    Join Date
    Jan 2017
    Posts
    15
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    Ok, so I solved that error by copying the alt_interrupt.c file to folder and improving a little my makefile.

    But now I got this error:

    Code:
    C:\Users\nhasbun\AppData\Local\Temp\ccJaPb6S.s: Assembler messages:
    C:\Users\nhasbun\AppData\Local\Temp\ccJaPb6S.s:91: Error: Thumb encoding does no
    t support an immediate here -- `msr CPSR_c,#(0x12|0x80|0x40)'
    make: *** [alt_interrupt.o] Error 1

  8. #8
    Join Date
    Sep 2017
    Posts
    3
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    Hi!
    Are you solve the problem now? I happend to have the same problem, I copy the alt_interrupt.c file to my project folder and add command lines to my nmake, but it still dosen't work.The error like

    Thumb encoding does not support an immediate here -- `msr CPSR_c,#(0x12|0x80|0x40)'

  9. #9
    Join Date
    Jan 2017
    Posts
    15
    Rep Power
    1

    Default Re: DE10-Nano Handling FPGA interrupts

    I just gave up. It seems like we had the libraries to use the FPGA interrupts under Linux but there is simply not enough info out there on how to make it work.

Similar Threads

  1. DE10 Nano kit - mini USB OTG without 5V?
    By Negsol in forum Development Kit Related
    Replies: 7
    Last Post: October 9th, 2017, 10:04 AM
  2. Replies: 14
    Last Post: October 6th, 2017, 10:30 AM
  3. Terasic DE10-nano Question - Why does DE0 rbf work on it?
    By mjd100100 in forum Development Kit Related
    Replies: 7
    Last Post: June 12th, 2017, 02:22 PM
  4. Handling Incoming packet coming from PC(other source) to FPGA via TSE MAC
    By beginner_EDA in forum General Discussion Forum
    Replies: 0
    Last Post: February 4th, 2015, 12:22 AM
  5. Good practice for handling user commands in an FPGA
    By Geri in forum FPGA, Hardcopy, and CPLD Discussion
    Replies: 4
    Last Post: June 28th, 2010, 11:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •