ARM Technical Support Knowledge Articles

RELOCATING AUTOVECTOR INTERRUPTS ON THE CYPRESS EZ-USB

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I'm using the Autovector Interrupt feature of the Cypress EZ-USB which requires a fixed interrupt vector table at address 0x200. In uVision, I specified that interrupt vectors start at address 0x0200 under Project - Options - C51 - Interrupt vectors. Since I did this I'm getting compiler errors like the following:

C51 FATAL ERROR
ACTION: PARSING INVOKE/PRAGMA-LINE
LINE:   #pragma NOIV
ERROR:  RESPECIFIED OR CONFLICTING CONTROL

Is there something special I must do to use the Autovector Interrupts?

ANSWER

The Autovector interrupt is a special feature that is only available on the Cypress parts. No other 8051 devices has thie feature. The Autovector interrupt uses special hardware to modify the interrupt vector address. The single Autovector interrupt location at address 43H serves all USB related interrupts like Setup Data Available (ISR_Sudav), Start of Frame (ISR_Sof), and all endpoint interrupts.

To write interrupt functions for the Autovector interrupt Cypress uses the #pragma NOINTVECTOR directive. This supresses the C compiler generated interrupt vectors. Therefore, all interrupts that are served by the Autovector interrupt have the same interrupt number. For example:

void ISR_Sudav(void) interrupt 0
void ISR_Sutok(void) interrupt 0
void ISR_Sof(void) interrupt 0

The interrupt vectors are not generated by the C51 Compiler (because NOINTVECTOR is used). And, since this directive is used, it is not possible to use the INTVECTOR directive to locate the interrupt vectors at a specific location. That is the reason for the C51 FATAL ERROR message that you receive.

There are several ways to approach this problem.

One way is to refer to Application Note 126: Using the Cypress EZ-USB AutoVector Interrupts. This application note discusses a way to handle the AutoVector interrupts using mostly C code with a small assembler routine.

Another way is to create an interrupt vector file in assembly. The Cypress software contains a file named USBJmpTb.A51 which generates all the interrupt vectors for the USB related interrupt service routines. The file contains interrupt vector definitions that appear as follows:

USB_AutoVector  equ     $+2
$if (Monitor)
                DB      02H                         ; LJMP
                DB      HIGH USB_Jump_Table         ; Autovector will replace byte 45
                DS      1                           ; Autovector will replace byte 45
$else
                ljmp    USB_Jump_Table              ; Autovector will replace byte 45
$endif
;------------------------------------------------------------------------------
; USB Jump Table
;------------------------------------------------------------------------------
?PR?USB_JUMP_TABLE?USBJT  segment code page         ; Place jump table on a page boundary
                RSEG      ?PR?USB_JUMP_TABLE?USBJT  ; autovector jump table
USB_Jump_Table:
                ljmp    ISR_Sudav                   ; Setup Data Available
                db      0
                ljmp    ISR_Sof                     ; Start of Frame
                db      0
                ljmp    ISR_Sutok                   ; Setup Data Loading
                db      0

To locate the USB_Jump_Table at a specific address you may simply change the segment defintion for the ?PR?USB_JUMP_TABLE?USBJT. For example:

CSEG AT 200H    ; Place jump table on a page boundary at address 200H

USB_Jump_Table:
                ljmp    ISR_Sudav       ; Setup Data Available
                db      0
                ljmp    ISR_Sof         ; Start of Frame
                db      0
                ljmp    ISR_Sutok       ; Setup Data Loading
                db      0

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-10-24 14:10:53

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential