Contents
Previous Chapter
Next Chapter



6 Interrupts

6.1 Overview

The eCOG1X peripherals and I/O can generate interrupt requests in response to events occurring either in the eCOG1X peripherals or off chip. For example, a serial transmit buffer may have been transmitted, an event detected at a GPIO pin, or an ADC conversion completed. Each peripheral has addressable registers which are configured by user software to enable or disable interrupts either on a peripheral or individual interrupt basis. User software also provides an Interrupt Service Routine (ISR) to detect and service the interrupt source.

The eCOG1 CPU has two modes of operation, 'User' and 'Interrupt'. Refer to Section 3 of this document, to the eCOG1 C Compiler Manual, and to the eCOG1 Macro Assembler User Manual for further information and details of required actions by the user ISR.

6.2 Interrupt Handler

The eCOG1 CPU core supports up to 64 vectored interrupts from its peripherals. Most of the on-chip peripherals may generate interrupts.

In addition, exceptions may be generated on a watchdog timer underflow, an address error, and on DUSART or DUART errors. Exceptions have higher priority over interrupts, however the mechanism for vector fetch and branch address generation is identical for both exceptions and interrupts. Throughout the rest of this document, the term interrupt is used to denote an exception or an interrupt. The priority of interrupts is as follows:

The following diagram describes the flow of interrupt from source to vector fetch and address generation.

Figure 11: Interrupt flow diagram

When an enabled interrupt signal is received form one of the peripheral blocks, the priority encoder generates a six bit interrupt vector corresponding to the highest priority active interrupt source. The interrupt vector is passed to the Sync and Validate block, which filters the vector address to determine if a valid interrupt request is being made. The Sync and Validate block then generates an interrupt request and passes the six bit vector to the Address Generation block. The Address Generation block appends 19 '0's to the six bit vector to produce a 25-bit vector address, and a 16-bit value is read from that address in code space. The 16-bit value is sign extended to form a 25-bit code space address, and instruction execution for the interrupt service routine (ISR) starts from this address. It is up to the user's ISR to clear the interrupt status if required so that lower priority interrupts may be detected and serviced.

Note that because the 25-bit code space address for the ISR is constructed by sign-extending the 16-bit value in the vector table, all interrupt service routines must be located within the bottom 64K and top 64K bytes of code space (address ranges 0x0 to 0x00FFFF and 0x1FF0000 to 0x1FFFFFF).

The watchdog timer exception operates differently from all other interrupts. The first occurrence of a watchdog timeout generates an exception. The second occurrence of a watchdog timeout generates a hardware reset signal on the nRESET_OUT output or the nRESET I/O pin.

6.3 Interrupt Latency

Interrupt latency is slightly complicated by the fact that the interrupt signal nearly always has to cross clock domains and be resynchronised. The following example shows the path of a typical interrupt, the PWM1 count transition match:

Generation and capture in the PWM1 clock domain

= 2 cycles

Combinational delay through enable and priority encode logic

= unknown

Resynchronisation and sampling in CPU clock domain

= 4 cycles

Clocking through to vector fetch mechanism in CPU clock domain

= 2 cycles

The combinational delay may be estimated at a few nanoseconds, however this is small compared to the total number of clock cycles and can be neglected. The total latency for this interrupt is therefore 2 PWM1 clock cycles and 6 CPU clock cycles, from assertion at the source to the start of vector fetch. The elapsed time may be calculated from the settings in the SSM for the PWM1 clock and CPU clock frequencies.

In some circumstances this imposes a limit on the rate at which interrupts may be generated repeatedly by a peripheral, because the logic that transfers the interrupt from the peripheral clock domain to the CPU clock domain requires a minimum of three peripheral clock cycles to reset and generate successive interrupts. For these interrupts to be triggered correctly, the shortest interval between interrupts is three peripheral clocks.

6.4 Interrupt Priority

The full priority scheme is as follows:

6.5 Interrupt Vectors

The following table is a full list of interrupt vectors and their addesses in code space for the eCOG1X device. When the specified interrupt is detected, the CPU core fetches the contents of the code space address derived from the interrupt vector. This value is then sign extended from 16 to 25 bits, and execution of the interrupt service routine begins by fetching the instruction at this address.

Table 13: Interrupt vector addresses

Address

Interrupt

Source

0x00 to
0x07

reset

Reset vector at location 0x0. User must insert a branch instruction at this address.

0x08

_ex_debug

Debug exception

0x0A

_ex_wdog_exp

Timer/counters, watchdog timer expired

0x0C

_ex_adr_err

MMU: access to an unmapped address
EMI: access to a chip select that is disabled

0x0E

_ex_reserved

 

0x10

_ex_tim

Exception interrupt from timer/counter module

0x12

_ex_v33

Exception interrupt from VDD 3.3V sense

0x14

_ex_usarta

Exception interrupt from DUSART channel A

0x16

_ex_usartb

Exception interrupt from DUSART channel B

0x18

_ex_uart1a

Exception interrupt from DUART1 channel A

0x1A

_ex_uart1b

Exception interrupt from DUART1 channel B

0x1C

_ex_uart2a

Exception interrupt from DUART2 channel A

0x1E

_ex_uart2b

Exception interrupt from DUART2 channel B

0x20

_int_tmr_exp

Timer/counters, timer TMR underflow

0x22

_int_cnt1_exp

Timer/counters, counter CNT1 underflow

0x24

_int_cnt2_exp

Timer/counters, counter CNT2 underflow

0x26

_int_cnt1_match

Timer/counters, counter CNT1 comparator match

0x28

_int_cnt2_match

Timer/counters, counter CNT2 comparator match

0x2A

_int_pwm1_exp

Timer/counters, PWM1 underflow

0x2C

_int_pwm2_exp

Timer/counters, PWM2 underflow

0x2E

_int_pwm1_match

Timer/counters, PWM1 transition value match

0x30

_int_pwm2_match

Timer/counters, PWM2 transition value match

0x32

_int_cap_exp

Timer/counters, input capture timer overflow

0x34

_int_cap1

Timer/counters, input capture timer event 1

0x36

_int_cap2

Timer/counters, input capture timer event 2

0x38

_int_cap3

Timer/counters, input capture timer event 3

0x3A

_int_cap4

Timer/counters, input capture timer event 4

0x3C

_int_cap5

Timer/counters, input capture timer event 5

0x3E

_int_cap6

Timer/counters, input capture timer event 6

0x40

_int_ltmr_exp

Timer/counters, long interval timer LTMR underflow

0x42

_int_espi

ESPI interrupts, tx ready, rx ready

0x44

_int_emac

Ethernet MAC interrupts

0x46

_int_mcpwm

MCPWM interrupts, period, transition

0x48

_int_usb_core

USB core interrupts

0x4A

_int_usb_wakeup

USB wakeup event interrupt

0x4C

_int_usb_fifo

USB FIFO interrupts

0x4E

_int_usb_dma

USB DMA interrupts

0x50

_int_aci

ACI module, ADC/DAC ready (conversion complete)

0x52

_int_i2s

I2S port interrupts

0x54

_int_usarta_rx_rdy

DUSART channel A receive port ready

0x56

_int_usarta_tx_rdy

DUSART channel A transmit port ready

0x58

_int_usartb_rx_rdy

DUSART channel B receive port ready

0x5A

_int_usartb_tx_rdy

DUSART channel B transmit port ready

0x5C

_int_sci_tx_done

DUSART smart card transmit data complete

0x5E

_int_sci_tx_err

DUSART smart card transmit error detected

0x60

_int_sci

DUSART general smart card interrupt

0x62

_int_ifr_tx_done

DUSART infrared transmit data complete

0x64

_int_ifr_rx_done

DUSART infrared receive data complete

0x66

_int_ifr_rx_err

DUSART infrared receive error detected

0x68

_int_ifr_frame_done

DUSART infrared frame complete

0x6A

_int_uart1a_tx_rdy

UART1A transmit port ready

0x6C

_int_uart1a_rx_rdy

UART1A receive port ready

0x6E

_int_uart1b_tx_rdy

UART1B transmit port ready

0x70

_int_uart1b_rx_rdy

UART1B receive port ready

0x72

_int_uart2a_tx_rdy

UART2A transmit port ready

0x74

_int_uart2a_rx_rdy

UART2A receive port ready

0x76

_int_uart2b_tx_rdy

UART2B transmit port ready

0x78

_int_uart2b_rx_rdy

UART2B receive port ready

0x7A

_int_ehi

EHI module interrupt.

0x7C

_int_gpio

GPIO interrupt (edge or level detect)

0x7E

_int_dsci

DSCI interrupt (dual smart card interface)

6.6 Timer Interrupts

All of the timer modules can be programmed to generate interrupts depending on their configuration, clock controls and asynchronous inputs. In addition the watchdog timer and capture timers generate exception conditions when an error is detected.

Interrupts are listed below by timer:

Table 14: Timer interrupts

Address

Timer

Interrupt

Description

0x20

TMR

tmr_exp

A TMR count strobe has occurred when the TMR timer value is zero.

0x40

LTMR

ltmr_exp

An LTMR count strobe has occurred when the LTMR timer value is zero.

0x2A

PWM1

pwm1_exp

A PWM1 count strobe has occurred when the PWM1 timer value is zero.

0x2E

PWM1

pwm1_match

The PWM1 timer value is the same as the tim.pwm2_val register.

0x2C

PWM2

pwm2_exp

A PWM2 count strobe has occurred when the PWM2 timer value is zero.

0x30

PWM2

pwm2_match

The PWM2 timer value is the same as the tim.pwm2_val register.

0x22

CNT1

cnt1_exp

A CNT1 count strobe has occurred when the CNT1 timer/counter value is zero.

0x26

CNT1

cnt1_match

The CNT1 timer/counter value is the same as the tim.cnt1_cmp register.

0x24

CNT2

cnt2_exp

A CNT2 count strobe has occurred when the CNT2 timer/counter value is zero.

0x28

CNT2

cnt2_match

The CNT2 timer/counter value is the same as the tim.cnt2_cmp register.

0x0A

WDOG

wdog_exp

A WDOG count strobe has occurred when the watchdog timer value is zero.
This is a special exception case.

0x32

CAP

cap_exp

A CAP count strobe has occurred when the CAP timer is at its maximum value.

0x34
0x36
0x38
0x3A
0x3C
0x3E

CAP

cap1
cap2
cap3
cap4
cap5
cap6

A trigger event has been detected on one of the six asynchronous capture inputs and the associated tim.cap_val* register has been loaded with the current CAP count value.

0x10

CAP

cap1_ovwr
cap2_ovwr
cap3_ovwr
cap4_ovwr
cap5_ovwr
cap6_ovwr

A second trigger event has been detected on a capture input before its associated tim.cap_val* register has been read.
This is an exception.

6.7 DUSART Interrupts

Refer to the independent descriptions of each protocol support engine for a description of specific interrupts. Exception interrupts, used to signal error conditions, are grouped together within the USART to provide a single exception for both channels. The following table details what interrupt sources are supplied by the DUSART.

Table 15: DUSART interrupts

Vector

Interrupt

Description

0x14
0x16

ex_usart_a
ex_usart_b

Generated on a per channel basis when underflow or overflow occurs on any of the four channels' transmit or receive data ports. Ports under/overflow when there is a mismatch of accesses between their data source and data sink. In addition, the exception is generated when a channel experiences a frame error, frame timeout or receive break condition.

0x54
0x56
0x58
0x5A

a_rx_rdy
a_tx_rdy
b_rx_rdy
b_tx_rdy

These interrupts are generated for each data port to signal its ready condition. For transmit ports this is when the transmit buffer is emptied, for receive this is when the buffer becomes full. See also this table in 'User Serial Port Interrupts'.

0x54
0x58
0x56
0x5A
0x54
0x58

a_rx_cnt_done
b_rx_cnt_done
a_tx_cnt_done
a_tx_cnt_done
a_rx_edge_det
b_rx_edge_det

See table below in 'User Serial Port Interrupts'.

0x5C
0x5E
0x60
0x60
0x60
0x60
0x60
0x60
0x60

sci_tx_rdy
sci_tx_done
sci_tx_grd_done
sci_tx_err
sci_pwr_up
sci_pwr_dn
sci_rst_done
sci_card_in
sci_card_out

See table below in 'Smart Card Interface Interrupts'.

0x62
0x64
0x66
0x68

ifr_tx_done
ifr_rx_done
ifr_rx_err
ifr_frame_done

See table below in 'IFR Interrupts'.

6.8 User Serial Port Interrupts

The User Serial Port (USR) specific interrupts are as follows.

Table 16: User Serial Port interrupts

Vector

Interrupt

Description

0x54

a_rx_cnt_done

The rx counter in USART A has reached the value of the rx_match field in the dusart.usr_a_cfg3 register.

0x56

a_tx_cnt_done

The tx counter in USART A has reached the value of the tx_match field in the dusart.usr_a_cfg3 register.

0x54

a_rx_edge_det

A matching edge has been detected on the selected USART A input signal. The register dusart.usr_a_cfg1 contains the configuration for the input edge.

0x58

b_rx_cnt_done

The rx counter in USART B has reached the value of the rx_match field in the dusart.usr_b_cfg3 register.

0x5A

b_tx_cnt_done

The tx counter in USART B has reached the value of the tx_match field in the dusart.usr_b_cfg3 register.

0x58

b_rx_edge_det

A matching edge has been detected on the selected USART B input signal. The register dusart.usr_b_cfg1 contains the configuration for the input edge.

6.9 Smart Card Interface Interrupts

The Smart Card Interface (SCI) specific interrupts are as follows.

Table 17: Smart Card Interface interrupts

Vector

Interrupt

Description

0x5C

sci_tx_done

The data portion of the transmitted data frame has been completed.

This interrupt can be triggered in one of two conditions. If the SCI is configured to have a single guard bit, then the interrupt occurs as soon as the last bit of data and the parity bit have been sent. Otherwise, the input data line is tested after the first guard etu. An interrupt is only generated if no error condition is detected on this line. This mode of operation allows the interrupt to be delayed until the data byte has been successfully transmitted (where retransmit on error is enabled).

0x60

sci_grd_done

The guard time following successful data transmission has been reached, and a new data byte may be transmitted.

If an error has been detected during the guard period, then the interrupt depends on the retx_en setting in the dusart_sc_cfg register. If retransmission is enabled, then the interrupt is delayed until the byte is transmitted without any error response and the associated guard time is complete. If retransmission is disabled, then the interrupt is triggered regardless of error state.

In single guard bit mode there is never an error condition, so the interrupt is always generated after the eleventh etu of the character frame.

0x5E

sci_tx_err

The receiving device has signalled an error on reception of the data byte.

The input data line is tested after the first guard etu at the end of a transmitted data byte. If an error condition is detected, this interrupt is generated instead of tx_done.

0x60

sci_pwr_up

The output control sequence to activate the smart card interface has been completed. At this point the smart card power and clock have been enabled, and the reset timer has begun.

0x60

sci_pwr_dn

The output control sequence to deactivate the smart card interface has been completed.

0x60

sci_rst_done

The reset active duration has been reached and the reset control output has been set to the reset inactive state.

The reset active period is timed in etus (symbol strobes) from the point at which the smart clock is enabled. The number of etus to count is configured in the most significant byte of the dusart_sc_tim_cfg2 register.

0x60

sci_card_in

An edge has been detected on the SC_CARD_IN input signal, indicating that a card has been inserted. The state machine has moved from a "card not present" to a "card present" state.

0x60

sci_card_out

An edge has been detected on the SC_CARD_IN input signal, indicating that a card has been removed. The state machine has moved from a "card present" to a "card not present" state.

6.10 IFR Interrupts

The Infra Red Interface (IFR) specific interrupts are as follows.

Table 18: IFR interrupts

Vector

Interrupt

Description

0x62

ifr_tx_done

The data portion of the transmitted data frame has been completed.

0x64

ifr_rx_done

The data portion of the received data frame has been completed.

0x66

ifr_rx_err

An error has been detected during a receive frame. This could happen if the symbol value during the lead-in, data or lead-out portion of a frame is out of sequence. For example, if the input data during the lead-in or lead-out periods has the opposite polarity to that expected, or if the data receiver/detector matches neither the '0' nor the '1' symbol pattern, the error interrupt is triggered and the frame should be aborted.

0x68

ifr_frame_done

The entire frame, consisting of a lead-in period, data portion, lead-out period and a handover or guard time, is complete.

Transmit and receive data queue controls and interrupts are supplied directly from the associated USART.

6.11 UART Interrupts

There are no specific interrupts for the UART function of the DUSART; software uses the generic data port flow control interrupts to provide real time feedback of packet exchanges.

6.12 SPI Interrupts

There are no specific interrupts for the SPI function of the DUSART; software relies on the generic USART flow control interrupts to provide real time feedback of packet exchanges.

6.13 I2C Interrupts

There are no specific interrupts for the I2C function of the DUSART; software relies on the generic USART flow control interrupts to provide real time feedback of packet exchanges.

6.14 DUART Interrupts

The DUART specific interrupts are shown in the following table.

Table 19: DUART interrupts

Vector

Interrupt

Description

0x6A

1a_tx_rdy

The transmit block is ready for new data.

0x6C

1a_rx_rdy

A new byte has been received, a read of the rx_data register results in one byte being read (from the low 8 bits of the word).

0x18

1a_tx_ofl

A transmit over write event has occurred, which is caused by a write to the transmit data register when it is not ready to accept new data. This is an exception.

0x18

1a_rx_brk

A break event is detected on the rxd line.

0x18

1a_rx_tmo

A timeout event occurs after the last data frame was received.

0x18

1a_rx_perr

A receive parity error has occurred.

0x18

1a_rx_frm_err

A received framing error has occurred (indicated by incorrect position of the stop bits).

0x18

1a_rx_ofl

A new receive frame overwrites the current frame in the receiver buffer, usually due to the host not servicing the receive interrupt quickly enough.

0x18

1a_rx_ufl

The host attempted to read data before it was transferred to the receiver buffer.

0x6E

1b_tx_rdy

The transmitter block is ready for new data.

0x70

1b_rx_rdy

A new byte has been received, a read of the rx_data register results in one byte being read (from the low 8 bits of the word).

0x1A

1b_tx_ofl

A transmit over write event has occurred, caused by a write to the transmit data register before it is ready to accept new data.

0x1A

1b_rx_brk

A break event is detected on the rxd line.

0x1A

1b_rx_tmo

A timeout event occurs after the last data frame was received.

0x1A

1b_rx_perr

A receive parity error has occurred.

0x1A

1b_rx_frm_err

A received framing error has occurred (indicated by incorrect position of the stop bits).

0x1A

1b_rx_ofl

A new receive frame overwrites the current frame in the receiver buffer, usually due to the host not servicing the receive interrupt quickly enough.

0x1A

1b_rx_ufl

The host attempted to read data before it was transferred to the receiver buffer.

0x72

2a_tx_rdy

The transmit block is ready for new data.

0x74

2a_rx_rdy

A new byte has been received, a read of the rx_data register results in one byte being read (from the low 8 bits of the word).

0x1C

2a_tx_ofl

A transmit over write event has occurred, which is caused by a write to the transmit data register when it is not ready to accept new data. This is an exception.

0x1C

2a_rx_brk

A break event is detected on the rxd line.

0x1C

2a_rx_tmo

A timeout event occurs after the last data frame was received.

0x1C

2a_rx_perr

A receive parity error has occurred.

0x1C

2a_rx_frm_err

A received framing error has occurred (indicated by incorrect position of the stop bits).

0x1C

2a_rx_ofl

A new receive frame overwrites the current frame in the receiver buffer, usually due to the host not servicing the receive interrupt quickly enough.

0x1C

2a_rx_ufl

The host attempted to read data before it was transferred to the receiver buffer.

0x76

2b_tx_rdy

The transmitter block is ready for new data.

0x78

2b_rx_rdy

A new byte has been received, a read of the rx_data register results in one byte being read (from the low 8 bits of the word).

0x1E

2b_tx_ofl

A transmit over write event has occurred, caused by a write to the transmit data register before it is ready to accept new data.

0x1E

2b_rx_brk

A break event is detected on the rxd line.

0x1E

2b_rx_tmo

A timeout event occurs after the last data frame was received.

0x1E

2b_rx_perr

A receive parity error has occurred.

0x1E

2b_rx_frm_err

A received framing error has occurred (indicated by incorrect position of the stop bits).

0x1E

2b_rx_ofl

A new receive frame overwrites the current frame in the receiver buffer, usually due to the host not servicing the receive interrupt quickly enough.

0x1E

2b_rx_ufl

The host attempted to read data before it was transferred to the receiver buffer.

6.15 External Host Interface Interrupts

The External Host Interface (EHI) module delivers the following interrupts to the CPU.

Table 20: External Host Interface interrupts

Vector

Interrupt

Description

0x7A

mmp_acc

The external host has made an access to the MMP port. Software may read the mmp_access register to identify the address and direction of the memory location which has been accessed.

0x7A

dma_rdy

The DMA channel is ready to be programmed with a channel request. This interrupt is cleared by making a new DMA channel request.

0x7A

dma_done

The DMA channel has completed and remains unavailable for transferring data until a new DMA channel request is made.

 


Contents
Previous Chapter
Next Chapter