I've trying some diagnostics over my ECU and for that, I need to send a particular message at every 50ms. I am using MCP2515 CAN BUS module and raspberry pi for communication. The problem is, when the program is initialised it works fine. But after few moments it gives the error,"Transmit Buffer Full". I tried to fix it by increasing the txqueuelen
to 20000 but still I'm getting the same response.I have even tried the command bus.flush_tx_buffer
that I found on a website but it seems that it is not working. I have been working over this for past two weeks and searched everywhere on the internet and couldn't find appropriate solution. Please help me out on this. I am using python-can 3.3.4 library for this project.
Here is my code:
bus = can.interface.Bus(channel = channel, bustype = bustype, bitrate = 500000)
s_msg = can.Message(arbitration_id=0x1860, data = [0x15, 0x40, 0x26, 0x90, 0x46, 0x78, 0x53, 0x79], is_extended_id=False)
i=0
while i > 0:
bus.send(s_msg)
print(s_msg)
r_msg = bus.recv()
print(r_msg)
print(i)
time.sleep(0.05)
bus.flush_tx_buffer()
Here is the response when I ran ip -details -statistics link show can0
can0: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 20000 (UNSPEC)
RX packets 2266 bytes 18128 (17.7 KiB)
RX errors 0 dropped 2266 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0