M2 Not Working And hate this 15 char limit

No can bus/can tool works with the M2.

Anything I flash to it nothing comes out on serial, like using M2Ret and savvycan nothing is working on any version.

Is there something simple that I can use to see if the thing works?

Thanks.

It’s true that trying to start with M2RET might be a little tough as that’s toward the complicated end of things. One thing to check, does SavvyCAN even say it connected to the M2? That is, do you get it saying that it is connected to two buses or zero? You can also try opening the serial console from the Arduno IDE and see if you can get the help screen to come up. Enable some sort of line ending and then send ? to the board and see if help comes up. If not then something really isn’t going well for you.

Now, here’s a simple sketch you can compile so long as you’ve installed the M2 board files (and you should). If you send it to your board you’ll get all the LEDs scrolling on/off and a simple text message out of the serial USB. If you can run this and you see blinken lights and a message on the serial console then your hardware would seem to be working and you are successfully compiling. That’s the first step. If you can get that far then we can try something more complicated.

int step;

void setup() {
   // Set all the LED pins as outputs
   pinMode(RGB_GREEN, OUTPUT);
   pinMode(RGB_RED, OUTPUT);
   pinMode(RGB_BLUE, OUTPUT);
   pinMode(DS2, OUTPUT);
   pinMode(DS3, OUTPUT);
   pinMode(DS4, OUTPUT);
   pinMode(DS5, OUTPUT);
   pinMode(DS6, OUTPUT);

   step = 0;
}

void loop() {
   digitalWrite(RGB_GREEN, (step == 0)?LOW:HIGH);
   digitalWrite(RGB_RED, (step == 1)?LOW:HIGH);
   digitalWrite(RGB_BLUE, (step == 2)?LOW:HIGH);
   digitalWrite(DS2, (step == 3)?LOW:HIGH);
   digitalWrite(DS3, (step == 4)?LOW:HIGH);
   digitalWrite(DS4, (step == 5)?LOW:HIGH);
   digitalWrite(DS5, (step == 6)?LOW:HIGH);
   digitalWrite(DS6, (step == 7)?LOW:HIGH);
   step = (step + 1) % 8;
   delay(200);  
   if (step == 0) SerialUSB.println("Hello world!");
}

Ok so I flash M2Ret again on the M2 and did a ? on the serial and it display information now.

I see that CAN1LISTENONLY=255 which the other is set to 1. Is that an issue for savvycan to not log any data?

Build number: 339
System Menu:

Enable line endings of some sort (LF, CR, CRLF)

Short Commands:
h = help (displays this message)
R = reset to factory defaults
s = Start logging to file
S = Stop logging to file

Config Commands (enter command=newvalue). Current values shown in parenthesis:

LOGLEVEL=1 - set log level (0=debug, 1=info, 2=warn, 3=error, 4=off)
SYSTYPE=0 - set board type (0=Macchina M2)

CAN0EN=1 - Enable/Disable CAN0 (0 = Disable, 1 = Enable)
CAN0SPEED=500000 - Set speed of CAN0 in baud (125000, 250000, etc)
CAN0LISTENONLY=1 - Enable/Disable Listen Only Mode (0 = Dis, 1 = En)
CAN0FILTER0=0x0,0x0,1,1 (ID, Mask, Extended, Enabled)
CAN0FILTER1=0x0,0x0,1,1 (ID, Mask, Extended, Enabled)
CAN0FILTER2=0x0,0x0,1,1 (ID, Mask, Extended, Enabled)
CAN0FILTER3=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN0FILTER4=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN0FILTER5=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN0FILTER6=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN0FILTER7=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)

CAN1EN=1 - Enable/Disable CAN1 (0 = Disable, 1 = Enable)
CAN1SPEED=125000 - Set speed of CAN1 in baud (125000, 250000, etc)
CAN1LISTENONLY=255 - Enable/Disable Listen Only Mode (0 = Dis, 1 = En)
CAN1FILTER0=0x0,0x0,1,1 (ID, Mask, Extended, Enabled)
CAN1FILTER1=0x0,0x0,1,1 (ID, Mask, Extended, Enabled)
CAN1FILTER2=0x0,0x0,1,1 (ID, Mask, Extended, Enabled)
CAN1FILTER3=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN1FILTER4=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN1FILTER5=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN1FILTER6=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)
CAN1FILTER7=0x0,0x0,0,1 (ID, Mask, Extended, Enabled)

SWCANEN=0 - Enable/Disable Single Wire CAN (0 = Disable, 1 = Enable)
SWCANSPEED=33333 - Set speed of Single Wire CAN in baud (33000, 93000, etc)
SWCANLISTENONLY=1 - Enable/Disable Listen Only Mode (0 = Dis, 1 = En)

CAN0SEND=ID,LEN,<BYTES SEPARATED BY COMMAS> - Ex: CAN0SEND=0x200,4,1,2,3,4
CAN1SEND=ID,LEN,<BYTES SEPARATED BY COMMAS> - Ex: CAN1SEND=0x200,8,00,00,00,10,0xAA,0xBB,0xA0,00
SWSEND=ID,LEN,<BYTES SEPARATED BY COMMAS> - Ex: SWSEND=0x100,4,10,20,30,40
MARK=<Description of what you are doing> - Set a mark in the log file about what you are about to do.

BINSERIAL=1 - Enable/Disable Binary Sending of CANBus Frames to Serial (0=Dis, 1=En)
FILETYPE=3 - Set type of file output (0=None, 1 = Binary, 2 = GVRET, 3 = CRTD)

FILEBASE=CANBUS - Set filename base for saving
FILEEXT=TXT - Set filename ext for saving
FILENUM=1 - Set incrementing number for filename
FILEAPPEND=0 - Append to file (no numbers) or use incrementing numbers after basename (0=Incrementing Numbers, 1=Append)
FILEAUTO=0 - Automatically start logging at startup (0=No, 1 = Yes)

DIGTOGEN=0 - Enable digital toggling system (0 = Dis, 1 = En)
DIGTOGMODE=0 - Set digital toggle mode (0 = Read pin, send CAN, 1 = Receive CAN, set pin)
DIGTOGLEVEL=0 - Set default level of digital pin (0 = LOW, 1 = HIGH)
DIGTOGPIN=1 - Pin to use for digital toggling system (Use Arduino Digital Pin Number)
DIGTOGID=0x700 - CAN ID to use for Rx or Tx
DIGTOGCAN0=0 - Use CAN0 with Digital Toggling System? (0 = No, 1 = Yes)
DIGTOGCAN1=0 - Use CAN1 with Digital Toggling System? (0 = No, 1 = Yes)
DIGTOGLEN=0 - Length of frame to send (Tx) or validate (Rx)
DIGTOGPAYLOAD=0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 - Payload to send or validate against (comma separated list)

Here is my log from the M2 on serial.

Well, I actually don’t know what will happen if it is set to 255 but either way whether you have listen only mode active or not you should be able to receive traffic. It wouldn’t hurt to set it to either 1 or 0 though. Which of the CAN ports are you trying to receive traffic on?

I tryed Can0, Can1 or both active.

You’ve tried both physical ports? What is the proper speed of the CAN bus you are attempting to connect to?

500000 on both ports ill try again today once my laptop gets charged again.

Also tryed using Savvycan 157,168,174

Are you sure you are using a CANBUS vehicle?

I suppose that’s a decent question to ask. Some vehicles don’t expose CAN (most everything pre-2006) and some use odd speeds. Though, 500k is a pretty standard speed at the OBDII port.

Really, it seems like the steepest hurdle everyone faces at first is: “what am I even doing?” Things like speed, which port you are using, whether you’ve got the right pins, etc are all tough at first. For some things you have to worry about termination. Sometimes a wire is broken somewhere. It even happens to me sometimes. The tough part is getting it all set up in the first place. Usually once you’re familiar with all the hardware on both sides it becomes pretty easy to keep going from there.

Perhaps one of the easiest ways to test the M2 equipment itself is to do a loopback test. Connect the two CAN buses at the M2 together high to high, low to low. Then try to send a message out one port and see if you get it on the other. You can do this in M2RET by connecting the two buses and then typing a command like this “CAN0SEND=0x100,1,0x20” and you should get a message on CAN1. Do that in the serial console. If that works then both buses work (be sure to set them both to the same speed and turn off listen only on both buses). Then you should be able to use SavvyCAN to get a graphical view of any CAN traffic you’re capturing.

Found my issue, you all are going to have a great laugh.

I didn’t plug in the M2 all the way in on the OBD port. It works now lol.

Got to love human error, Thanks for the help though :wink:

I’d believe it. Simple things like that are the answer far too often. It doesn’t help that the OBDII connector has extra long ground and power pins so you can push it in far enough to make the M2 wake up but yet still not far enough to get good contact with the CAN pins. Well, I’m glad you got it working. I wish you the best of luck with using it.

Not a big deal. I only asked because I know people who have tried to use a CANBUS sniffer to talk to model year 2000 vehicles… So it is always the first question I ask now…