summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorzhangguoqing <zhangguoqing@acoinfo.com>2019-08-05 02:34:01 (GMT)
committer zhangguoqing <zhangguoqing@acoinfo.com>2019-08-05 02:34:14 (GMT)
commit82506eea1cb24b0702df5aec48d0b3d7ab981f97 (patch)
tree4647c93294971478e14ded4b6b7d5fe6ccb84bd0
parent7197f6d705d1fa1d8182bf80202c7212011f9cb2 (diff)
downloadbspam335x-master.zip
bspam335x-master.tar.gz
bspam335x-master.tar.bz2
1.Fixed can remote frame bug.HEADmaster
-rw-r--r--SylixOS/driver/can/am335x_can.c1
-rw-r--r--SylixOS/driver/can/dcan_frame.c9
-rw-r--r--SylixOS/driver/can/dcan_frame.h1
3 files changed, 8 insertions, 3 deletions
diff --git a/SylixOS/driver/can/am335x_can.c b/SylixOS/driver/can/am335x_can.c
index e8ff67d..def8f05 100644
--- a/SylixOS/driver/can/am335x_can.c
+++ b/SylixOS/driver/can/am335x_can.c
@@ -258,6 +258,7 @@ static INT __am335xCanStartup (CAN_CHAN *pcanchan)
dcanFrame.data = (UINT *)auiData;
} else {
dcanFrame.data = LW_NULL;
+ dcanFrame.flag |= CAN_RTR_FLAG;
}
API_InterVectorDisable(pCanChan->CANCHAN_ulVector); /* ر CAN ж */
diff --git a/SylixOS/driver/can/dcan_frame.c b/SylixOS/driver/can/dcan_frame.c
index a6b4e53..ccd8a22 100644
--- a/SylixOS/driver/can/dcan_frame.c
+++ b/SylixOS/driver/can/dcan_frame.c
@@ -79,9 +79,12 @@ void CANTxObjectConfig(unsigned int baseAdd, can_frame* canPtr)
/* Set the message id of the frame to be transmitted */
DCANMsgIdSet(baseAdd, canPtr->id, idLen, DCAN_IF1_REG);
- /* Set the message object direction as transmit */
- DCANMsgDirectionSet(baseAdd, DCAN_TX_DIR, DCAN_IF1_REG);
-
+ /* Set the message object direction as transmit */
+ if(canPtr->flag & CAN_RTR_FLAG){
+ DCANMsgDirectionSet(baseAdd, DCAN_RX_DIR, DCAN_IF1_REG);
+ } else {
+ DCANMsgDirectionSet(baseAdd, DCAN_TX_DIR, DCAN_IF1_REG);
+ }
/* Set the data length code */
DCANDataLengthCodeSet(baseAdd, canPtr->dlc, DCAN_IF1_REG);
diff --git a/SylixOS/driver/can/dcan_frame.h b/SylixOS/driver/can/dcan_frame.h
index c0a78de..f2c0616 100644
--- a/SylixOS/driver/can/dcan_frame.h
+++ b/SylixOS/driver/can/dcan_frame.h
@@ -42,6 +42,7 @@ extern "C" {
#define CAN_EXT_FRAME (0x00000004u)
#define CAN_MSG_DIR_TX (0x00000010u)
#define CAN_MSG_DIR_RX (0x00000020u)
+#define CAN_RTR_FLAG (0x40000000U)
/* Total No. of message objects available in the DCAN message RAM */
#define CAN_NUM_OF_MSG_OBJS (64u)