latonita / arduino-canbus-monitor

Can bus monitoring tool based on arduino and can bus shield. Implements CAN ASCII/SLCAN protocol compatible with Lawicel CAN232/CANUSB. Can be used for monitoring low speed CAN (interior can bus of most cars, less than 500kbps). For higher speeds serial port can become a bottleneck in case data density is high.
MIT License
306 stars 91 forks source link

Problem with mkr can shields #12

Open yoshilex opened 2 years ago

yoshilex commented 2 years ago

Hello I'm trying to use canhacker with canbus-monitor. I have two boards, an Seeed studio can shield and a MKR GSM with MKR Can shield, and the seeed studio can shield can conect to can hacker without problems but the MKR can shield can't even conect in the can hacker.

I changed the CS and INT pin to 9 and 7 respectively but it don't conect. I'm guessing that SAMD boards have another configuration for RS-232 but I'm not sure.

The reason that I'm trying to use the canhacker in MKR board is the machinery that i'm trying to conect. The seed studio can't read can messages in J1939 but the MKR board can, and I need to trace the can messages.

latonita commented 2 years ago

@yoshilex I checked Arduino's library, it looks like MKR boards use pins 3 and 7.

// Arduino MKR board: MKR CAN shield CS is pin 3, INT is pin 7

Also, check the clock frequency. I dont have MKR boards, but as per documentation it uses 16Mhz crystal.

latonita commented 2 years ago

@yoshilex As for J1939 - this is a data protocol working on top of CAN 2.0b, so any CAN Bus Shield/board will work. In simple words:

What you need is either a program on PC which can work with it, or find library/or DIY/ on Arduino level.

yoshilex commented 2 years ago

@yoshilex I checked Arduino's library, it looks like MKR boards use pins 3 and 7.

// Arduino MKR board: MKR CAN shield CS is pin 3, INT is pin 7

Also, check the clock frequency. I dont have MKR boards, but as per documentation it uses 16Mhz crystal.

Ups, you're right, I misstyped, but in the code the pins are correct. The clock is in 16 MHz as the board, but with the MKR board the canhacker can't conect, it says "CAN Interface not responding!". My board is a MKR GSM 1400.

With the Arduino Uno and the seedstudio can shield, canhacker conects without problems but it don't show messages in the machinery (even with the examples monitors in Arduino IDE, just says "CAN init ok!"), only in cars works ok (canhacker and Arduino Monitors). I tried with and without the internal 120 Resistor and It dont work with machinery.

With the MKR shield, canhacker can't connect (CAN Interface not responding) but Arduino monitors works fine (cars and machinery), I'm trying to filter the IDs but with canhacker is more easier, that's why I'm trying to get work the MKR shield with Canhacker. As I understand, your code implement the LAWICEL v1.3 serial protocol of a CAN232/CANUSB device, and I guess there is something diferent for MKR board to implement the protocol (I'm not sure how)

yoshilex commented 2 years ago

I tried today with the Arduino Uno and the MKR Can Shield and CanHacker works fine with machinery! yay

The problem is the MKR GSM 1400 board

latonita commented 2 years ago

Very strange, for first glance i don't see anything on MKR GSM board which might prevent Can shield to work... Maybe some faulty trace/connection. If you want to hunt down the issue with mkr gsm board - i might recommend to: 1) check gsm board it has proper voltages on +5, +3.3 2) try connect boards with separate wires, not putting whole shield on top - looks like you need to connect both 5v and 3.3v, gnd, miso,mosi,sck,int image