thanhhaibk96 / JetsonNano-mcp2515

Jetson Nano communicates with mcp2515 through SPI
6 stars 0 forks source link

the result of 'sudo ip link set can0 type can bitrate 1000000' is 'cannot find device "can0" ', can you tell me how to solve it ? thank you a lot #2

Open DENESTY opened 4 years ago

thanhhaibk96 commented 4 years ago

Hi DENESTY, You can follow these steps in this topic https://forums.developer.nvidia.com/t/jetson-nano-and-mcp2515-can-module/112271/23

thanhhaibk96 commented 4 years ago
  1. Did you configure SPI Pins? https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3231/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fhw_setup_jetson_io.html%23
  2. Use "$ lsmod" --> Do you see "mcp251x" ? If not you can use "insmod mcp251x.ko"
  3. you should use my dtb and dtbo files
  4. https://github.com/thanhhaibk96/Jetson-Nano-Tutorial
DENESTY commented 4 years ago

@thanhhaibk96 Hi thanhhaibk96 Thank you for your help,Before I use the information you provided to find solution. Use the file you provided, through the below steps, whether it should work normally. I have the steps you mentioned,like(1)configure SPI Pin.(2)move the mcp251x.ko to /lib/modules/.../net/can/spi/. (3)move the dtbo to /boot and move the dtb to /boot/dtb .(4)sudo /opt/navida/jetson-io/jetson-io.py to configure .(5)use "lsmod",i can see the mcp251x. (6)sudo ip link set can0 type can bitrate 1000000 -->cannot find device "can0".

thanhhaibk96 commented 4 years ago

Can you show me "$ dmesg|grep mcp251x"? Do you communicate between 2 board mcp2515?

thanhhaibk96 commented 4 years ago

I transfered datas from a mcp2515 to STM32F407, because STM32F407 uses 3.3 voltage reference, but mcp2515 uses IC CAN TJA1050 which uses 5V voltage reference, so I have to replace TJA1050 with SN65HVD23x-HT (https://www.ti.com/lit/ds/symlink/sn65hvd230.pdf?ts=1592626665987&ref_url=https%253A%252F%252Fwww.google.com%252F). I think you should check this one.

DENESTY commented 4 years ago

@thanhhaibk96 z@z:~$ dmesg |grep mcp [ 0.554811] GPIO line 200 (mcp2515_int) hogged as input [ 8.312872] mcp251x: loading out-of-tree module taints kernel. [ 8.324874] mcp251x: Enable DMA

Can you see what the problem is? I only use a mcp2515 to transfered datas to imx6ul . thanks you a lot.

thanhhaibk96 commented 4 years ago

@DENESTY mcp251x.ko is OK, You try checking your hardware. Maybe problem is ic can TJA1050 on MCP2515

DENESTY commented 4 years ago

@thanhhaibk96 Hi thanhhaibk96 Can you send and receive data normally? In my device, Data can only be sent once ,and automatically send data once when can0 down. can't accept data. when rmmod mcp251x and insmod mcp251x.ko, then set can0 up ,it is RTNETLINK answers :Invalid argument. Can you see what the problem is? thanks you a lot.

thanhhaibk96 commented 3 years ago

I have already improved somwthing in the code, you can check it ..... https://github.com/thanhhaibk96/JetsonNano-mcp2515/tree/master/mcp2515_driver_v3