This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interrupt handler definitions for UCD3138

Other Parts Discussed in Thread: UCD3138

For a UCD3138 part, How can we define an interrupt handler function for:

- A fault on the FAULT0 pin of the device

- A period interrupt for a PWM module

I can not find any examples of how to declare these interrupt handler routines.

Thanks

  • Hakan, we have some introductory labs on the UCD3138 on this forum here: 

    http://e2e.ti.com/support/power_management/digital_power/f/184/t/292514.aspx

    lab 06 shows a PWM interrupt. 

    The ARM 7 supports 2 interrupts, fast and standard.  For the two interrupts you mention, we normally use the fast interrupt for the fault, because we assume it needs fast response, and we use the standard interrupt for a timer tick based interrupt that is really the backbone of our EVM codes.  That is the recommended way to use interrupts.  You can use more, but there is a serious risk that the interrupt handling will get out of hand.  Debugging and determinacy suffer the more interrupts you have.  There are only two interrupt vectors supported by the hardware.  If you want more than two sources, you have to use some software to sort them out.  IRQIVEC and FIQIVEC registers are provided to support a quick software vector scheme, however.

    We don't have example code for the Fault pins, but here is the general procedure for doing any interrupt:

    1.  Enable the interrupt in the module.  For fault pins, this is done in the GpioRegs.FAULTINTENA register.

    2.  Look at the data sheet and find the bit in the CIM (Central Interrupt Module) REQMASK register corresponds to the module you want.  Or you can look in cyclone_defines.h in the header files:

               #define CIMINT_ALL_FAULT_PIN (0x40000000) // 30 Fault Pin Interrupt 

    The REQMASK register is protected, so it cannot be written to in user mode.  Use the software interrupt function call write_reqmask instead.  Make it a fast interrupt by setting the bit in the FIRQPR register using the write_firqpr software interrupt. 

    That sets up the interrupt.  Remember to clear the interrupt before exiting the program.  For the fault pins, you write a 1 to the status bit to clear the interrupt. 

    That's it.