linklayer / cantact-pro-fw

Firmware for the CANtact Pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

5Mbps data bitrate not working

normaldotcom opened this issue · comments

Not sure if this is an issue with the Cantact Pro firmware or the gs_usb_fd driver, but I can't generate a 5mbit CANFD data bitrate. I haven't tested this extensively, hopefully I can do some more testing soon.

Test case:

  • CANtact Pro with CAN0 connected to CAN1
  • Both interfaces brought up with the same bitrates:
    • 1Mbps standard bitrate
    • 5Mbps data bitrate
  • Using gs_usb_fd driver at your latest commit linklayer/gs_usb_fd@76af2fd

Result:
Repeated TX of packet that does not appear to have anything in the data portion of the packet, after some attempts it appears to give up on TXing packets that are not ACKed.

Scope Shot
SDS00001

Have you successfully tested other/slower data bitrates on the cantact yet?
Assuming you probed CAN_L it seems that the "receiving" CAN node is destroying the transmit by sending an error frame.
More details are harsh to see due to bad screen representation.
FD without BRS works?

Hey @normaldotcom,

I've changed the clocking of the CAN cores in the CANtact, they are now clocked with 40 MHz not 24 MHz. If you want to test it. This procedure works for me, hopefully you will not brick your device:

  • unplug
  • press and hold the button next to USB connector
  • plug USB

Now the light should be quite dimm. The device should show up as an USB mass storage device:

  • mount USB mass storage
  • make a copy of the firmware.bin in a secure place (that's the original FW)
  • erase the firmware.bin
  • extract the attached firmware.zip somewhere else (e.g. /tmp)
  • copy the new firmware.bin to the mounted USB mass storage
  • unmount
  • unplug + plug form USB

You can check with ip if the new firmware is active:

$ ip -details -statistic link show can0
9: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 minmtu 0 maxmtu 0
    can state ERROR-ACTIVE restart-ms 1000
          bitrate 500000 sample-point 0.875
          tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
          gs_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
          gs_usb: dtseg1 1..16 dtseg2 1..8 dsjw 1..4 dbrp 1..1024 dbrp-inc 1
          clock 40000000

The new firmware has a clock of 40000000 the original one uses 24000000.

          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          0          0          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    RX: bytes  packets  errors  dropped missed  mcast
    0          0        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    0          0        0       0       0       0

firmware.zip