AnsweredAssumed Answered

About PIT2 interrupt.

Question asked by 赵子成 on Feb 24, 2018
Latest reply on May 15, 2018 by 赵子成

Hi All,


Recently I encounter a stranger issue:

In my program I use PIT0 as  1 Millisecond timers, the program is  OK when I use P&E USB BDM Multilink to download the program(No bootloader).

But when I use bootloader, download the program via CAN com, the program seems to fail to run. The pit0 can work(the pit0 interrupt is Invalid), and if I add pit2 interrupt vector address declare in prm file and define pit2 interrupt function(Even the function content is blank) in C file, it is OK even I use bootloader mode to download the program via CAN, the program run OK, or the pit0 works OK.

I don't know why it is pit2 interrupt that  concerns whether pit0 work or not when I use bootloader download the program.


I declare the pit2 interrupt vector in prm file like this:


And the pit2 interrupt function is like this:

interrupt void ISR_PIT2(void) /* vector 68 */

And the PIT init is this:

void PIT_Init(void)
PITCFLMT |= 0x81; //enables the PIT module, loads the 8-bit micro timer load register into the 8-bit micro timer 0 down-counter
PITMUX |= 0x00; //The all 16-bit timer counts with micro time base 0
//pit0 period=(N+1)*(M+1)/BusClk=(59+1)*(799+1)/(48M)=1ms
PITMTLD0 = 59U; //define the timer value
PITLD0 = 799U; //define the timer value
PITINTE_PINTE0 = 1; //enable pit0 interrupt
PITFLT |= 0x01; //load the value
PITCE |= 0x01; //make the pit0 start to work