Hi Sukkin,
this might be it; I found this description in the user manual...
Table 320. CAN Command Register (CAN1CMR - address 0x4004 4004, CAN2CMR - address 0x4004 8004) bit
description
4[1][6] SRR Self Reception Request. 0 0
0 (absent) No self reception request.
1 (present) The message, previously written to the CANxTFS, CANxTID, and
optionally the CANxTDA and CANxTDB registers, is queued for
transmission from the selected Transmit Buffer and received
simultaneously. This differs from the TR bit above in that the receiver is
not disabled during the transmission, so that it receives the message if its
Identifier is recognized by the Acceptance Filter.
[1] - Setting the command bits TR and AT simultaneously results in transmitting a message once. No re-transmission will be performed in
case of an error or arbitration lost (single shot transmission).
- Setting the command bits SRR and TR simultaneously results in sending the transmit message once using the self-reception feature.
No re-transmission will be performed in case of an error or arbitration lost.
- Setting the command bits TR, AT and SRR simultaneously results in transmitting a message once as described for TR and AT. The
moment the Transmit Status bit is set within the Status Register, the internal Transmission Request Bit is cleared automatically.
- Setting TR and SRR simultaneously will ignore the set SRR bit.
[6] Upon Self Reception Request, a message is transmitted and simultaneously received if the Acceptance Filter is set to the corresponding
identifier. A receive and a transmit interrupt will indicate correct self reception (see also Self Test Mode in Section 16–7.1 “CAN Mode
register (CAN1MOD - 0x4004 4000, CAN2MOD - 0x4004 8000)”).
I haven't tried changing it though so you would be the first to try this :-)
If you look in the CAN section of the this header file you will find names for these addresses:
http://mbed.org/projects/libraries/svn/mbed/trunk/LPC1768/LPC17xx.h
This is how I change the CAN speed for 615 k/bit:
LPC_CAN2->BTR = 0x370002;
I guess you will do something similar with the 'CMR' register:
LPC_CAN2->CMR = 0xCafeBabe; // obviously change CafeBabe to what ever you need it to be, and use LPC_CAN1 for the other CAN interface
Hope this helps,
Sophie x
I’m trying to following the CanBusExample1 at
http://mbed.org/projects/cookbook/wiki/CanBusExample1
The mbed is connected a MPC2551 Can transceiver. My Can network consist of the mbed and a car ECU.
I’ve modified the send() function so that it sends out a 0x7df 0x02 0x01 0x0c message which is a request of the engine’s rpm.
The problem is from the serial message I’m seeing two Rx messages. The first message is the Tx message somehow echoed back. The second message is the correct message reply from the ECU.
Below is the serial log:
CanTx--> id: 0x200 dlc: 1 data: 4a
CanRx--> id: 0x7df dlc: 8 data: 2 1 c 0 0 0 0 0
CanRx--> id: 0x7e8 dlc: 8 data: 3 41 c 0 48 0 0 0
CanTx--> id: 0x200 dlc: 1 data: 4b
CanRx--> id: 0x7df dlc: 8 data: 2 1 c 0 0 0 0 0
CanRx--> id: 0x7e8 dlc: 8 data: 3 41 c 0 30 0 0 0
Ignore the CanTx id, I’ve not updated the prinft.
With a CanBus analyzer I can only see one Rx message which is correct.
The question is how come can2.read() function returns a 1 to indicate a message has arrived but it is from the Tx message that was just send?
Any ideas?