Hi E2E Members,
I went through the F5xx/F6xx user guider and found that the interrupt vector(FF80-FFFF) can be remapped to top of RAM. It's a interesting and useful improve,I think .
In a field firmware upgrade application, we used to poll the flag to check if data is avilable or not in the buffer .Not only that, the user's app vector should remap to a non-bootcode area. Once a event is trigered ,it first feltch PC from FFE0-FFFF,and then jump to the real interrupt vector.
-----That cost several painful CLKs in vain.
so...I want to try the new character in F5xx/F6xx msp430s. However, PC corrupt when SYSRIVECT bit is set in SYSCTL.
Hope some clue from U .
Best regards.
#include "MSP430FR5739.h" #define RAM_MAX_ADRESS 0x1FFF #define MAP_VECTOR_BASE (RAM_MAX_ADRESS-1-RESET_VECTOR) #define NUM_VECTOR ( 1+( (RESET_VECTOR-RTC_VECTOR)>>1) ) __interrupt void TA0CCR0_ISR(void); __interrupt void TA0CCR1_ISR(void); __no_init unsigned int MAP_VECTOR[ NUM_VECTOR ]@MAP_VECTOR_BASE; void InitTimer(void); void Clk_setting(void); //__no_init __root void (*intvec1[16])()@0x1C00; //定义指向函数的指针数组,用于映射新的中断向量 unsigned int xx[20]; void main(void) { WDTCTL = WDTPW + WDTHOLD; MAP_VECTOR[(TIMER0_A0_VECTOR-RTC_VECTOR)/2]=(unsigned int)TA0CCR0_ISR; MAP_VECTOR[(TIMER0_A1_VECTOR-RTC_VECTOR)/2]=(unsigned int)TA0CCR1_ISR; SYSCTL |= SYSRIVECT; Clk_setting(); InitTimer(); P3OUT |= BIT4+BIT7; P3DIR |= BIT4+BIT7; _EINT(); while(1); } /******************************************************************************* **函数名:Clk_setting **说明:MCLK=8MHz ACLK=VLO=8.3KHz(~10KHz) *******************************************************************************/ void Clk_setting(void) { CSCTL0 = CSKEY; CSCTL1 = DCOFSEL_3;//------8MHz //CSCTL1 = DCORSEL+ CSCTL2 = SELM__DCOCLK + SELS__DCOCLK+SELA__VLOCLK; CSCTL3 = 0; CSCTL4 = XT1OFF+XT2OFF; //CSCTL5 = CSCTL6 = 0; } /******************************************************************************* **函数名:InitTimer **说明: *******************************************************************************/ void InitTimer(void) { //taclk -- aclk TA0CTL = TASSEL_1 + TACLR; TA0CCR0 = 5000; TA0CCTL0 = CCIE; TA0CCR1 = 2000; TA0CCTL1 = CCIE; TA0CTL |= MC_1;//增计数模式 } /******************************************************************************* **函数名:TA0CCR0_ISR **说明: *******************************************************************************/ #pragma vector = TIMER0_A0_VECTOR __interrupt void TA0CCR0_ISR(void) { P3OUT ^= BIT4; } /******************************************************************************* **函数名:TA0CCR1_ISR **说明: *******************************************************************************/ #pragma vector = TIMER0_A1_VECTOR __interrupt void TA0CCR1_ISR(void) { switch(__even_in_range(TA0IV,0x0A) ) { case 0x00: break; case 0x02: P3OUT ^= BIT7; break; case 0x04: break; case 0x0A: break; } }