MSCAN TX interrupt ILLEGAL BP BGND

Started by "ondrej.machek" November 29, 2008
Hello,
I would like ask you.
I am using interrupt for my transmit MSCAN can0 but at the end,
M68evb912DP256 jump to command ILLEGAL BP and asm BGND. Do anybody
know please where could be error?

Thank you very much to all.

void interrupt 39 Tx_CAN0(void){

unsigned volatile char i, buf_num, can_tx_msg[16];
buf_num = CAN0TFLG;
CAN0TBSEL = buf_num;
buf_num = CAN0TBSEL;

can_tx_msg[0]='S';
can_tx_msg[1]='T';
can_tx_msg[2]='0';
can_tx_msg[3]='0';
can_tx_msg[4]='A';
can_tx_msg[5]='H';
can_tx_msg[6]='O';
can_tx_msg[7]='J';
can_tx_msg[8]='0';
can_tx_msg[9]='0';
can_tx_msg[10]='0';
can_tx_msg[12]='0';
can_tx_msg[13]='4';
can_tx_msg[14]='1';
*CAN0TXFG = can_tx_msg[0];
*(CAN0TXFG +1) = can_tx_msg[1];
*(CAN0TXFG + 2) = can_tx_msg[2];
*(CAN0TXFG + 3) = can_tx_msg[3];

for(i=0; i *(CAN0TXFG +i +4) = can_tx_msg[i+4];
}
*(CAN0TXFG + 12) = can_tx_msg[12];

*(CAN0TXFG +13) = can_tx_msg[13];
CAN0TFLG = buf_num;
//CAN0TIER = buf_num;
} /*konec preruseni*/
> can_tx_msg[12]='0';

'0' is 0x30. Keeping that in mind please look closer at these lines:

> for(i=0; i > *(CAN0TXFG +i +4) = can_tx_msg[i+4];
> }

I think this ^^ not only fills CAN0TXFG with your data, but also overwrites
all CAN1 module control registers with random data from the stack. I guess
some CAN1 interrupts get enabled and CPU jumps to not initialized CAN1
interrupt vector.

Edward
----- Original Message -----
From: "ondrej.machek"
To: <6...>
Sent: Saturday, November 29, 2008 6:08 PM
Subject: [68HC12] MSCAN TX interrupt ILLEGAL BP BGND
> Hello,
> I would like ask you.
> I am using interrupt for my transmit MSCAN can0 but at the end,
> M68evb912DP256 jump to command ILLEGAL BP and asm BGND. Do anybody
> know please where could be error?
>
> Thank you very much to all.
>
> void interrupt 39 Tx_CAN0(void){
>
> unsigned volatile char i, buf_num, can_tx_msg[16];
> buf_num = CAN0TFLG;
> CAN0TBSEL = buf_num;
> buf_num = CAN0TBSEL;
>
> can_tx_msg[0]='S';
> can_tx_msg[1]='T';
> can_tx_msg[2]='0';
> can_tx_msg[3]='0';
> can_tx_msg[4]='A';
> can_tx_msg[5]='H';
> can_tx_msg[6]='O';
> can_tx_msg[7]='J';
> can_tx_msg[8]='0';
> can_tx_msg[9]='0';
> can_tx_msg[10]='0';
> can_tx_msg[12]='0';
> can_tx_msg[13]='4';
> can_tx_msg[14]='1';
> *CAN0TXFG = can_tx_msg[0];
> *(CAN0TXFG +1) = can_tx_msg[1];
> *(CAN0TXFG + 2) = can_tx_msg[2];
> *(CAN0TXFG + 3) = can_tx_msg[3];
>
> for(i=0; i > *(CAN0TXFG +i +4) = can_tx_msg[i+4];
> }
> *(CAN0TXFG + 12) = can_tx_msg[12];
>
> *(CAN0TXFG +13) = can_tx_msg[13];
> CAN0TFLG = buf_num;
> //CAN0TIER = buf_num;
> } /*konec preruseni*/

Yes I am sorry my mistake. Thank you very much.
I repair it with right length. But my problem still persist.

Do know please, how I can initialized this interrupt vector?
I am sorry, I am beginner.
Thank you very much.
--- In 6..., "Edward Karpicz" wrote:
>
> > can_tx_msg[12]='0';
>
> '0' is 0x30. Keeping that in mind please look closer at these lines:
>
> > for(i=0; i > > *(CAN0TXFG +i +4) = can_tx_msg[i+4];
> > }
>
> I think this ^^ not only fills CAN0TXFG with your data, but also
overwrites
> all CAN1 module control registers with random data from the stack.
I guess
> some CAN1 interrupts get enabled and CPU jumps to not initialized
CAN1
> interrupt vector.
>
> Edward
> ----- Original Message -----
> From: "ondrej.machek"
> To: <6...>
> Sent: Saturday, November 29, 2008 6:08 PM
> Subject: [68HC12] MSCAN TX interrupt ILLEGAL BP BGND
> > Hello,
> > I would like ask you.
> > I am using interrupt for my transmit MSCAN can0 but at the end,
> > M68evb912DP256 jump to command ILLEGAL BP and asm BGND. Do anybody
> > know please where could be error?
> >
> > Thank you very much to all.
> >
> > void interrupt 39 Tx_CAN0(void){
> >
> > unsigned volatile char i, buf_num, can_tx_msg[16];
> > buf_num = CAN0TFLG;
> > CAN0TBSEL = buf_num;
> > buf_num = CAN0TBSEL;
> >
> > can_tx_msg[0]='S';
> > can_tx_msg[1]='T';
> > can_tx_msg[2]='0';
> > can_tx_msg[3]='0';
> > can_tx_msg[4]='A';
> > can_tx_msg[5]='H';
> > can_tx_msg[6]='O';
> > can_tx_msg[7]='J';
> > can_tx_msg[8]='0';
> > can_tx_msg[9]='0';
> > can_tx_msg[10]='0';
> > can_tx_msg[12]='0';
> > can_tx_msg[13]='4';
> > can_tx_msg[14]='1';
> >
> >
> > *CAN0TXFG = can_tx_msg[0];
> > *(CAN0TXFG +1) = can_tx_msg[1];
> > *(CAN0TXFG + 2) = can_tx_msg[2];
> > *(CAN0TXFG + 3) = can_tx_msg[3];
> >
> > for(i=0; i > > *(CAN0TXFG +i +4) = can_tx_msg[i+4];
> > }
> > *(CAN0TXFG + 12) = can_tx_msg[12];
> >
> > *(CAN0TXFG +13) = can_tx_msg[13];
> > CAN0TFLG = buf_num;
> > //CAN0TIER = buf_num;
> > } /*konec preruseni*/
> >
>