This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi team,
Issue:
The ipp of msp430f149, which is currently in debug phase, the customer has written the simple boot file and app file, and has also included the interrupt jump instruction in the boot file. If there are no interrupts in the app file, the program can execute, and once the serial receive interrupt is turned on in the app program, the program stops after the serial send instruction. The serial interrupt vector is also redefined in the boot program.
The customer would like to know what's the possible reason for that, is it related to the app interrupts program?
The boot program is as follows:
#include "io430.h" #include "flash.h" void USART_Init(void); void main( void ) { char i=0; WDTCTL = WDTPW + WDTHOLD; flash_init(); USART_Init(); while(1) { while (IFG1 & URXIFG0) { rec[i]=RXBUF0; i++; if(i==count) { i=0; flash_write(rec); asm(" br &0x8100;");//Jump after receiving the upgrade } } } } void USART_Init(void) { P3SEL |= BIT4+BIT5; // P3.4,5 is selected as the UART transceiver port ME1 |= UTXE0 + URXE0; // Enable USART0 transmit and receive UCTL0 |= CHAR; // 8-bit character UTCTL0 |= SSEL0; // UCLK = ACLK UBR00 = 0x03; // 32k/9600 - 3.41 UBR10 = 0x00; // UMCTL0 = 0x4A; // Modulation UCTL0 &= ~SWRST; // Initialize the UART0 state machine IE1 |= URXIE0; // Enable to receive interrupts // _EINT(); } #pragma vector=USART0RX_VECTOR __interrupt void USART0RX_ISR(void) { asm(" br &0x81A2;");//Serial interrupt redefined }
App program is as follows:
#include "msp430x14x.h" #define CPU_F ((double)8000000) //Accurate time delay #define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0)) #define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0)) void USART_Init(void); void main( void ) { WDTCTL = WDTPW + WDTHOLD; BCSCTL1 &= ~XT2OFF; //Turn on the XT2 high-frequency crystal oscillator do { IFG1 &= ~OFIFG; //Clear the crystal fail flag for (char z = 0xFF; z > 0; z--); //Wait for the 8-MHz crystal to oscillation } while ((IFG1 & OFIFG)); //Crystal failure flag still present? BCSCTL2 |= SELM_2 + SELS; //MCLK and SMCLK select high frequency crystal USART_Init(); P2DIR|=0XFF; P2OUT=0X00; delay_ms(2000); P2OUT=0Xff; delay_ms(2000); P2OUT=0X00; while(1) { LPM0; } } #pragma vector=USART0RX_VECTOR __interrupt void USART0RX_ISR(void) { char r; r=RXBUF0; P2OUT^=0xFF; } void USART_Init(void) { P3SEL |= 0x30; // P3.4,5 is selected as the UART transceiver port ME1 |= UTXE0 + URXE0; // Enable USART0 transmit and receive UCTL0 |= CHAR; // 8-bit character UTCTL0 |= SSEL0; // UCLK = ACLK UBR00 = 0x03; // 32k/9600 - 3.41 UBR10 = 0x00; // UMCTL0 = 0x4A; // Modulation UCTL0 &= ~SWRST; // Initialize the UART0 state machine IE1 |= URXIE0; // Enable to receive interrupts _EINT(); }
Could you help check this issue? Thanks.
Best Regards,
Cherry
I is better not to use interrupt in boot project except reset vector interrupt. You can refer to this document
Hi Gary,
Thanks.
And the customer indeed would like to figure out the redefinition of interrupts, such as how to jump to the app's interrupt function in the boot file, and whether the app's interrupt function needs to have something pop out.
The boot program does not use interrupts, does not turn on interrupts, just defines the interrupt service function. This interrupt service function is used for the interrupt service program in the app, which jumps to the boot interrupt function, and then to the app interrupt function with the br instruction. And now is stuck in the jump process.
It was found that the txt document generated by the assembly window of the compiler appeared to be missing a stack process. 0x81A2 is directly the entry to the serial port to receive the interrupt service program, so is that process of jumping from boot to the missing stack the cause of the problem?
@8100 31 40 00 0A B0 12 0C 81 B0 12 B0 81 B2 40 80 5A 20 01 F2 C0 80 00 57 00 E2 C3 02 00 7E 43 01 3C 7E 53 5E 93 FD 2F E2 B3 02 00 F6 2F F2 D0 88 00 58 00 B0 12 6C 81 5E 42 2A 00 F2 43 2A 00 C2 43 29 00 3F 40 FE 08 3D 40 3D 00 3F 53 3D 63 FD 2F F2 43 29 00 3F 40 FE 08 3D 40 3D 00 3F 53 3D 63 FD 2F C2 43 29 00 32 D0 10 00 FD 3F F2 D0 30 00 1B 00 F2 D0 C0 00 04 00 F2 D0 10 00 70 00 F2 D0 10 00 71 00 F2 40 03 00 74 00 C2 43 75 00 F2 40 4A 00 73 00 D2 C3 70 00 F2 D0 40 00 00 00 32 D2 30 41 0E 12 5E 42 76 00 F2 E3 29 00 3E 41 00 13 30 40 B4 81 30 40 B8 81 FF 3F @FFF2 A2 81 @FFFE 00 81 q
Thanks and Best Regards,
Cherry
Hi Gary,
May I know is there any updates about the additional info?
Thanks and Best Regards,
Cherry
I think you can let the customer go through the application note first. You will found a way to manage the interrupt table. In the application note it use a jump table to this job like below table is defined in the application project.
In boot project it fill the interrupt vector table in hardware by the address of array's element like below
**Attention** This is a public forum