Hi I am using following script and python code to receive data. I am getting data from micro controller and also connect it with a CAN to USB converter to monitor data. At converter software I am getting correct data but at Orin NX I am getting some garbage data. See screen shorts. When I send the data from laptop (CAN to USB converter) to Orin then it work properly but not from microcontroller. Please help to solve this…
########################################################
#!/bin/bash
sudo busybox devmem 0xc303000 32 0x0000c400
sudo busybox devmem 0xc303008 32 0x0000c450
sudo modprobe can
sudo modprobe can-raw
sudo modprobe mttcan
sudo ip link set can0 up type can bitrate 500000 #cangen can0 -v #candump can0
exit 0
######################################################### python code
import the library
import can
import time
import sys
create a bus instance
many other interfaces are supported as well (see below)
while i<100:
bus.send(message, timeout=0.5)
print(“\nMessage send count=”,i)
i=i+1
time.sleep(500/1000)
“”"
iterate over received messages
for msg in bus:
print(“{:X}: {}”.format(msg.arbitration_id, msg.data))
# or use an asynchronous notifier #notifier = can.Notifier(bus, [can.Logger(“recorded.log”), can.Printer()]) #print(notifier)
#bus.shutdown()
sys.exit()
##########################################################
Link for Python code…
Jetpack version is 5.1 and sorry, at both side the bitrate is 125kbps. As I told that on laptop I am able to receive data from Orin and microcontroller both but at orin side I am not able to receive data of microcontroller. When I transmit data frame from laptop it is received correctly. All of then are connected by CAN bus with termination resistance of 120ohm at microcontroller and Orin transceiver.
Thanks I will check with command and as you ask I try with different value of Tseg1 and Tseg2 register at 351, 41 it work also but suppose there are 10 frames transmitted then 6 come shows as error frame rest 4 received correctly. On this basis I think it is bitrate problem.
Hi, try with IP link command and I am getting this–
tel_orin3@tel-orin3-desktop:~/Desktop/can_test$ ip link set can0 up type can bitrate 125000 dbitrate 125000 berr-reporting on
RTNETLINK answers: Operation not permitted
I try almost every thing which is given in this link…
Hi,
Please tell how to remove this…
tel_orin3@tel-orin3-desktop:~/Desktop/can_test$ ip link set can0 up type can bitrate 125000 dbitrate 125000 berr-reporting on RTNETLINK answers: Operation not permitted
It is possible to check the CAN frame directly on terminal? I don’t to apply any filter or rejection of frame due to error. Just want to check the frames
Please see the attached images. The device ID 64 is received on the orin nx without error but ID-304 is not receiving and giving error. So please help me to solve this
Here as you can see in third image the frame error is come but after that it is again transmitted (second image)successfully but not received on orin. I put logic analyzer on CAN-rx pin of orin nx. There it show some garbage data.
In first image the frame is ok and received correctly.
tel_orin3@tel-orin3-desktop:~/Desktop/can_test$ python3 testcanbus.py
testcanbus.py:12: DeprecationWarning: The ‘bustype’ argument is deprecated since python-can v4.2.0, and scheduled for removal in python-can v5.0.0. Use ‘interface’ instead.
bus = can.interface.Bus(bustype=‘socketcan’, channel=‘can0’, bitrate=125000)
After this I again run “p -s -d link show can0”
tel_orin3@tel-orin3-desktop:~/Desktop/can_test$ ip -s -d link show can0
9: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 40 prop-seg 87 phase-seg1 87 phase-seg2 25 sjw 1
mttcan: tseg1 2…255 tseg2 0…127 sjw 1…127 brp 1…511 brp-inc 1
mttcan: dtseg1 1…31 dtseg2 0…15 dsjw 1…15 dbrp 1…15 dbrp-inc 1
clock 50000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 3 133 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
13048 1631 0 0 0 0
TX: bytes packets errors dropped carrier collsns
800 100 0 0 0 0
After this I send frame only from microcontroller and run the command “candump -x any &”
I am getting this…
tel_orin3@tel-orin3-desktop:~/Desktop/can_test$ candump -x any &
[2] 4926
1)As you ask for the block diagram.
2) There is no error packet from microcontroller to “USB CAN converter” all packet are received correctly.
3)Yes presently issue is with sending packet from microcontroller are not received correctly on orin
What ever send on can bus is received on USB to CAN converter (from microcntroller and orin). But problem is between Orin and Mirocontroller.
PLease see this for more clarity–All device are connected as shown in figure.
Thanks for your information and sharing the test result.
How about the result of “USB to CAN converter” to Micorconteoller?
Could you share the result of ip -s -d link show can0 on your STM32 microcontroller?
I would like to check its bitrate, sample-point and configuration of other CAN parameters.