找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 3817|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

void IniteCANModule()

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:75926 發(fā)表于 2015-4-4 01:50 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
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濾波,那么對(duì)于增強(qiáng)性ecan模式來說,發(fā)送方得id就放在接收郵箱得id標(biāo)志符里面,網(wǎng)友用程序驗(yàn)證過此結(jié)論。
很多人看國外的資料都不是很明白,程序驗(yàn)證后才明白得,這是由于對(duì)資料理解的不夠透徹,或者翻譯資料簡單直譯產(chǎn)生的不良后果。
在自測(cè)試模式下,發(fā)送方得id沒有放到接收郵箱得id標(biāo)志符里面。程序燒到flash中和外面得程序通訊才看到確實(shí)放在那里。





分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表