Xmega-Mistery Interrupt vector

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm just doing an Interrupt vector file to be included into ASM projects.

There is a 4 bytes hole at 0x0CC-0x0CF (filled with nops for now)

;What's missing here??? 0x0CC-0x0CF
	nop
	nop
	nop
	nop

I can't seem to find anything about that, winAvr just puts a jump to bad interrupt and there is a similar hole in the Xmega .h file.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some ARM7 chips from NXP use a location in the IVT as a checksum, which is added by the linker. The MCU will not execute the program if it is incorrect.

Maybe this is something similar ?

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a mystery whatever way you look at it:

ATxmega128A1def.inc

; PORTK interrupt vectors
.equ PORTK_INT0_vect = 200 ; External Interrupt 0
.equ PORTK_INT1_vect = 202 ; External Interrupt 1

; ???????

; PORTF interrupt vectors
.equ PORTF_INT0_vect = 208 ; External Interrupt 0
.equ PORTF_INT1_vect = 210 ; External Interrupt 1

iox128a1.h

/* PORTK interrupt vectors */
#define PORTK_INT0_vect_num  100
#define PORTK_INT0_vect      _VECTOR(100)  /* External Interrupt 0 */
#define PORTK_INT1_vect_num  101
#define PORTK_INT1_vect      _VECTOR(101)  /* External Interrupt 1 */

// ?????????

/* PORTF interrupt vectors */
#define PORTF_INT0_vect_num  104
#define PORTF_INT0_vect      _VECTOR(104)  /* External Interrupt 0 */
#define PORTF_INT1_vect_num  105
#define PORTF_INT1_vect      _VECTOR(105)  /* External Interrupt 1 */

ATxmega128A1.xml



BTW John, as they are already in the ??def.inc why do you need to redefine them anyway?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
why do you need to redefine them anyway?
I'm not redefining them, just building a jump table that gets included at the beginning of a project like I do with other chips.

However Atmel has not provided this with the Xmegas like it does with others so I made it up, partially from the (buggy) vector table provided in the datasheet and from the .inc file.

For the time being the problem has been sorted this way:

; PORTK interrupt vectors
;0x0C8 
	jmp		IVEC_PORTK_INT0_vect 	;Port K External Interrupt 0
;0x0CA 
	jmp		IVEC_PORTK_INT1_vect 	;Port K External Interrupt 1

;What's missing here??? 0x0CC-0x0CF
;0x0CC 
	jmp		IVEC_Mystery_0_vect 	;Mystery interrupt vector 0 * * * * * * *
;0x0CE 
	jmp		IVEC_Mystery_1_vect 	;Mystery interrupt vector 1 * * * * * * *

; PORTF interrupt vectors
;0x0D0 
	jmp		IVEC_PORTF_INT0_vect 	;Port F External Interrupt 0
;0x0D2 
	jmp		IVEC_PORTF_INT1_vect 	;Port F External Interrupt 1

with corresponding "service" routines

IVEC_PORTK_INT0_vect:
	in		save_sreg,CPU_SREG		;Save Status register
;Your service code here	
	out		CPU_SREG,save_sreg		;Restore Status register
	reti
;
IVEC_PORTK_INT1_vect:
	in		save_sreg,CPU_SREG		;Save Status register
;Your service code here	
	out		CPU_SREG,save_sreg		;Restore Status register
	reti

IVEC_Mystery_0_vect:
	in		save_sreg,CPU_SREG		;Save Status register
;Your service code here	
	out		CPU_SREG,save_sreg		;Restore Status register
	reti
;
IVEC_Mystery_1_vect:
	in		save_sreg,CPU_SREG		;Save Status register
;Your service code here	
	out		CPU_SREG,save_sreg		;Restore Status register
	reti

IVEC_PORTF_INT0_vect:
	in		save_sreg,CPU_SREG		;Save Status register
;Your service code here	
	out		CPU_SREG,save_sreg		;Restore Status register
	reti
;
IVEC_PORTF_INT1_vect:
	in		save_sreg,CPU_SREG		;Save Status register
;Your service code here	
	out		CPU_SREG,save_sreg		;Restore Status register
	reti

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If/when I go to that effort to create the vector table and ISR skeletons, I always .ORG each one. Now your mystery is just that and would have no effect on operation. Wasn't there a current extensive thread on that?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I always .ORG each one
I don't, I simply include all vectors and they are always at the right place, well unless I'm in absolute tight spot with flash and desperate to use the vector space for code, in which case I may .org the 1 or 2 ints required. But that's just me. :)

I have include files for all chips used and just add them to the projects.

I don't remember a thread on vectors for the Xmegas but haven't followed any threads until recently as there was no point without something to play with.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly