0
\$\begingroup\$

How can I establish continuous polling, or continuous remote requests on a canbus at a reasonable rate?

Goal: A can node WSMSTR (Working Set Master) regularly acquires data from its can node WSMEMs (Working Set Members)

  • Can Node Chip: ATSAME51J20
  • Can Node Driver: Atmel Studio, generated code
  • rate 125Kbs
  • Measured bus resistance: 60 Ohms

Polling scenario, whereby a canbus node polls other canbus nodes:

(1632995180.666754)  can0  1CEF9190   [1]  02                        '.'
(1632995180.666756)  can0  1CEF9091   [3]  02 00 00                  '...'
(1632995180.716530)  can0  1CEF9390   [1]  02                        '.'
(1632995180.716532)  can0  1CEF9093   [3]  02 00 00                  '...'
(1632995180.766269)  can0  1CEF9290   [1]  02                        '.'
(1632995180.766271)  can0  1CEF9092   [3]  02 00 00                  '...'

Here is a picture of a good get-response pair, on a scope:

enter image description here

Overtime the messages self-organise into priority order:

(1632994469.912247)  can0  1CEF9390   [1]  02                        '.'
(1632994469.962113)  can0  1CEF9290   [1]  02                        '.'
(1632994470.011905)  can0  1CEF9190   [1]  02                        '.'
(1632994470.011907)  can0  1CEF9091   [3]  02 00 00                  '...'
(1632994470.011908)  can0  1CEF9093   [3]  02 00 00                  '...'
(1632994470.013080)  can0  1CEF9092   [3]  02 00 00                  '...'

enter image description here

Remote request scenario, whereby a canbus node requests data from other canbus nodes:

(1632996886.909444)  can0  1CEFFF92   [1]  02                        '.'
(1632996886.909445)  can0  1CEF9290   [3]  02 00 00                  '...'
(1632996886.909446)  can0  1CEF9291   [3]  02 00 00                  '...'
(1632996886.910624)  can0  1CEF9293   [3]  02 00 00                  '...'

enter image description here

Overtime the messages self-organise into priority order:

(1632997693.570200)  can0  1CEFFF92   [1]  02                        '.'
(1632997693.570203)  can0  1CEF9290   [3]  02 00 00                  '...'
(1632997693.619900)  can0  1CEFFF92   [1]  02                        '.'
(1632997693.619902)  can0  1CEF9290   [3]  02 00 00                  '...'
(1632997693.669595)  can0  1CEFFF92   [1]  02                        '.'
(1632997693.669596)  can0  1CEF9290   [3]  02 00 00                  '...'
(1632997693.669597)  can0  1CEF9293   [3]  02 00 00                  '...'
(1632997693.670812)  can0  1CEF9290   [3]  02 00 00                  '...'
(1632997693.670813)  can0  1CEF9291   [3]  02 00 00                  '...'
(1632997693.670813)  can0  1CEF9293   [3]  02 00 00                  '...'
(1632997693.671931)  can0  1CEF9290   [3]  02 00 00                  '...'

enter image description here

Note: in these tests I am not checking the response. When I do check for responses, comms will hang, without a timeout & reset mechanism.

Note: the log messages do not correspond to the scope images. Scope pictures are merely taken when the desired behaviour and undesired behaviour is taking place.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ I think you mean "continual" polling. \$\endgroup\$
    – Andy aka
    Sep 30 at 10:55
  • 2
    \$\begingroup\$ @Andyaka As, Im shore your our aware, English ain't a formal language. I mean to use "continuous". You seem like a intelligent individual, so I am shore you our able to infer the exact intended meaning of thee word due to tha context it is us'd. Kind Regards. \$\endgroup\$ Sep 30 at 11:12
  • \$\begingroup\$ Where is the question? This looks fine to me. 50 ms is okay if not too many nodes. (eg: j1939 says 100ms shortest) \$\endgroup\$
    – Jeroen3
    Sep 30 at 11:32
  • \$\begingroup\$ English can be a formal and an informal language as, I'm sure, all languages can be. The correct word is continual or sometimes contiguous. \$\endgroup\$
    – Andy aka
    Sep 30 at 12:01
  • \$\begingroup\$ @Jeroen3 The question is on the first line. The explanation of why I am asking, follows. I have switch to streaming WSMEM values. Streaming the values works fine as the priorities do not conflict with any desired FIFO sequence of messages. If it is a fundamental aspect of canbus that FIFO message ordering can be overridden by bus priority, I will have to switch to streamed outputs. A question that derives from the reasoning for asking my question, is : "Do canbus priorities mean that FIFO buffers, at the application layer, cannot function as FIFO buffers?" \$\endgroup\$ Sep 30 at 12:07
2
\$\begingroup\$

If you application not fast enough to receive 3 consecutive messages then you're going to need to write better software, or not send the remote request in such short window.

Application layer FIFO is irrelevant, you can change that to work however you want.

Harware layer CAN bus has an "overwrite" setting, in both receive and transmit.
CAN bus hardware either works with mailboxes, fifo buffers or prioritized fifo buffers. The latter is are often configurable. See F0OM FIFO 0 Operation Mode

It looks like the ATSAME51J20 has both, 64 messageboxes and two FIFO's. But you have to setup the filters.

\$\endgroup\$
2
  • \$\begingroup\$ Please read the question, and what follows. Application layer FIFO is not maintained. I want to know why, and how to work around it if I can. I suspect It's due to an ACK error causing a retransmission, but I am not a CAN expert. \$\endgroup\$ Oct 2 at 11:30
  • \$\begingroup\$ @ChristianLacdael Your logs show no CAN bus errors, just some arbitration retries because you're sending all the RTR's at once and all the nodes want to send their stuff. If you're too slow handing the received message interrupt, you're going to lose some unless you specify with the filters a specific messagebox. None of what you show is happening at the CAN bus level is wrong or weird. \$\endgroup\$
    – Jeroen3
    Oct 2 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.