arduino-canbus-monitor icon indicating copy to clipboard operation
arduino-canbus-monitor copied to clipboard

Problem with mkr can shields

Open yoshilex opened this issue 2 years ago • 5 comments

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.

yoshilex avatar Feb 26 '22 17:02 yoshilex

@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 avatar Feb 27 '22 15:02 latonita

@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:

  • CAN Shield knows how to send/receive any data over CAN bus.
  • J1939 describes which data to send, so another J1939 device can understand it.

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

latonita avatar Feb 27 '22 16:02 latonita

@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 avatar Mar 01 '22 14:03 yoshilex

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

yoshilex avatar Mar 02 '22 14:03 yoshilex

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

latonita avatar Mar 02 '22 14:03 latonita