TI中文支持网
TI专业的中文技术问题搜集分享网站

F280049库函数编程CAN通信只想使能发送中断如何实现。

Other Parts Discussed in Thread:C2000WARE

CAN通信中断使能只能提供 了一个函数

static void CAN_enableInterrupt ( uint32_t base, uint32_t intFlags )
CAN_INT_ERROR – a controller error condition has occurred
CAN_INT_STATUS – a message transfer has completed, or a bus error has been detected
CAN_INT_IE0 – allow CAN controller to generate interrupts on interrupt line 0
CAN_INT_IE1 – allow CAN controller to generate interrupts on interrupt line 1
1、使能IE0意思是所有CAN中断分配到IE0即CAN0INT了?
2、如果只想使能发送中断,不想使能接收中断如何实现
3、发送中断分配到CAN0INT,接收中断分配到CAN1INT如何实现。
4、如果用寄存器编程,CAN的寄存器名称叫什么,就是CAN寄存器那个总的共用体名字。
谢谢帮忙。
主要问题还是库函数不够细致,无法实现复杂的用户自定义,寄存器编程又没例程,连寄存器名字都没公开。好难,比03难用。请提供更多例程。
Susan Yang:

user4675816 说:CAN通信中断使能

您可以看一下

//*****************************************************************************
//
//! Setup a Message Object
//!
//! \param base is the base address of the CAN controller.
//! \param objID is the message object number to configure (1-32).
//! \param msgID is the CAN message identifier used for the 11 or 29 bit
//!identifiers
//! \param frame is the CAN ID frame type
//! \param msgType is the message object type
//! \param msgIDMask is the CAN message identifier mask used when identifier
//!filtering is enabled
//! \param flags is the various flags and settings to be set for the message
//!object
//! \param msgLen is the number of bytes of data in the message object (0-8)
//!
//! This function sets the various values required for a message object.
//!
//! The \e frame parameter can be one of the following values:
//! - \b CAN_MSG_FRAME_STD - Standard 11 bit identifier
//! - \b CAN_MSG_FRAME_EXT - Extended 29 bit identifier
//!
//! The \e msgType parameter can be one of the following values:
//! - \b CAN_MSG_OBJ_TYPE_TX- Transmit Message
//! - \b CAN_MSG_OBJ_TYPE_TX_REMOTE- Transmit Remote Message
//! - \b CAN_MSG_OBJ_TYPE_RX- Receive Message
//! - \b CAN_MSG_OBJ_TYPE_RXTX_REMOTE - Receive Remote message with
//!auto-transmit
//!
//! The \e flags parameter can be set as \b CAN_MSG_OBJ_NO_FLAGS if no flags
//! are required or the parameter can be a logical OR of any of the following
//! values:
//! - \b CAN_MSG_OBJ_TX_INT_ENABLE- Enable Transmit Interrupts
//! - \b CAN_MSG_OBJ_RX_INT_ENABLE- Enable Receive Interrupts
//! - \b CAN_MSG_OBJ_USE_ID_FILTER- Use filtering based on the Message ID
//! - \b CAN_MSG_OBJ_USE_EXT_FILTER- Use filtering based on the Extended
//!Message ID
//! - \b CAN_MSG_OBJ_USE_DIR_FILTER- Use filtering based on the direction of
//!the transfer
//! - \b CAN_MSG_OBJ_FIFO- Message object is part of a FIFO
//!structure and isn't the final message
//!object in FIFO
//!
//! If filtering is based on message identifier, the value
//! \b CAN_MSG_OBJ_USE_ID_FILTER has to be logically ORed with the \e flag
//! parameter and \b CAN_MSG_OBJ_USE_EXT_FILTER also has to be ORed for
//! message identifier filtering to be based on the extended identifier.
//!
//! \note The \b msgLen Parameter for the Receive Message Object is a "don't
//!care" but its value should be between 0-8 due to the assert.
//!
//! \return None.
//
//*****************************************************************************
extern void
CAN_setupMessageObject(uint32_t base, uint32_t objID, uint32_t msgID,CAN_MsgFrameType frame, CAN_MsgObjType msgType,uint32_t msgIDMask, uint32_t flags, uint16_t msgLen);
//! This indicates that transmit interrupts should be enabled, or are enabled.
#define CAN_MSG_OBJ_TX_INT_ENABLECAN_IF1MCTL_TXIE

user4675816 说:如果用寄存器编程,CAN的寄存器名称叫什么,就是CAN寄存器那个总的共用体名字。

这个建议您参考28377的can通信程序(两者都是DCAN):\C2000Ware_3_03_00_00\device_support\f2837xd\examples\cpu1\can_loopback_bitfields

另外请参考该应用手册

,

user4675816:

通信上了,万分感谢。

,

Susan Yang:

很高兴您能解决问题!后续有其他问题,欢迎随时发新帖,谢谢!

赞(0)
未经允许不得转载:TI中文支持网 » F280049库函数编程CAN通信只想使能发送中断如何实现。
分享到: 更多 (0)