Stand alone OBC/PDModule EV system Can 2015 - SOLVED

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
You need a high voltage source, 12 volts, the 12 volt battery connection, not the ignition and 12 volt ground.
Not sure how the interlocks I wired on that but you will need the the interlock looped back that goes to the battery pack. You of course will also need the J1772 connections 2 power and 2 signal.

Check out these posts for more detail : https://www.mynissanleaf.com/viewtopic.php?p=611502#p611502

and here is a great diagram of a Gen1 system :https://www.mynissanleaf.com/viewtopic.php?p=579534#p579534
and this one is the OBC : https://www.mynissanleaf.com/viewtopic.php?p=582017#p582017


Good luck
 
49thdiver said:
If you hook the can hacker up to the charger/pdm, when you plug and unplug the J1772 you should see can message x679 coming from the charger to the VCM to tell the VCM its just been plugged in and again when you unplug it. That will tell you that your connections to the charger are good. The charger also broadcasts x390 and x393 every 100ms when the charger is on. I imagine the Gen1 charger has similar functionality if not the same commands.

I'm not 100% certain my CAN reader is giving me the correct info as it sometimes freezes but this is what I'm seeing.

This is the from Charger with all connections made to the PDM

WcWyP08.jpg


This is what I see with the charger CAN connected to the Due CAN. In both cases nothing happens when I plug in the granny charger.

bOghZIy.jpg


And this is how I have it set up on my garage floor.

RqB5YOj.jpg



49thdiver said:
You need a high voltage source, 12 volts, the 12 volt battery connection, not the ignition and 12 volt ground.
Not sure how the interlocks I wired on that but you will need the the interlock looped back that goes to the battery pack. You of course will also need the J1772 connections 2 power and 2 signal.

Check out these posts for more detail : https://www.mynissanleaf.com/viewtopic.php?p=611502#p611502

and here is a great diagram of a Gen1 system :https://www.mynissanleaf.com/viewtopic.php?p=579534#p579534
and this one is the OBC : https://www.mynissanleaf.com/viewtopic.php?p=582017#p582017


Good luck

Thanks for this. I have already found all of these posts and they were really helpful in understanding the wiring (especially the wiring diagram) but even after connecting it all I'm not getting any joy.
The DC-DC is working charging the 12V battery and the BMS is working and connecting to Leafspy so the charger is the missing piece. To be honest I have only just got the DC-DC and BMS working after several months working on it and I am desperate to get everything into the car so I will only work on this for a little while longer. It would be nice to make the charger work but I can't afford to spend too much time on it and I have other options.
 
Alibro said:
This is what I see with the charger CAN connected to the Due CAN. In both cases nothing happens when I plug in the granny charger.

bOghZIy.jpg

You are using a 2013-2017 BMS (evident by the 100ms 0x5BC message). Not sure if this BMS is compatible with your current 2011-2012 setup, the content of the BMS is quite different. Take a look at the EV-CAN for ZE0 and AZE0 to see all the differences. Apart from the content diffs, some messages are transmitted more often (0x5BC every 100ms instead of 500ms)

Might not be relevant, but in a normal LEAF it is not possible to retrofit a 2013+ battery without a translator tool.
 
Great Observation Dala, indeed the two generations of BMS are very different.
f you want to test the charger you need to isolate the can bus on the charger, you DO NOT need to use the bms or inverter to test the charger. Once you know it is working you can start to integrate the other components. See below.

Just looking at your photo more closely I can see you must be in the UK or somewhere that has a 220v power. So it's pretty late. for you.
Lets set up a time to talk send me a PM. In the mean time. I offer the following.
The Can messages look great !
You are probably getting conflicts with the can messages from the inverter and other components. the will mess up there nissan error checking CRC.

I would suggest disconnecting the can bus from everything else and only have the due connected to the OBC/PDM.

Once you have those disconnected get the canhack going with the due turned off, battery on but ignition off. You should see no messages.
Next plug in the granny charger, you should see a single message that indicates that granny is plugged in. When you unplug it you will see a similar single message. That tells you the plug detection is working.

If you are not seeing these then something is not connected properly. If you are seeing these. Unplug granny and turn on the due, you will see the due messages. Then plug in Granny and it should work if it is going to. If not see what additional messages there are from the obc/pdm once you plug it in. There should be at a minimum 0x390,0x393.

I note that I see 0x380,0x5bf in one of your screen shots that might be coming from the charger as I do not generate them nor do I see them in the data base of known CAN messages.
 
Dala said:
Alibro said:
This is what I see with the charger CAN connected to the Due CAN. In both cases nothing happens when I plug in the granny charger.

bOghZIy.jpg

You are using a 2013-2017 BMS (evident by the 100ms 0x5BC message). Not sure if this BMS is compatible with your current 2011-2012 setup, the content of the BMS is quite different. Take a look at the EV-CAN for ZE0 and AZE0 to see all the differences. Apart from the content diffs, some messages are transmitted more often (0x5BC every 100ms instead of 500ms)

Might not be relevant, but in a normal LEAF it is not possible to retrofit a 2013+ battery without a translator tool.

Hi Dala
I feel privileged I have Dala the great corresponding. :lol:

The BMS came from from a guy in Southern Ireland so I don't know the history of it. Here are a couple of photos.

SHTAKke.jpg

8BSm4P4.jpg


As you can see it has all white connectors which I believe means something and the car details are written on it. I thought 11MY meant 11 model year but not really sure.
This lot is destined for my Freelander so will never see the inside of a Leaf (or eGolf for the batteries) again. I wanted the BMS and DC-DC for my conversion and the Charger would have been nice too.

I thought I had taken photos of the CAN with the BMS disconnected but just in case I took more today.

This is the CAN coming from the charger with nothing else connected.
wwt7Njh.jpg


This is the CAN from the Due
QoMFABp.jpg


And this is with them all connected.
5g2S84p.jpg


It's not really relevant to this thread but I can't help myself as I was so pleased to get this working, this is a screen shot from Leafspy showing the battery voltages.
aNrLygL.png


Anyone know how long it would take for the BMS to balance them? I left it on overnight and next day saw no difference.

Thanks for the offer of help, I get nothing when I plug in the granny charger so maybe something isn't connected properly like you suggest. I'll have another look and get back to you.
 
The 380 and 5bf messages are not coming from the Due, it is not programmed to send them. There must be something else connected.You mus have the charger connected with the due. I found this on the forum.

Charging Status - pilot signal

We need an indication that there is a pilot signal (i.e.; the charge cable has been connected and the EVSE is offering power). At the moment we are using 0x5bf D3 != 0 AND D4 != 0. It seems to work ok.

Charging Status - car is charging, charge limit, line voltage, charge current

We need an indication of if the charging is in progress, and if it is what voltage and current are being provided by the wall.

Currently, for charge status (charging or not), we are using the same as the pilot signal (0x5bf D3 != 0 AND D4 != 0). For charge completion, as well as looking for EV-CAN bus data to tell us the charge has completed, we're also looking at a timeout of 10 seconds with no EV-CAN bus activity (car has gone to sleep, so charging must have completed).

at this link : https://mynissanleaf.com/viewtopic.php?p=380402#p380402
 
Thanks again.
I have family commitments this weekend so will not get time to look at i again until next week but I'll report back again when I can..
 
So I managed to grab a few minutes to look at this again tonight and made a discovery. It looks like I had connected the two sense wires at the charge port the wrong way round because after swapping them around I now have the Power light on and see a change in the CAN when I connect the granny charger.
I didn't have time to do much more and it is still not charging but it is a small step further

Here is a quick vid showing the CAN
https://www.youtube.com/shorts/e_Q53oTyKKI
https://imgur.com/Bgf7Pt9
 
than h
Looking good, clearly the gen 1 message from the obd is different than the ones from the gen 2.
I do not see the due messages, but
i am guessing you do not have it connected or powered. The good news is there are no other messages from anything else. Let me know what happens when you get the due hooked up. you should see the 11a, 1d4 etc messages.
 
Sorry I should have posted this clip too.
https://youtube.com/shorts/g-Ksf69OuPc?feature=share
https://imgur.com/Ynfc4vP

I am seeing the 11a and 1d4 messages you mentioned.

Note I was rereading your last posts and noticed you mentioned 380 and 5BF. Your right they are not from the Due but are from the charger itself.
 
Hi All, I will admit I have not trawled through all the latest updates on this thread so sorry if I dont answer stuff correctly for everyone.

I have the gen2 leaf pdm charging, and there are many steps to getting it to work, and ill be honest some of the steps might not actually be needed - but I have tested most parts and I think this is about the minimum required...

Firstly I have the BMS, PDM/Charger and Inverter all connected on the same CanBus. In the actual Leaf they are not connected that way - but I am pretty sure that some components in the Leaf bridge commands between the Buses - so if you remove the ECU for example you lose some bridging. So connect them all together so they can chat.

This process wont activate the HV relays, I have a separate system for that. But you will need the HV relays engaged otherwise you cannot get power to the batteries.

For me, I need to send out 1F2 and 11A for the charger to kick in. 1D4 I send for the inverter (mainly torque request) - not sure if that is required to charge but I send it anyway. All three sent every 10ms.

50B I send every tenth of a second (inverter keep alive) - again not sure if charging needs that.

I wont go into the breakdown of each array below, but you need to know each part (lots of information here will tell you), you need to understand the CRC, and the counters need to sync otherwise it can be a bit problematic.

byte send1F2[8] = {0x30, 0xA0, 0x20, 0xAC, 0x00, 0x3C, 0x00, 0x87};
byte send50B[7] = {0x00, 0x00, 0x06, 0xc0, 0x00, 0x00, 0x00};
byte send11A[8] = {0x4e, 0x40, 0x00, 0xaa, 0xc0, 0x00, 0x00, 0x00};
byte send1D4[8] = {0x6e, 0x6e, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00};
byte repeating11A[4][2] = {
{0xaa, 0xc0},
{0x55, 0x00},
{0x55, 0x40},
{0xaa, 0x80},
};

Hope that fills in some blanks for anyone still struggling, here is my car with the FULL nissan leaf stack in use.

https://youtu.be/wogwaVu73Rs

Dave
 
I've been re-reading this thread and came across this post from #TrueSoln on page 5 where he talks about success in getting the Gen1 OBC working. Unfortunately I'm rubbish with Arduino programming and have not been able to get this code to compile.
Is it even a complete sketch or just part of a bigger chunk of code? There doesn't seem to be anything more about it after this post.

TrueSoln said:
I just kept the code simple for number sequence, and seem that I was getting the charger to turn on.

Still have to work out actual pattern but below is what I used for code on an UNO
I look at the logs for a charge from MUX and Damien
ID 50B is same message during the whole charge (Every 100ms)
ID 1D4 & ID 1F2 Both come from VCM also and need to be simulated. (Every 10ms)


1D4 and 1F2 do still need to work out what it all means
But on Byte[5] of 1D4 seem to be control value

//F7 07 00 04 87 46 E0 64
//F7 07 00 04 C7 46 E0 A3
//F7 07 00 04 07 46 E0 6F
//F7 07 00 04 47 46 E0 A8
//- Every 10ms
uint8_t 1d4_incremental_counter = 0;
byte SendSignal_0x1d4()
{
byte messageData[8] = {0xf7, 0x07,0x00,0x04,0x00,0x46,0xe0,0x00 };

byte seqCtr[4] = {0x87, 0xc7,0x07, 0x45 };
messageData[4] = seqCtr[1d4_incremental_counter];

// Set the CRC and send
nissan_crc(messageData, 0x85);

1d4_incremental_counter++;
if (1d4_incremental_counter >= 4)
1d4_incremental_counter = 0;

return SendCanMessage(0x1d4, 0, 8, messageData);
}

//30 64 20 00 00 82 00 0B
//30 64 20 00 00 82 01 0C
//30 64 20 00 00 82 02 0D
//30 64 20 00 00 82 03 0E
//- Every 10ms
uint8_t counter_1f2 = 0;
byte SendCanMessage_1f2()
{
byte messageData[8] = { 0x30, 0x64, 0x20, 0x00, 0x00, 0x82, 0x00, 0x00 };

byte seqCtr[4] = {0x0b, 0x0c,0x0d, 0x0e };

//- Sets the sequence
messageData[6]=counter_1f2;
messageData[7] = seqCtr[counter_1f2];

counter_1f2++;
if(counter_1f2 >= 4)
counter_1f2 = 0;

//- Not sure if a CRC or Just a sequence pattern
//nissan_crc(messageData, 0x85);

return SendCanMessage(0x1f2, 0, 8, messageData);
}

//- Every 100ms
void Send50bMessage()
{
byte gen1_MessageData[6] = {0x00, 0x00, 0x00, 0xc0, 0x00, 0x00 }; // While charging
byte sndStat = CAN_OK;

return SendCanMessage( 0x50b,0, 6, gen1_MessageData);
}

When I try to compile this in Arduino IDE it stops at the first line with the following error

can-usb:6:9: error: expected unqualified-id before numeric constant

uint8_t 1d4_incremental_counter = 0;

Any advice would be very much appreciated.
 
Those are just code snippets of the program that is written into the "loop" section; there is a header section called "setup" that you must also have in order to do anything in arduino.

The setup section has statements such as include and define, etc that configure the chip and system for your circuit; the loop section has the specific code to do the unique task you desire.

i would recommend to examine and run some of the examples that you can pull down from the menu tabs to see some code examples and understand the 2 sections or blocks of code used by arduino and how that all works. Once you get the basics down then you will be able to copy and paste his code to one of your sketches. Good luck it is fun to do once you get the hang of it.
 
nlspace said:
Those are just code snippets of the program that is written into the "loop" section; there is a header section called "setup" that you must also have in order to do anything in arduino.

The setup section has statements such as include and define, etc that configure the chip and system for your circuit; the loop section has the specific code to do the unique task you desire.

i would recommend to examine and run some of the examples that you can pull down from the menu tabs to see some code examples and understand the 2 sections or blocks of code used by arduino and how that all works. Once you get the basics down then you will be able to copy and paste his code to one of your sketches. Good luck it is fun to do once you get the hang of it.
Thanks for your reply, you've confirmed what I was thinking.
I may give that a go at some stage but I think I'm getting to the point where the charger is holding me back from getting on with the project. I'll spend a little more time working through Peters code to see if I can incorporate some of this into it but I want my car driving this summer so I cant spend too long on it.
 
BillAinCT said:
uint8_t 1d4_incremental_counter = 0;

A variable name cannot start with a digit. Add an _ to the variable name.

Thanks, however it is still not working code as it throws up other errors when I tried.

Earlier today I tried running the CAN messages mentioned in a MCP1525 example like nlspace suggested but still no joy. It looks like the CAN is working but I'm not certain about the timing. I ended up using three Uno's at the same time to get the three CAN ID's running together. I don't have time to post photos or code now but I'll get it up later.
 
OK guys, sorry for the delay getting back but I ran into issues when the CAN suddenly stopped showing. I spent hours faffing about changing just about everything when it suddenly occurred I should turn everything off and check the resistance across the CAN network. It was around 8kR so there was no terminating resistors anywhere. I have no idea how it had been working previously but after enabling two terminators all was good with around 60 ohms.
These are the sketches I loaded onto three Uno's. I know this is really really bad programming but as I said earlier I haven't a clue and this seemed to be the easiest way to get something transmitting. I happen to have several Uno's and MP2512 modules so why not? :?
Here is a photo of the setup, three Uno's to send CAN and one off screen to read it into Canhacker.

HzbpjQc.jpg

If you zoom in on the photo it has 0x36 showing but this was a mistake I sorted later.

I used this to give me 0x50b every 100mS

Code:
#include <SPI.h>
#include <mcp2515.h>

struct can_frame canMsg1;
// struct can_frame canMsg2;
MCP2515 mcp2515(10);


void setup() {
  canMsg1.can_id  = 0x50b;
  canMsg1.can_dlc = 6;
  canMsg1.data[0] = 0x00;
  canMsg1.data[1] = 0x00;
  canMsg1.data[2] = 0x00;
  canMsg1.data[3] = 0xc0;
  canMsg1.data[4] = 0x00;
  canMsg1.data[5] = 0x00;
  //canMsg1.data[6] = 0xBE;
  //canMsg1.data[7] = 0x86;

 // canMsg2.can_id  = 0x036;
 // canMsg2.can_dlc = 8;
 // canMsg2.data[0] = 0x0E;
 // canMsg2.data[1] = 0x00;
 // canMsg2.data[2] = 0x00;
 // canMsg2.data[3] = 0x08;
 // canMsg2.data[4] = 0x01;
 // canMsg2.data[5] = 0x00;
 // canMsg2.data[6] = 0x00;
 // canMsg2.data[7] = 0xA0;
  
  while (!Serial);
  Serial.begin(115200);
  
  mcp2515.reset();
  mcp2515.setBitrate(CAN_500KBPS);
  mcp2515.setNormalMode();
  
  Serial.println("Example: Write to CAN");
}

void loop() {
  mcp2515.sendMessage(&canMsg1);
 // mcp2515.sendMessage(&canMsg2);

  Serial.println("Messages sent");
  
  delay(100);
}

This to give me 0x1d4 although I was a bit confused about the timing. TrueSoln said it should be every 10mS but is 10mS between each bit of CAN or all 8 inside 10mS. Can anyone say If I'm doing this right or not?

Code:
#include <SPI.h>
#include <mcp2515.h>

struct can_frame canMsg1;
struct can_frame canMsg2;
struct can_frame canMsg3;
struct can_frame canMsg4;
struct can_frame canMsg5;
struct can_frame canMsg6;
struct can_frame canMsg7;
struct can_frame canMsg8;

MCP2515 mcp2515(10);


void setup() {
  canMsg1.can_id  = 0x1d4;
  canMsg1.can_dlc = 8;
  canMsg1.data[0] = 0xf7;
  canMsg1.data[1] = 0x07;
  canMsg1.data[2] = 0x00;
  canMsg1.data[3] = 0x04;
  canMsg1.data[4] = 0x87;
  canMsg1.data[5] = 0x46;
  canMsg1.data[6] = 0xe0;
  canMsg1.data[7] = 0x64;

  canMsg2.can_id  = 0x1d4;
  canMsg2.can_dlc = 8;
  canMsg2.data[0] = 0xf7;
  canMsg2.data[1] = 0x07;
  canMsg2.data[2] = 0x00;
  canMsg2.data[3] = 0x04;
  canMsg2.data[4] = 0xc7;
  canMsg2.data[5] = 0x46;
  canMsg2.data[6] = 0xe0;
  canMsg2.data[7] = 0xa3;

  canMsg3.can_id  = 0x1d4;
  canMsg3.can_dlc = 8;
  canMsg3.data[0] = 0xf7;
  canMsg3.data[1] = 0x07;
  canMsg3.data[2] = 0x00;
  canMsg3.data[3] = 0x04;
  canMsg3.data[4] = 0x07;
  canMsg3.data[5] = 0x46;
  canMsg3.data[6] = 0xe0;
  canMsg3.data[7] = 0x6f;

  canMsg4.can_id  = 0x1d4;
  canMsg4.can_dlc = 8;
  canMsg4.data[0] = 0xf7;
  canMsg4.data[1] = 0x07;
  canMsg4.data[2] = 0x00;
  canMsg4.data[3] = 0x04;
  canMsg4.data[4] = 0x47;
  canMsg4.data[5] = 0x46;
  canMsg4.data[6] = 0xe0;
  canMsg4.data[7] = 0xa8;

  canMsg5.can_id  = 0x1f2;
  canMsg5.can_dlc = 8;
  canMsg5.data[0] = 0x30;
  canMsg5.data[1] = 0x64;
  canMsg5.data[2] = 0x20;
  canMsg5.data[3] = 0x00;
  canMsg5.data[4] = 0x00;
  canMsg5.data[5] = 0x82;
  canMsg5.data[6] = 0x00;
  canMsg5.data[7] = 0x0b;

  canMsg6.can_id  = 0x1f2;
  canMsg6.can_dlc = 8;
  canMsg6.data[0] = 0x30;
  canMsg6.data[1] = 0x64;
  canMsg6.data[2] = 0x20;
  canMsg6.data[3] = 0x00;
  canMsg6.data[4] = 0x00;
  canMsg6.data[5] = 0x82;
  canMsg6.data[6] = 0x01;
  canMsg6.data[7] = 0x0c;

  canMsg7.can_id  = 0x1f2;
  canMsg7.can_dlc = 8;
  canMsg7.data[0] = 0x30;
  canMsg7.data[1] = 0x64;
  canMsg7.data[2] = 0x20;
  canMsg7.data[3] = 0x00;
  canMsg7.data[4] = 0x00;
  canMsg7.data[5] = 0x82;
  canMsg7.data[6] = 0x02;
  canMsg7.data[7] = 0x0e;

  canMsg8.can_id  = 0x1f2;
  canMsg8.can_dlc = 8;
  canMsg8.data[0] = 0x30;
  canMsg8.data[1] = 0x64;
  canMsg8.data[2] = 0x20;
  canMsg8.data[3] = 0x00;
  canMsg8.data[4] = 0x00;
  canMsg8.data[5] = 0x82;
  canMsg8.data[6] = 0x03;
  canMsg8.data[7] = 0x0e;

  while (!Serial);
  Serial.begin(115200);
  
  mcp2515.reset();
  mcp2515.setBitrate(CAN_500KBPS);
  mcp2515.setNormalMode();
  
  Serial.println("Example: Write to CAN");
}

void loop() {
  mcp2515.sendMessage(&canMsg1);
  mcp2515.sendMessage(&canMsg2);
  mcp2515.sendMessage(&canMsg3);
  mcp2515.sendMessage(&canMsg4);
  mcp2515.sendMessage(&canMsg5);
  mcp2515.sendMessage(&canMsg6);
  mcp2515.sendMessage(&canMsg7);
  mcp2515.sendMessage(&canMsg8);
  
  Serial.println("Messages sent");
  
  delay(10);
}

And this was to send 0x1f2. Like the last sketch I was unsure of the timing and even tried 50mS delay for both but no joy.

Code:
#include <SPI.h>
#include <mcp2515.h>

struct can_frame canMsg5;
struct can_frame canMsg6;
struct can_frame canMsg7;
struct can_frame canMsg8;

MCP2515 mcp2515(10);


void setup() {
  canMsg5.can_id  = 0x1f2;
  canMsg5.can_dlc = 8;
  canMsg5.data[0] = 0x30;
  canMsg5.data[1] = 0x64;
  canMsg5.data[2] = 0x20;
  canMsg5.data[3] = 0x00;
  canMsg5.data[4] = 0x00;
  canMsg5.data[5] = 0x82;
  canMsg5.data[6] = 0x00;
  canMsg5.data[7] = 0x0b;

  canMsg6.can_id  = 0x1f2;
  canMsg6.can_dlc = 8;
  canMsg6.data[0] = 0x30;
  canMsg6.data[1] = 0x64;
  canMsg6.data[2] = 0x20;
  canMsg6.data[3] = 0x00;
  canMsg6.data[4] = 0x00;
  canMsg6.data[5] = 0x82;
  canMsg6.data[6] = 0x01;
  canMsg6.data[7] = 0x0c;

  canMsg7.can_id  = 0x1f2;
  canMsg7.can_dlc = 8;
  canMsg7.data[0] = 0x30;
  canMsg7.data[1] = 0x64;
  canMsg7.data[2] = 0x20;
  canMsg7.data[3] = 0x00;
  canMsg7.data[4] = 0x00;
  canMsg7.data[5] = 0x82;
  canMsg7.data[6] = 0x02;
  canMsg7.data[7] = 0x0e;

  canMsg8.can_id  = 0x1f2;
  canMsg8.can_dlc = 8;
  canMsg8.data[0] = 0x30;
  canMsg8.data[1] = 0x64;
  canMsg8.data[2] = 0x20;
  canMsg8.data[3] = 0x00;
  canMsg8.data[4] = 0x00;
  canMsg8.data[5] = 0x82;
  canMsg8.data[6] = 0x03;
  canMsg8.data[7] = 0x0e;

  while (!Serial);
  Serial.begin(115200);
  
  mcp2515.reset();
  mcp2515.setBitrate(CAN_500KBPS);
  mcp2515.setNormalMode();
  
  Serial.println("Example: Write to CAN");
}

void loop() {
  mcp2515.sendMessage(&canMsg5);
  mcp2515.sendMessage(&canMsg6);
  mcp2515.sendMessage(&canMsg7);
  mcp2515.sendMessage(&canMsg8);
  
  Serial.println("Messages sent");
  
  delay(10);
}

I'm assuming I'm doing something wrong as nothing happened, like I said I know this is incredibly messy programming but it's a start I guess.
 
Hi Alibro,
Good start, but please avoid using "delay()" function. It is real bad practice and can cause all sorts of issues on embedded. See this page for how to implement a better scheduler: https://www.digikey.com/en/maker/blogs/2022/how-to-avoid-using-the-delay-function-in-arduino-sketches

Also get everything on one sketch. That looks like hell to troubleshoot.

Then get all the messages there, and remember to keep PRUN and CRC accounted for. Otherwise the messages will be ignored.
 
Thank you Dala, you're a star. :D
I knew this was really poor coding but I was looking for something very simple that I could adjust with the numbers supplied by #TrueSoln
This came from an example in the MPC2515 Library and was simple enough even for me to understand but I could see the timing was an issue so I will follow the advice from your link.
As for getting everything in one sketch I'm taking baby steps here. making the thing work is priority number one, I don't mind using three Uno's for now if it works. :D

I'll need to do a bit of research on PRUN and CRC to see what you mean here, I've found some examples for CRC but struggling with PRUN. I'm assuming it stands for Program Run and is it to help with the timing.
 
You can't use three UNOs, since the timing will be off. Your #1 priority is to setup code that allows you to queue up messages correctly.

See this video for more info on CRC/MPRUN/CSUM
https://www.youtube.com/watch?v=oENNNfy5GSM
 
Back
Top