question

vassilis-bourdakis avatar image
vassilis-bourdakis asked

canbus -> Network Status -> ERROR-ACTIVE on raspberry pi 3B+ & rpi4. system works fine!

good morning,


was meant to ask that long ago but saw on another forum others having the same issue so thought I better ask:

rpi3B+ running VenusOS Large 2.73 now various incarnations of 2.80. Waveshare CANHAT connected to N2K network on boat, all working fine for a year. Data from N2K bus visible on rpi, SignalK sends them to an offsite influxDB, visualised by grafana. Similarly, Venus data passes on the N2K network visualised on Garmin MFD and 4in multidisplays.

Testing now diyBMS (using a PEAKCAN USB controller) BMS visible on Venus, data passes through Venus to N2K visible on MFDs.

So, all is fine, but both devices come up with this ERROR-ACTIVE and empty cells on comms data. Am I missing something (terminations or whatever) or this feature never worked on a raspberry?

Mind diyBMS has termination on the bms side and USB controller plugged into the rpi, so cannot see what could be missing term wise.


1640422495492.png

1640422455750.png


Note if something's wrong and comms die, I get an ERROR-PASSIVE on the screen. That's when I'm testing/editing config.txt etc. Never in normal operation.

ideas welcomed!

cheers

V.

Raspberry PiVE.Can
1640422455750.png (15.2 KiB)
1640422495492.png (43.5 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

5 Answers
bathnm avatar image
bathnm answered ·

Have you checked the Linux system? Are the interfaces working at that layer. Does candump show any traffic?

Is it a dual port HAT? I have noticed in mine that the labelled port of can0 in the OS is can1 and visa Verda. If you have one at 250kb and the other at 500kb this could be causing part of the problem.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vassilis-bourdakis avatar image
vassilis-bourdakis answered ·

candump indeed shows traffic on both can0 and can1.

further this is happening since last Jan with just one CAN/RS485 Waveshare HAT doing the N2K comms and working fine.

Same with the second PeakCAN USB at 500kbit/s for the diyBMS.

Must be something more esoteric :(

cheers


V.



2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bathnm avatar image
bathnm answered ·

so what is the output of 'ip -details -statistics link show can#'

I get the following

root@Venus:~# ip -details -statistics link show can0

3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100

link/can promiscuity 0 minmtu 0 maxmtu 0

can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100

bitrate 250000 sample-point 0.875

tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1

sun4i_can: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1

clock 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 overrun mcast

591048754 73882581 5 0 5 0

TX: bytes packets errors dropped carrier collsns

99894349 12587949 0 0 0 0


Check that the bitrate is correct. It maybe a mapping between the kernel view of can0 / can1 and the Cerbo. If so take a look at /etc/venus/canbus_ports and the mapping.

Maybe also take a look at VeCanSetup

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vassilis-bourdakis avatar image
vassilis-bourdakis answered ·

thanks for the help, getting wiser little by little :-)

can0 is N2K, can1 is diyBMS, both working, system up for less than a day and not much going around in N2K bus:

N2K:

root@raspberrypi2:~# ip -details -statistics link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100
    link/can  promiscuity 0 minmtu 0 maxmtu 0
    can state ERROR-ACTIVE restart-ms 100
          bitrate 250000 sample-point 0.833
          tq 333 prop-seg 4 phase-seg1 5 phase-seg2 2 sjw 1
          mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
          clock 6000000
          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 overrun mcast
    73433      13086    0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    3362280    424470   0       0       0       0

BMS:

root@raspberrypi2:~# ip -details -statistics link show can1
5: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100
    link/can  promiscuity 0 minmtu 0 maxmtu 0
    can state ERROR-ACTIVE restart-ms 100
          bitrate 500000 sample-point 0.875
          tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
          pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
          clock 8000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          8          25         0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    RX: bytes  packets  errors  dropped overrun mcast
    4853442    701066   6       0       6       0
    TX: bytes  packets  errors  dropped carrier collsns
    1123120    140390   0       0       0       0

config.txt has one entry for the Waveshare CAN HAT:

dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000

/etc/venus/canbus_ports looks odd:

can0
can1
can0
can1

yes, one empty line on top and then 4records... cleared it leaving just two lines can0 and can1 rebooted, no difference...

I just noticed that on can0 (waveshare) I can see the 12MHz crystal on the chip, I have it configured as such on config.txt, but ip command implies it's using 6MHz. Tried to edit config.txt to 6MHz for a test, ip now reports can0 as running a 3MHz clock and I lost connection completely-doesn't work. So looks like that clock reported on ip -details is half of what is configured? makes sense?

Other than that, all seem quite similar to yours!

BTW, what does the screen look like in yours?

any other ideas to test?


cheers


V.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bathnm avatar image bathnm commented ·

If you search the web, there is a command tor hang the oscillator through the 'ip' command. Cant remember the parameters.

Please note that this is on a Cerbo (latest 2.80 beta) and not RPI. I do not have my RPI running at the moment with VenusOS.

1640538209929.png

0 Likes 0 ·
1640538209929.png (114.2 KiB)
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Fwiw: error active means “error checking is active”. Its the best state.

3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vassilis-bourdakis avatar image vassilis-bourdakis commented ·
lol, that's a very misleading abbreviation indeed!!!

Maybe you should consider changing State to:

ERROR-CHECKING-ACTIVE


do you happen to have any idea why same setup wont show RX TX info on rpi (although as posted data are all there)?

cheers

V.

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ vassilis-bourdakis commented ·
There are many canbus drivers that don’t count certain stats. That could explain it


0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mvader (Victron Energy) ♦♦ commented ·

perhaps I should add this; our code doesn’t count these stats. Our code transmits & receives data to & from the canbus.

And the page you’re looking at there, as well as ifconfig, gets stats that are counted (or not) from the (linux) driver.

0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic

Raspberry Pi running Victron’s Venus firmware - Blog Post

Venus OS Large image: Signal K and Node-RED - Install

raspberrypi install venus image


Additional resources still need to be added for this topic