Keil Logo

C51: RELOCATING AUTOVECTOR INTERRUPTS ON THE CYPRESS EZ-USB


Information in this article applies to:

  • C51 Version 6
  • C51 Version 7

QUESTION

I'm using the Autovector Interrupt feature of the Cypress EZ-USB which requires a fixed interrupt vector table at address 0x200. In µVision, 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

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, October 24, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.