CAN-Bus verliert Pakete

  • Hallo zusammen,


    Ich habe folgende Probleme und dachte ich informier mal drüber. Vielleicht gibt es auch andere mit selbigen Problemen.
    Oder jemand der dies bei ähnlichen Aufgabemn nicht beobachtet hat und mir dies dann auch mitteilen will.


    Verwenden tu ich emlix Professional:


    • wenn ich z.B. 10 Pakete mit 8 datenbytes im Abstand von ca. 160us (so schnell ich es halt mit meiner CAN Karte rausbekomem) abschicke, sehe ich nur die 3 ersten und das letzte Paket sicher. dazwischen fehlen mehr alsd 50% der Pakte
    • Dies passiert auch bei 500kBit und 250kBit. Und - natürlich - auch, wenn DLC = 0 (also keine Daten) im Paket sind
    • Die baudrate lässt sich in einem startscript - direkt nach dem laden des modules - nicht setzten
    • Liegt auf dem CAN Bus ein Paket mit anderer Baudrate (500kBit oder 1MBit) an und der Bus ist auf z.B. 250k eingestellt bleibt das System beim aufruf con ifconfig can0 up hängen. Es geht erst weiter, wenn der andere teilnehmer auf die gleiche Baudarte eingestellt wird.
    • bei 125kBit und auf dem Bus und 1Mit Einstellung via baud rate set gibt es einen kernel opps (siehe ende des posts)


    Für mich wäre das ein KO Kriterium für das Modul. Aber irgendwei kann ich nicht glauben dass das wirklich so ist.


    Heinz


  • Was auch noch interessant - und da spreche ich natürlich F&S hauptsächlich an - wäre ist die Frage ob es bei bestimmten Baudraten auch unter Windows CE Verluste gibt.


    Was passiert bei 1Mbit mit DLC=0 (höchte denkbare Paketrate)? Bekommt eine Applikation alle Pakete?


    Heinz

  • We are mostly using the MCP2515 CAN controller on our boards. This controller is connected via SPI to the main CPU. As a conseqeunce, the performance of the CAN transmission is dependent on the performance of the SPI transmission. Under Windows CE we therefore can operate the CAN controller on the PicoCOM1 in two modes: indirectly via the SPI driver and with direct SPI access.


    1. Via SPI driver
    In this mode the CAN driver accesses the CAN controller by issuing calls to the SPI driver. This is the only way if there are other SPI devices connected to the SPI bus, as the SPI driver guarantees a correct synchronization of all SPI accesses. However using this additional SPI driver layer generates some overhead that reduces the CAN performance.


    2. Direct SPI access
    In this mode the CAN driver directly accesses the SPI bus by generating the SPI messages itself. Of course this only will work if there is no other device on the SPI bus than the CAN controller. By bypassing the SPI driver, this access method is more efficient, increasing the CAN performance.


    As far as we know emlix only implemented method 1 under Linux on the PicoCOM1. So there may be some issues with CAN there.


    In addition the SPI transfer on the Atmel controller used on the PicoCOM1 can not exceed 7 MHz and always needs to use DMA. Usually DMA is a good solution for fast transfers, but when regarding the short messages that need to be transferred to the CAN controller, the overhead for setting up DMA for each of these transfers is bigger than the gain from the fast transfer itself. Therefore this combination is not optimal.


    Our newer PicoCOM boards PicoCOM3 and PicoCOM4 use another micro controller, where the SPI transmission can be much faster. On one hand, the basic SPI rate can be up to the maximum 10 MHz that the MCP2515 is capable of. And the overhead is also less because the SPI uses a FIFO where all messages fit into. So there is no need for using DMA, reducing all the DMA setup overhead. And these boards use a newer kernel version too, where some of the issues of the Linux CAN driver are already fixed.


    In the end we would recommend PicoCOM3 or PicoCOM4 if you really need fast CAN transmission. But if CAN transmission can also happen at lower speeds, PicoCOM1 may still be suited well enough.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.