cancel
Showing results for 
Search instead for 
Did you mean: 

Can interrupt mode for the STR73x

bdobbelaar
Associate
Posted on November 23, 2007 at 06:39

Can interrupt mode for the STR73x

2 REPLIES 2
bdobbelaar
Associate
Posted on July 19, 2007 at 07:05

I am using the STR73x, ive tried CAN code in software library and i ve confirmed polling mode works fine, but i failed in interrupt mode. I am not sure if this code does some thing at all. No messages send.

Thanks

void CAN0_Demo_Interrupt(void)

{

CAN_InitTypeDef CAN0Init;

CAN0Init.CAN_Mask = CAN_CR_IE;

CAN0Init.CAN_Bitrate = CAN_BITRATE_125K;

// initialize the interrupt controller

EIC_IRQChannelConfig(CAN0_IRQChannel, ENABLE);

EIC_IRQChannelPriorityConfig(CAN0_IRQChannel, 1);

EIC_IRQCmd(ENABLE);

// initialize the CAN at a standard bitrate, interrupts enabled

CAN_Init(CAN0, &CAN0Init);

// switch into Loopback+Silent mode (self-test)

CAN_EnterTestMode(CAN0, CAN_TESTR_LBACK | CAN_TESTR_SILENT);

// configure the message objects

CAN_InvalidateAllMsgObj(CAN0);

CAN_SetTxMsgObj(CAN0, CAN0_TX_MSGOBJ, CAN_STD_ID);

CAN_SetRxMsgObj(CAN0, CAN0_RX_MSGOBJ, CAN_STD_ID, 0, CAN_LAST_STD_ID, TRUE);

// send a pre-defined data frame

(void)CAN_SendMessage(CAN0, CAN0_TX_MSGOBJ, &TxCan0Msg[0]);

// reception and release are done in the interrupt handler

wait();

// switch back into Normal mode

CAN_LeaveTestMode(CAN0);

// disable interrupts globally

EIC_IRQCmd(DISABLE);

}

basvandijk86
Associate II
Posted on November 23, 2007 at 06:39

Does it work at the moment? I am trying to get it work myself but so far no good result. I am used to work with NXP and I think ST didn't document it all so well. Very hard to find what I am searching for. I prefer to write my own values to the registers not to fill in some functions in which I don't know exactly what will be set and what not.

You can also contact me at basvandijk86[at]gmail[dot]com