找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3541|回复: 0
打印 上一主题 下一主题
收起左侧

void IniteCANModule()

[复制链接]
跳转到指定楼层
楼主
ID:75926 发表于 2015-4-4 01:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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因为只有相同id得才能接收。
如果使用id滤波,那么对于增强性ecan模式来说,发送方得id就放在接收邮箱得id标志符里面,网友用程序验证过此结论。
很多人看国外的资料都不是很明白,程序验证后才明白得,这是由于对资料理解的不够透彻,或者翻译资料简单直译产生的不良后果。
在自测试模式下,发送方得id没有放到接收邮箱得id标志符里面。程序烧到flash中和外面得程序通讯才看到确实放在那里。





分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表