GithubHelp home page GithubHelp logo

Comments (5)

fenugrec avatar fenugrec commented on August 16, 2024

Hi,
currently no, but the stm32F0xx hardware does have a "silent mode" that does exactly that :

In Silent mode, the bxCAN is able to receive valid data frames and valid remote frames, but it sends only recessive bits on the CAN bus and it cannot start a transmission. [...] Silent mode can be used to analyze the traffic on a CAN bus without affecting it by the transmission of dominant bits (Acknowledge Bits, Error Frames).

And there is a "listen-only" flag at the kernel level :

$ ip link set can0 help
Usage: ip link set DEVICE type can
	[ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
....
	[ loopback { on | off } ]
	[ listen-only { on | off } ]
	[ triple-sampling { on | off } ]
	[ one-shot { on | off } ]
	[ berr-reporting { on | off } ]
	[ fd { on | off } ]
	[ fd-non-iso { on | off } ]
	[ presume-ack { on | off } ]
...

So :

  • no, firmware currently can't do it
  • yes, firmware should be able to do it

from candlelight_fw.

fenugrec avatar fenugrec commented on August 16, 2024

Actually I think I was partly wrong, firmware definitely should already support silent mode :

usbd_gs_can.c:393

		case GS_USB_BREQ_MODE:
				..........
					can_enable(ch,
						(mode->flags & GS_CAN_MODE_LOOP_BACK) != 0,
						(mode->flags & GS_CAN_MODE_LISTEN_ONLY) != 0,
						(mode->flags & GS_CAN_MODE_ONE_SHOT) != 0

So I guess one would have to enable listen-only just before bringing interface up . Has anyone tried ?

from candlelight_fw.

brian-brt avatar brian-brt commented on August 16, 2024

I happen to have a test setup handy to try this. Seems like it's working to me FWIW.

I'm using a candleLight on one Linux machine attached to another CAN interface on another Linux machine. The bus just has those 2 devices and a terminator, nothing else.

My test sequence:

  1. Other CAN interface is sending things happily: candump any,0:0,#FFFFFFFF shows frames and no ERRORFRAMEs
  2. Bring the candleLight device down: sudo ip link set brtcan2 down
  3. Now the other device shows lots of ERRORFRAMEs in candump any,0:0,#FFFFFFFF
  4. Put the candleLight device up in listen-only mode: sudo ip link set brtcan2 type can listen-only on && sudo ip link set brtcan2 up
  5. Still lots of ERRORFRAMEs on the other device
  6. Take the candleLight device out of listen-only mode: sudo ip link set brtcan2 down && sudo ip link set brtcan2 type can listen-only off && sudo ip link set brtcan2 up
  7. No more ERRORFRAMEs on the other device

from candlelight_fw.

fenugrec avatar fenugrec commented on August 16, 2024

@brian-brt awesome, thanks for testing! Do I understand correctly that with brtcan2 (candleLight) in listen-only mode, it receives the error frames ? (I'm not sure if both ends are seeing the ERRORFRAMEs or just the sender)

from candlelight_fw.

brian-brt avatar brian-brt commented on August 16, 2024

No, I didn't actually try reading frames from the candleLight device originally. Testing again, the candleLight device does not see any ERRORFRAMEs. When it's not in listen-only mode, it sees all the frames (as expected). In listen-only mode, it sees a single frame being sent repeatedly.

Receiving the non-ACKed frames is what I mentioned in #55 (comment) about listen-only implying presume-ack. I think on a "correct" listen-only device those would all be no-ACK ERRORFRAMEs.

from candlelight_fw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.