CANopenNode / CanOpenSTM32

CANopenNode on STM32 microcontrollers.
Other
275 stars 110 forks source link

More than four event-driven TPDOs #33

Closed jgooday closed 1 year ago

jgooday commented 1 year ago

I can't seem to get more than four TPDOs transmitting using event timers (TPDO type 254). Currently I have five TPDOs defined with the following COBs:

(0x40000180, 0x40000280, 0x40000380, 0x40000480, 0x40000181)

I can transmit any four of them on a timer (type=254) with one not transmitting (type=0). When I try to add the fifth (regardless of which one it is) I get an emergency message: Error code: Communication - CAN overrun (objects lost) (0x8110)

image

I've tried increasing the timers, adding 10ms inhibit on each one, or varying the timers of each TPDO (thinking it would be a network buffer problem) but to no avail. I've had lots of data transmitting on the same hardware in the past successfully over CAN FD.

I'm running this on an STM32G4 and have largely just copy-pasted the example driver. Is this error a limitation of the default CanOpenSTM32 driver only being able to transmit four TPDOs? Or have I got something wrong with my configuration?

Any help much appreciated!! TIA from CANOpen newbie

jgooday commented 1 year ago

Not sure if this is related to https://github.com/CANopenNode/CanOpenSTM32/issues/23?

Ashenoneq commented 1 year ago

It looks very similar to my issue.

jgooday commented 1 year ago

Problem fixed. I realised that the issue was in fact a transmission buffer error, identical to what is described here: https://github.com/CANopenNode/CANopenNode/issues/74 I implemented this patch: https://github.com/iurly/CANopenNode/commit/6349ea6d1dfdb01031bac829d5fd1698df26a242 It was just a coincidence that the error would happen when I used more than four TPDOs, and wasn't due to a limitation of the driver

Ashenoneq commented 1 year ago

Thank you for sharing. I also think we should need a fifo queue.