標(biāo)題: void IniteCANModule() [打印本頁]

作者: xiaos    時(shí)間: 2015-4-4 01:50
標(biāo)題: void IniteCANModule()
Hi all,


I'm using TMS320F28335 eZDSP.
I program a code that use CANa to receive messages in Mailbox31 (0-15TX,
16-31RX). also I handle with the DSP/BIOS interrupt for the CANa module
(PIEACK.Group9.6 - ECAN1IntA).
I "build" a little CAN net: canAnalyzer --- eZDSP ----- CANKing

my problem is: I sending a NMT message to the net and I've got the interrupt,
but when i sending again I don't get any interrupt at all why?

I'm using the defualt TI setting for the CAN module and I add this code also for
setting the CANa module.

The code is:
void IniteCANModule()
{

// eCAN control registers require read/write access using 32-bits.  Thus we
// will create a set of shadow registers for this example.  These shadow
// registers will be used to make sure the access is 32-bits and not 16.
   struct ECAN_REGS ECanaShadow;

InitECanGpio();//from TI examples
InitECan();//from TI examples
/*Configure MSGID*/
ECanaMboxes.MBOX31.MSGID.all = 0;

/*Configure Acceptance Mask*/
ECanaLAMRegs.LAM31.all = 0x1FFFFFFF;//Don't care

/*Configure Mailboxes  */
// Configure Mailboxes 0-15 as Tx, 16-31 as Rx
ECanaShadow.CANMD.all = ECanaRegs.CANMD.all;
ECanaShadow.CANMD.all = 0xFFFF0000;//Mailbox31 defined as a receive mailbox
ECanaRegs.CANMD.all = ECanaShadow.CANMD.all;

/*Configure Mailbox protected*/
ECanaShadow.CANOPC.all = ECanaRegs.CANOPC.all;
ECanaShadow.CANOPC.bit.OPC31 = 0;//the message can be overwritten
ECanaRegs.CANOPC.all = ECanaShadow.CANOPC.all;

ECanaMboxes.MBOX31.MSGCTRL.bit.DLC = 8;

/*Enable Mailboxes*/
ECanaShadow.CANME.all = ECanaRegs.CANME.all;
ECanaShadow.CANME.all = 0xFFFFFFFF;//Enable all Mailboxes
ECanaRegs.CANME.all = ECanaShadow.CANME.all;

  EALLOW;

//configuration for interrupt handling
ECanaRegs.CANMIM.all = 0xFFFFFFFF; //16-31 mailboxes interrupt are enabled
ECanaRegs.CANMIL.all = 0xFFFFFFFF; //mailbox interrupt level (mapped to
eCAN1INT line lower priority CPU line 0)
ECanaRegs.CANGIM.all = 0x00002E06;

PieCtrlRegs.PIEIER9.bit.INTx6 = 1;  // Enable INTx.6 of INT9 (eCAN1INT)

EDIS; // Disable EALLOW protected register access

}

Please help me with this interrupt issue.
Thanks.


Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video
Transcoding Solution for Commercial & Consumer End Equipment:
www.ti.com/dm6467

ecan接收id的問題
如果在不使用濾波的情況下,基本不用考慮id因?yàn)橹挥邢嗤琲d得才能接收。
如果使用id濾波,那么對于增強(qiáng)性ecan模式來說,發(fā)送方得id就放在接收郵箱得id標(biāo)志符里面,網(wǎng)友用程序驗(yàn)證過此結(jié)論。
很多人看國外的資料都不是很明白,程序驗(yàn)證后才明白得,這是由于對資料理解的不夠透徹,或者翻譯資料簡單直譯產(chǎn)生的不良后果。
在自測試模式下,發(fā)送方得id沒有放到接收郵箱得id標(biāo)志符里面。程序燒到flash中和外面得程序通訊才看到確實(shí)放在那里。










歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1