How to change RTEMS real time interrupt source to external pin of LEON UT699

Rehab Massoud rehab.massoud at gmail.com
Wed Aug 30 14:47:45 UTC 2017


Hi,

using an external pin to directly trigger an interrupt is a little bit
tricky and you will probably need to do some signal conditioning according
to the expected shape and nature of the input signal that would appear on
the pin. Did you already consider all this?
If not then this is where you should start from: study your input signal,
look for a suitable digital signal conditioning for it (I suppose you are
using one of the LEON development boards so you can put such circuit on
chip with LEON as it is a soft-core already), then get the interrupt pin of
LEON connected to the output from that signal conditioning circuit (rather
than directly from the gpio pin, which should be connected as the input for
this signal conditioning).


On Wed, Aug 30, 2017 at 4:07 PM, <Richard.Glossop at l3t.com> wrote:

> Want to change the source of RTEMS time tick interrupt from Timer 0 on the
> LEON to a GPIO pin.  Have had success enabling the GPIO pin for the
> interrupt source (I get Spurious Interrupt 5 messages on the gdb console –
> we are using GPIO 5 – this tells me the interrupt is happening).  When I
> try to use rtems_interrupt_catch to install a new vector isr for the GPIO,
> the system crashes.
>
>
>
> Here is the code:
>
>
>
> rtems_isr_entry reMapRealTimeInterrupt (void)
>
> {
>
>     int level;
>
>     rtems_isr_entry old_handler;
>
>     rtems_status_code retVal;
>
>
>
>
>
>     rtems_interrupt_disable (level);     // disable all maskable interrupts
>
>
>
>
>
>
>
>     retVal = rtems_interrupt_catch(         // re-map vector 5 to our
> handler (GPIO 5)
>
>         handler,
>
>         5,
>
>         &old_handler);
>
>
>
>     printf("Remap retVal:0x%x\n",retVal);
>
>
>
>
>
>
>
>     *(unsigned int*)TIMCTR1 &= ~0x00000009; // disable timer 1 interrupt
> enable and timer enable
>
>     *(unsigned int*)IMR &= ~0x00000040;     // mask interrupt for timer 1
> interrupt since it is no longer used
>
>     *(unsigned int*)IMR |=  0x00000020;     // enable GPIO 5 interrupt in
> IMR
>
>     *(unsigned int*)ILR |=  0x00000020;     // set interrupt 5 to be a
> level 1 interrupt
>
>
>
>
>
>     *(unsigned int*)GPIOIMR |= 0x00000020;  // enable bit 5 to cause
> interrupts (GPIO 5)
>
>     *(unsigned int*)GPIOIER |= 0x00000020;  // set GPIO interrupt 5 to be
> edge triggered
>
>     *(unsigned int*)GPIOIPR |= 0x00000020;  // set GPIO interrupt 5 to be
> rising edge
>
>
>
>
>
>     rtems_interrupt_enable (level);       // enable all previously enabled
> interrupts
>
>
>
>     return old_handler;                      // return original isr
> address in case want to restore
>
>
>
> }
>
>
>
>     rtems_isr handler (rtems_vector_number vector)
>
>     {
>
>         printf("This is irq %d.\n",vector);
>
>         rtems_clock_tick();
>
>
>
>
>
>     }
>
>
>
> Can anyone help with this, or point me to example code to accomplish the
> same thing?
>
> Effective immediately my new email address is Richard.Glossop at L3T.com.
> Please update your records.
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170830/aedd2a7f/attachment-0001.html>


More information about the users mailing list