Skip to contentSkip to conversation

Hilfe - Wohin Anfragen bezügl. SocketCAN/FlexCAN

DISCUSSION Marc Kleine-Budde 3 participants 4 messages Apr 15, 2015 1 message not in the archive CAN network drivers

lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines · Markus Uhle

wir benutzen in einem Medizingerät SocketCAN in Verbindung mit FlexCAN (i.MX53 Prozessor).
Ich habe im Broadcastmode (SocketCAN, BCM-Manager) einige Probleme, die ich gerne schildern würde.

Gibt es noch eine aktive Mailing-List für SocketCAN und FlexCAN ? An wen könnte ich mich hier wenden?

Ja und zwar die englischsprachigen Liste [email protected]

Quoted 8 lines

Mein Problem:
- Ich registriere im Broadcastmanager z.B. 20 RTR-Requests, die alle 100ms zyklisch gesendet werden sollen (in einer Funktion, also in Etwa zur gleichen Zeit)
- Am CAN-Bus hängt nur noch die Busterminierung und ein CAN-Sniffer (PeakCAN), der die Messages ack'ed.
- Wenn ich mehr als 12 Messages im BCM registiere, werden alle Messages ab der 13. Message nur noch selten (ca. alle 1-10 Sekunden) gesendet

Ich habe noch nie mit dem Broadcastmanager gearbeitet....

Quoted 11 lines

Ich habe die Linux-Sourcen vom BCM und vom FlexCAN schon angeschaut und finde keine offensichtlichen Fehler.

Meine Vermutung ist, dass wenn ich sehr schnell hintereinander im BCM (SocketCAN) Nachrichten registiere, die zyklisch alle
100ms gesendet werden sollen, dann liegen diese so dicht zusammen, dass die nächste Nachricht eventuell schon gesendet
wird (vom BCM zum FlexCAN), bevor die alte Nachricht über den Bus raus ist. In dem Fall wird die alte Nachricht eventuell abgebrochen. Ich habe im FlexCAN-Treiber keinen Rückgabewert wie "cannot be sent, because I am busy" gefunden.

Das ist richtig, diesen Rückgabewert gibt es nicht, da der Treiber seine TX-Queue anhält, falls er keine Pakete mehr aufnehmen kann. Zur Zeit ist im Flexcan Treiber nur eine Queue mit der Tiefe von einem Paket implementiert. Die Länge der Queue ist per default 10 Pakete. Das könnte Ihre Beobachtung erklären. Vielleicht ist der BCM nicht darauf ausgelegt, dass nicht alle Pakete in der Queue laden.

Ich schlage vor, dass Sie Ihre Problembeschreibung auf die Liste posten und wir dort weiter diskutieren.

Grüße,
Marc Kleine-Budde

Signature · 4 lines
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   |
author maintainer
#2 lore raw
Quoted 9 lines · Marc Kleine-Budde

Das ist richtig, diesen Rückgabewert gibt es nicht, da der Treiber seine TX-Queue anhält, falls er keine Pakete mehr aufnehmen kann. Zur Zeit ist im Flexcan Treiber nur eine Queue mit der Tiefe von einem Paket implementiert. Die Länge der Queue ist per default 10 Pakete. Das könnte Ihre Beobachtung erklären. Vielleicht ist der BCM nicht darauf ausgelegt, dass nicht alle Pakete in der Queue laden.

Ich schlage vor, dass Sie Ihre Problembeschreibung auf die Liste posten und wir dort weiter diskutieren.

Doh! Since I put the mailinglist by accident on Cc I'll recap the problem for the audience.

Markus is using the flexcan on a imx53. He encounters a problem with the broadcast manager. When registering more than 12 messages (to be send every 100ms) at the BCM, the 13th message delayed and only send every 1 to 10 seconds.

I suspect the problem may be related with the default queue length of 10 CAN frames per interface. The BCM might not handle -ENOBUFS correctly.

Markus, try to increase the TX queue length by:

ifconfig can0 txqueuelen 100

or 1000.

Marc

Signature · 4 lines
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   |
#3 lore raw
Quoted 8 lines · Marc Kleine-Budde
Quoted 7 lines · Marc Kleine-Budde

Das ist richtig, diesen Rückgabewert gibt es nicht, da der Treiber seine TX-Queue anhält, falls er keine Pakete mehr aufnehmen kann. Zur Zeit ist im Flexcan Treiber nur eine Queue mit der Tiefe von einem Paket implementiert. Die Länge der Queue ist per default 10 Pakete. Das könnte Ihre Beobachtung erklären. Vielleicht ist der BCM nicht darauf ausgelegt, dass nicht alle Pakete in der Queue laden.

Quoted 5 lines
Quoted 2 lines

Ich schlage vor, dass Sie Ihre Problembeschreibung auf die Liste posten und wir dort weiter diskutieren.

Doh! Since I put the mailinglist by accident on Cc I'll recap the problem for the audience.

:-)

Quoted 6 lines

Markus is using the flexcan on a imx53. He encounters a problem with the broadcast manager. When registering more than 12 messages (to be send every 100ms) at the BCM, the 13th message delayed and only send every 1 to 10 seconds.

Quoted 8 lines

I suspect the problem may be related with the default queue length of 10 CAN frames per interface. The BCM might not handle -ENOBUFS correctly.

Markus, try to increase the TX queue length by:

ifconfig can0 txqueuelen 100

or 1000.

This would be my suggestion too.

The BCM tries to fulfill the TX cycle as precise as possible.
When Markus adds 12/13 TX jobs at a time these jobs are very close to each other from CAN frame duration perspective. So the jobs trigger nearly at the same time, generate a pile-up in the tx queue and the tx frames get dropped.

So you can try to stretch the BCM setup in the way that you don't get pileups:

- at creation time (wait between syscalls)
- by using the two timer values and switch after one frame to the wanted cycle

Or increase the txqueuelen - but you would still have a pile-up of frames which is probably not wanted at the receiver too (processing time issues).

Regards,
Oliver

Quoted 3 lines

Marc

#4 lore raw

Thanks for your suggestions.
I will try to increase txqeuelen first and write the result in the mailing list.

Am 15.04.2015 um 14:45 schrieb Oliver Hartkopp:

Quoted 52 lines · Marc Kleine-Budde
Quoted 8 lines · Marc Kleine-Budde
Quoted 7 lines

Das ist richtig, diesen Rückgabewert gibt es nicht, da der Treiber seine TX-Queue anhält, falls er keine Pakete mehr aufnehmen kann. Zur Zeit ist im Flexcan Treiber nur eine Queue mit der Tiefe von einem Paket implementiert. Die Länge der Queue ist per default 10 Pakete. Das könnte Ihre Beobachtung erklären. Vielleicht ist der BCM nicht darauf ausgelegt, dass nicht alle Pakete in der Queue laden.

Quoted 5 lines
Quoted 2 lines

Ich schlage vor, dass Sie Ihre Problembeschreibung auf die Liste posten und wir dort weiter diskutieren.

Doh! Since I put the mailinglist by accident on Cc I'll recap the problem for the audience.

:-)

Quoted 6 lines

Markus is using the flexcan on a imx53. He encounters a problem with the broadcast manager. When registering more than 12 messages (to be send every 100ms) at the BCM, the 13th message delayed and only send every 1 to 10 seconds.

Quoted 8 lines

I suspect the problem may be related with the default queue length of 10 CAN frames per interface. The BCM might not handle -ENOBUFS correctly.

Markus, try to increase the TX queue length by:

ifconfig can0 txqueuelen 100

or 1000.

This would be my suggestion too.

The BCM tries to fulfill the TX cycle as precise as possible.
When Markus adds 12/13 TX jobs at a time these jobs are very close to each other from CAN frame duration perspective. So the jobs trigger nearly at the same time, generate a pile-up in the tx queue and the tx frames get dropped.

So you can try to stretch the BCM setup in the way that you don't get pileups:

- at creation time (wait between syscalls)
- by using the two timer values and switch after one frame to the wanted cycle

Or increase the txqueuelen - but you would still have a pile-up of frames which is probably not wanted at the receiver too (processing time issues).

Regards,
Oliver

Quoted 3 lines

Marc