I have successfully modified the Can Bridge software to transmit the 5 messages in sequence missing from the can bus dialogue in an attempt at stimulating some response from the charger. Essentially after the first 3 messages from the charger "679, 390, 393" and a 4th message/response from the VCM "50B" as a result of plugging a live j1772 plug into the charge port as documented earlier. I have inserted 5 messages recorded from a working leaf "54A,481,54B,54C and 54F".
I had initially set the trigger with the 50B message, I have also tried triggering it on 679 and 11A messages as there is a time slot after each of these that I was able to insert the messages cleanly in sequence. Inserting them immediately after 50B ends up spacing them out between other VCM generated messages (not clean).
Any suggestions or idea's of where to go next appreciated. I am still trying to acquire a complete leaf for more testing as I still suspect something is wrong with the charger I am using or the lack of a BMS to complete the communication may be the issue.
NO APOLOGIZE, programming in C is not something I am good at so there may be better ways to do what I have done, I can only say that it works as expected.
The significant code changes are as follows: (with the full code linked below) and of course the original source is from emile_nijssen-open-source-can-bridge-f3a419e03747 on GITHUB. This works on the Muxan Bridge MITM but could work on any dual MCP25625 circuit if modified.
- .......................These are the messages I am inserting...........
struct can_response array_response[5] = {
{0x54A,8,{0xDA,0x80,0x70,0x0e,0x00,0x00,0x00,0x54}},
{0x481,2,{0x4B,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{0x54B,8,{0x10,0x08,0x80,0x00,0x04,0x00,0x00,0x00}},
{0x54C,8,{0x59,0xFF,0x00,0x00,0x00,0xF8,0xFF,0x00}},
{0x54F,8,{0x14,0x00,0x00,0x00,0x08,0x40,0xC0,0x14}},
};..........................
- ...........This is the core of the code that does it
.................//test_can_msg and send to serial always moved here to stream line debugging
SID_to_str(strbuf + 2, frame.can_id); // build frame for serial ....
canframe_to_str(strbuf + 6, frame);
print(strbuf,23); // now send to serial
// CAN message modification routine ////// NOTE I HAVE swapped 50B AS THE ORIGINAL TRIGGER, AND have tried 679 and 11A
as there are time slots that the response can be squeezed in.
switch(frame.can_id){
case 0x50B: /// see above
for (int j=0; j <5; ++j){ // build 5 messages that need to be inserted
for (int i=0; i <array_response[j].can_response_dlc; ++i){
frame.data= array_response[j].response_data; // actual to frame done here
}
frame.can_id = array_response[j].can_respone_id;
frame.can_dlc = array_response[j].can_response_dlc;
calc_crc8(&frame); /calculates the CRC using radix 0x85 and put that CRC in frame.data[7]
//send command
_delay_ms(0.7); // This helps with data overflow on Can 2 but not much??
send_can1(frame);.............................
Full modified code here : https://www.divemaster.ca/RAV4EV/LEAF/M ... firmware.c
https://www.divemaster.ca/RAV4EV/LEAF/M ... firmware.h
https://www.divemaster.ca/RAV4EV/LEAF/M ... /mcp25xx.c
Foot note : I have one MUXAN bridge as a MITM between the OBC/PDM and the VCM doing the work and I have one arduino based MC2515 on each side of the bridge monitoring the resulting input and output. The monitoring allows me to be sure the code is doing what I want it to do. I also have a third arduino monitoring the CarCan just for fun at the moment. (which runs full time with messages when the car is in the off position). It's no wonder the battery discharges over time.