On 07/19/2011 11:08 PM, Oliver Hartkopp wrote:

[...]

>>> IIRC, loopback is really done in hardware and the driver is
>>> working properly on ARM processors.
>> 
>> See:
>> 
>> https://lists.berlios.de/pipermail/socketcan-core/2010-June/004432.html
>
>> 
> Yes, but i'm pretty sure Marc mixed up the hardware loopback of the
> FlexCAN controller with the IFF_ECHO requirement. The FlexCAN spec
> says:

No - the datasheet distinguishes between:

1) loopback, as you quoted the datasheet:

> "Loopback mode — The module enters this mode when the LPB bit in the
> control register is set to 1. In this mode, FlexCAN performs an
> internal loopback that can be used for self test operation. The bit
> stream output of the transmitter is internally fed back to the
> receiver input. The Rx CAN input signal is ignored and the Tx CAN
> output goes to the recessive state (logic ‘1’). FlexCAN behaves as it
> normally does when transmitting and treats its own transmitted
> message as a message received from a remote node. In this mode, 
> FlexCAN ignores the bit sent during the ACK slot in the CAN frame
> acknowledge field to ensure proper reception of its own message. Both
> transmit and receive interrupts are generated."
> 
> This means the "Rx CAN input signal is ignored" => only self test.

ACK - the relevant lines from the driver:
        if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
                reg |= FLEXCAN_CTRL_LPB;


2) and self reception - which is used to implement the IFF_ECHO:

> bit 17 of MCD - SRX_DIS:
> 
> This bit defines whether FlexCAN is allowed to receive frames
> transmitted by itself. If this bit is set to 1, frames transmitted by
> the module are not stored in any message buffer, regardless if the
> message buffer is programmed with an ID that matches the transmitted
> frame, and no interrupt flag or interrupt signal is generated due to the
> frame reception.
> 
> 0 Self reception enabled
> 1 Self reception disabled

The funny thing is you have to disable self reception, it's enabled by
default.


However - it turned out in a discussion here (or on -developers) some
time ago that the IFF_ECHO via self reception has a drawback. The
information that the rx'ed packet is a IFF_ECHO'ed one gets lost.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to