Giter Site home page Giter Site logo

Cannot clear TX Buffer of CAN. about can-utils HOT 7 OPEN

MattJmt avatar MattJmt commented on August 15, 2024
Cannot clear TX Buffer of CAN.

from can-utils.

Comments (7)

marckleinebudde avatar marckleinebudde commented on August 15, 2024

In both of your outputs (ifconfig and ip) the txqueuelen is 10, to proper set the txqueuelen use:

/sbin/ip link set can0 txqueuelen 1000 up type can bitrate 1000000 dbitrate 8000000 restart-ms 1000 berr-reporting on fd on

Are you actually using CAN-FD with a data bitrate of 8 Mbit/s?

The TX errors will not "disappear" as they are cumulative counters. Completely removing the device driver or a reboot will.

You have enabled bit error reporting, use candump any,0~0,#FFFFFFFF -cexdtA to show and decode any bit errors on the bus.

If your devices goes into ERROR_PASSIVE there's something wrong on the bus. Can you send me a candump any,0:0,#FFFFFFFF -cexdtA of normal traffic, when your python code is running and communicating the the drives. Which CAN-IDs are you using to communicate with the drives? Which CAN-ID are they using to answer back?

from can-utils.

MattJmt avatar MattJmt commented on August 15, 2024

I modified the /etc/network/interfaces as you suggested:

auto can0
iface can0 inet manual
        pre-up /sbin/ip link set can0 down
        pre-up /sbin/ip link set can0 txqueuelen 1000 up type can bitrate 1000000 dbitrate 8000000 restart-ms 1000 berr-rep>
        up /sbin/ip link set can0 up
        down /sbin/ip link set can0 down

Running ifconfig at boot now correctly shows
image

Trying cangen candump leads to the same error message of "write : No buffer space available". This was with the Power Supply on for the motors. However, after rebooting, this time turning on the motor's power supply only once the RPi is on, cangen candump works (despite the TX errors).

image

Was a txqueuelen = 65536 too high?

For setting the bitrate to 8 MBit/s I followed what was indicated on their setting up page.

This is my candump can0 when running the python script (when it works):

image

These are the codes I use to communicate with the CAN:

class TMOTOR_SPECIAL_CAN_CODES:
    ENABLE_CAN_DATA  = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC] # Enables the motor
    DISABLE_CAN_DATA = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD] # Disables the motor
    ZERO_CAN_DATA    = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE] # Sets current position to zero

The CAN_IDs I use for the motors are 3 and 4. For the bus communication:

        filters = [{"can_id": 0x000, "can_mask": 0x7FF, "extended": False}]
        self.bus = Bus(channel="can0", bustype="socketcan", can_filters=filters, bitrate=1000000)

        filters = [{"can_id": 0x003, "can_mask": 0x7FF, "extended": False}]
        self.bus = Bus(channel="can0", bustype="socketcan", can_filters=filters, bitrate=1000000)

from can-utils.

marckleinebudde avatar marckleinebudde commented on August 15, 2024

Was a txqueuelen = 65536 too high?

No, don't know why this doesn't for for you.

For setting the bitrate to 8 MBit/s I followed what was indicated on their setting up page.

You should look at the datasheet of your drive, if they use CAN or CAN-FD and configure you raspi accordingly.

Can you send me a candump any,0:0,#FFFFFFFF -cexdtA of normal traffic, when your python code is running and communicating the the drives.

There's CAN-ID 000, 003 and 004 on this bus. Please tell me who is sending these CAN-IDs.

from can-utils.

MattJmt avatar MattJmt commented on August 15, 2024

This is what I get from candump any,0:0,#FFFFFFFF -cexdtA

image

The motors being different versions, one has CAN_ID = 3 / 0x003 in the filters, whilst the other has CAN_ID = 4 / 0x000 in the filters.

from can-utils.

marckleinebudde avatar marckleinebudde commented on August 15, 2024

I see CAN-ID 003 as RX and TX. Does doesn't look good. You cannot send the same CAN-ID from different CAN controllers.

from can-utils.

MattJmt avatar MattJmt commented on August 15, 2024

That is simply the way this motor is setup... I will see if I can change it but not sure.

from can-utils.

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.