Sending Custom CAN messages from SDU openinverter board

Topics concerning the Tesla front and rear drive unit drop-in board
Post Reply
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Sending Custom CAN messages from SDU openinverter board

Post by tensa »

Can I send custom CAN messages based on SDU value mappings?

For example, I would like to send the CAN messade ID 0x43F over 8 bits starting at Bit 0 with the decimal value of 13976218851319218176 when "Forward" direction is selected.

Can this be done over the web interface or CLI?
P.S.Mangelsdorf
Posts: 1172
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 290 times
Been thanked: 330 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by P.S.Mangelsdorf »

If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed Hot Rod Drag Week 2023 and 2024

https://www.youtube.com/@MangelsdorfSpeed
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

So just to be clear, and something that the documentation does not clarify, do I enter the custom value as the gain?
P.S.Mangelsdorf
Posts: 1172
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 290 times
Been thanked: 330 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by P.S.Mangelsdorf »

I think so, but I haven't done that myself so I'm not certain. I'd suggest giving it a shot and seeing if it works, it can't hurt anything. It's useful to have a CAN sniffer like SavvyCAN set up to verify the messages being sent.
If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed Hot Rod Drag Week 2023 and 2024

https://www.youtube.com/@MangelsdorfSpeed
User avatar
mane2
Posts: 261
Joined: Fri Jan 13, 2023 6:32 am
Location: Finland
Has thanked: 45 times
Been thanked: 48 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by mane2 »

You can send direction as a can message, but not with custom data. Only the number (probably like 0, 1, 2) with gain factor, eg. multiplied by 100. It will also be sent constantly. I didn't see the frequency from wiki, but it's like 50 times per second or so. So not really something you want probably.
User avatar
timbradley
Posts: 17
Joined: Sat Jan 22, 2022 11:49 pm
Location: Castle Pines, CO USA

Re: Sending Custom CAN messages from SDU openinverter board

Post by timbradley »

Hello,

Thanks for all the help this forum has provided. The electric Fiero has achieved about 800 miles with the SDU, OI board, charger interface board and Orion BMS. Only a few pesky kinks, one of which is CAN messaging from OI board.

I have Speedhut CAN Gauges and all but the motor temperature are working. Granted, all the working ones are getting their messages from the Orion.

Can anyone offer suggestions on what I may be missing? Based on BMS screenshot, I'm feeling like no CAN traffic is coming from the inverter. Do I need to manually insert a line for this rather than the CAN mapping already done?

Thanks, in advance, for any help here.
Attachments
CAN Motor Temp.JPG
ZeroEV Output in Orion.JPG
1969 Beetle w/ Hyper-9
1988 Pontiac Fiero w/ Tesla SDU(OI), 16 18650, Orion BMS2
1968 VW Transporter 2 w/ Hyper-9
User avatar
johu
Site Admin
Posts: 6969
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 455 times
Been thanked: 1771 times
Contact:

Re: Sending Custom CAN messages from SDU openinverter board

Post by johu »

May sound silly but have you selected the correct CAN speed?
Are you aware that all numbers are decimal, not hex?

If possible you could monitor the CAN bus to check if your messages are generated
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
timbradley
Posts: 17
Joined: Sat Jan 22, 2022 11:49 pm
Location: Castle Pines, CO USA

Re: Sending Custom CAN messages from SDU openinverter board

Post by timbradley »

I have confirmed CAN speed at 500K. Attaching JSON for any other suggestions.

I must access CAN wiring from under car with weather shield removed (yes, design feature we won't repeat) so I haven't gotten there yet (with CAN sniffer, that is).

While looking at JSON, if there are any settings you'd suggest changing to improve the startup jitter, I'm all ears. I've smoked IGBTs on the tuning process a few months back and still having PTSD due to it.
params (6).json
(1.41 KiB) Downloaded 325 times
1969 Beetle w/ Hyper-9
1988 Pontiac Fiero w/ Tesla SDU(OI), 16 18650, Orion BMS2
1968 VW Transporter 2 w/ Hyper-9
P.S.Mangelsdorf
Posts: 1172
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 290 times
Been thanked: 330 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by P.S.Mangelsdorf »

timbradley wrote: Wed Sep 06, 2023 2:11 pm I have Speedhut CAN Gauges and all but the motor temperature are working. Granted, all the working ones are getting their messages from the Orion.

Can anyone offer suggestions on what I may be missing? Based on BMS screenshot, I'm feeling like no CAN traffic is coming from the inverter. Do I need to manually insert a line for this rather than the CAN mapping already done?
I've got Speedhut gauges and it took a bit to get things working from my LDU. One thing to note: you need something else on the bus other than just the drive unit and the gauges. I think since their EV CAN gauges are based on their OBD2 gauges, they don't acknowledge the messages (so that they don't freak an OEM car out, they just silently observe), so the drive unit doesn't keep sending. It sounds like you do have the Orion on the bus, so that's likely not the issue.

To the best of my knowledge, they don't have separate Inverter and Motor temp gauges. The Inverter message looks correct, based on the attached table, but I'm not sure what you're sending the motor temp to.
Attachments
Screenshot 2023-09-12 124535.png
If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed Hot Rod Drag Week 2023 and 2024

https://www.youtube.com/@MangelsdorfSpeed
User avatar
timbradley
Posts: 17
Joined: Sat Jan 22, 2022 11:49 pm
Location: Castle Pines, CO USA

Re: Sending Custom CAN messages from SDU openinverter board

Post by timbradley »

Thanks for your note. I have deleted all CAN mapping and tried for just the sole inverter temp and get nothing. Both by a direct entry in the table, and as a command. You're right, that is the only gauge I'm running for temperature around the motor.

Time to get it up on the rack and dig into the CAN wires to see if anything is coming out.

If there are any other ideas out there, I'm all ears!
1969 Beetle w/ Hyper-9
1988 Pontiac Fiero w/ Tesla SDU(OI), 16 18650, Orion BMS2
1968 VW Transporter 2 w/ Hyper-9
P.S.Mangelsdorf
Posts: 1172
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 290 times
Been thanked: 330 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by P.S.Mangelsdorf »

timbradley wrote: Fri Sep 15, 2023 11:18 am Thanks for your note. I have deleted all CAN mapping and tried for just the sole inverter temp and get nothing. Both by a direct entry in the table, and as a command. You're right, that is the only gauge I'm running for temperature around the motor.

Time to get it up on the rack and dig into the CAN wires to see if anything is coming out.

If there are any other ideas out there, I'm all ears!
Your inverter message looked correct, so the only thing I can think of is; if it's just the gauge and the drive unit on the bus, that causes an issue. But if there are other things on the bus, it should be working.
If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed Hot Rod Drag Week 2023 and 2024

https://www.youtube.com/@MangelsdorfSpeed
jrbe
Posts: 653
Joined: Mon Jul 03, 2023 3:17 pm
Location: CT, central shoreline, USA
Has thanked: 266 times
Been thanked: 186 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by jrbe »

It's easy to be looking in the wrong discipline with things like this. Is the electrical side of things correctly setup? You have termination resistor(s) in place?
jsimonkeller
Posts: 109
Joined: Sun Oct 30, 2022 2:21 am
Has thanked: 6 times
Been thanked: 9 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by jsimonkeller »

Hi Tim. I am not sure if you are still working this out on the inverter temp gauge issue. I have the ORION 2 BMS and Speed Hut gauges. As a side note, I went to Speed Hut in 2019 to get them to help me make custom can gauges for my EV project and they were super reluctant and I had to pester them to work with me. I then connected them with ZERO EV to develop the EV modified gauges for my project. I am glad that it took off like it did :)

I am not sure if my settings carry over to your setup, but on the OI firmware, I am not using tmpm at all but only tmphs with 294 32 16 1 as you have done. The ORION and Inverter CANBUS are tied together in the ZERO EV lv junction boxes, but you could connect it all up yourself I assume. Here is a screenshot of my canbus settings in ORION as well but I don't think motor temp is addressed here or needs to be. I have inverter temp/battery temp on one gauge. (disregard the temp reading on the inverter in the photo, as this was when I was dealing with a coolant leak on the inverter reeking havoc on that gauge :o )
PXL_20220930_214944542.jpg
canbus orion.jpg
alexbeatle
Posts: 289
Joined: Sun Jan 03, 2021 6:12 am
Has thanked: 77 times
Been thanked: 31 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by alexbeatle »

Hello.
Could somebody please give me a hint where am I going wrong here?
In the attached screenshot WebUI reads motor temp = 15.09C and heatsink temp 20.09C, but on the receiving end of the CAN bus, I'm reading motor temp = 12.80C, heatsink temp = 20.21C. Both SDU and my teensy talk at 500k.
This is my code on the receiving end:

Code: Select all

Drive_HtSnkTemp=(uint16_t)((incoming.buf[5] << 8) | (incoming.buf[6])); // scale 1/100
Drive_MotorTemp=(uint16_t)((incoming.buf[7] << 8) | (incoming.buf[8])); // scale 1/100
Screenshot_20240408_213500_com.android.chrome.jpg
User avatar
johu
Site Admin
Posts: 6969
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 455 times
Been thanked: 1771 times
Contact:

Re: Sending Custom CAN messages from SDU openinverter board

Post by johu »

You're indexes are off by one and you're decoding big endian. Try this

Code: Select all

Drive_HtSnkTemp=(uint16_t)((incoming.buf[5] << 8) | (incoming.buf[4])); // scale 1/100
Drive_MotorTemp=(uint16_t)((incoming.buf[7] << 8) | (incoming.buf[6])); // scale 1/100
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

I am having the same issue as @timbradley.
I can not get my MCP2515 to recieve any CAN messages fron the inverter even after mapping them to as TX values.
I have tried to map one value at a time but can not recieve any values. I am using an Arduino with an MCP2515.

Anyone tried reading CAN messages using an MCP2515 that can help?
User avatar
tom91
Posts: 2754
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 264 times
Been thanked: 717 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tom91 »

tensa wrote: Sat Aug 03, 2024 10:35 am I am having the same issue as @timbradley.
I can not get my MCP2515 to recieve any CAN messages fron the inverter even after mapping them to as TX values.
I have tried to map one value at a time but can not recieve any values. I am using an Arduino with an MCP2515.

Anyone tried reading CAN messages using an MCP2515 that can help?
Do you have a known working setup to confirm you Arduino and mcp2515 are working?

Check the crystal frequency for the can controller matches the used library.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

tom91 wrote: Sat Aug 03, 2024 10:55 am Do you have a known working setup to confirm you Arduino and mcp2515 are working?

Check the crystal frequency for the can controller matches the used library.
Yes, I am using the same Arduino and MCP2515 to read the CAN system for the conversion car, so it works. I have tried to match all the CAN parameters, CAN Baudrate etc between the MCP2515 and the inverter and no luck reading anything.

Is there something I am missing?
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

Just bumping this thread as I never got help.

I really need help reading these CAN messages.

If I am connecting the SDU directly to an MC2515, do I need the terminating resistor?
User avatar
tom91
Posts: 2754
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 264 times
Been thanked: 717 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tom91 »

Measure you CAN network with everything off, it needs to read 60 ohm thus 2x120 ohm terminating resistors present.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

tom91 wrote: Thu Sep 25, 2025 9:08 pm Measure you CAN network with everything off, it needs to read 60 ohm thus 2x120 ohm terminating resistors present.
Thanks,
I measured and I got 60ohms as stated above. I also confirmed that I have the 2x120 ohms.

For context, I am using an Arduino Nano with an MCP2515 running the script below with no filters. I have confirmed that the script works as I can read the car's original CAN bus. I do not get anything for the Tesla SDU

Code: Select all

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

// Define the CAN message structure
struct can_frame canMsg;
// Initialize the MCP2515 object (CS on pin 10)
MCP2515 mcp2515(10);


void setup() {
  Serial.begin(115200);
  while (!Serial);

  // 1. Reset the MCP2515 module
  if (mcp2515.reset() == MCP2515::ERROR_FAIL) {
    Serial.println("MCP2515 failed to reset!");
    while (1);
  }
  
  // 2. Set the Bitrate to 500 KBPS, explicitly passing the 8 MHZ clock frequency.
  // This is the line that has been updated:
  if (mcp2515.setBitrate(CAN_500KBPS, MCP_8MHZ) == MCP2515::ERROR_FAIL) {
    Serial.println("MCP2515 failed to set 500KBPS @ 8MHz! Check wiring and CAN bus.");
    while (1);
  }
  
  // 3. Configure Masks and Filters to Receive ALL Raw Messages (Crucial for raw data)
  // Set all Mask registers to 0. (all CAN ID bits are "don't care")
  mcp2515.setFilterMask(MCP2515::MASK0, false, 0x00000000);
  mcp2515.setFilterMask(MCP2515::MASK1, false, 0x00000000);
  
  // Set all Filter registers to 0. (any message ID passes)
  mcp2515.setFilter(MCP2515::RXF0, false, 0x00000000);
  mcp2515.setFilter(MCP2515::RXF1, false, 0x00000000);
  mcp2515.setFilter(MCP2515::RXF2, false, 0x00000000);
  mcp2515.setFilter(MCP2515::RXF3, false, 0x00000000);
  mcp2515.setFilter(MCP2515::RXF4, false, 0x00000000);
  mcp2515.setFilter(MCP2515::RXF5, false, 0x00000000);

  // 4. Set to Normal Mode
  if (mcp2515.setNormalMode() == MCP2515::ERROR_FAIL) {
    Serial.println("MCP2515 failed to enter Normal Mode!");
    while (1);
  }
  
  Serial.println("CAN Listener Ready (500KBPS @ 8MHz). Printing Raw Data Payload (HEX):");
}

void loop() {
  // Check for received message and read it
  if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {
    
    // Print the raw data payload only if data is present
    if (canMsg.can_dlc > 0) {
      
      for (int i = 0; i < canMsg.can_dlc; i++) {
        // Print the byte in HEX, ensuring a leading '0'
        if (canMsg.data[i] < 0x10) {
          Serial.print("0");
        }
        Serial.print(canMsg.data[i], HEX);
        Serial.print(" ");
      }
      Serial.println();
    }
  }
}
On the SDU OpenInverter, I have configured CAN speed as 500Kbps with 100ms refresh and mapped UDC as TX with the following values;

ID - 220
Position - 4
Bits - 4
Gain - 1

Do you see anything wrong here?
P.S.Mangelsdorf
Posts: 1172
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 290 times
Been thanked: 330 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by P.S.Mangelsdorf »

tensa wrote: Sun Sep 28, 2025 8:49 am
On the SDU OpenInverter, I have configured CAN speed as 500Kbps with 100ms refresh and mapped UDC as TX with the following values;

ID - 220
Position - 4
Bits - 4
Gain - 1

Do you see anything wrong here?
Just wanted to note that the ID on the web interface is in dexcimal, not hexidecimal, so if you want it to output as 0x220, you need to input 544 in the web interface.

I use this converter https://www.rapidtables.com/convert/num ... cimal.html

tensa wrote: Sun Sep 28, 2025 8:49 am Thanks,
I measured and I got 60ohms as stated above. I also confirmed that I have the 2x120 ohms.

For context, I am using an Arduino Nano with an MCP2515 running the script below with no filters. I have confirmed that the script works as I can read the car's original CAN bus. I do not get anything for the Tesla SDU
Do you have anything else on the bus along with the SDU? I had issues when my LDU and Speedhut gauges were the only thing on the bus, the gauges weren't acknowledging the messages so the LDU stopped sending. It worked once I put them on the same bus as other components that were transmitting (ISA shunt, charge controller, etc).
If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed Hot Rod Drag Week 2023 and 2024

https://www.youtube.com/@MangelsdorfSpeed
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

Hi,
Thanks for the input.
I tried the above; putting it on the bus with other CAN transmitters but I did not receive any messages. I only received messages from the other sources I e ABS, instrument cluster but none from the SDU.
tensa
Posts: 31
Joined: Sun Oct 04, 2020 8:22 pm
Has thanked: 14 times
Been thanked: 2 times

Re: Sending Custom CAN messages from SDU openinverter board

Post by tensa »

timbradley wrote: Fri Sep 15, 2023 11:18 am Thanks for your note. I have deleted all CAN mapping and tried for just the sole inverter temp and get nothing. Both by a direct entry in the table, and as a command. You're right, that is the only gauge I'm running for temperature around the motor.

Time to get it up on the rack and dig into the CAN wires to see if anything is coming out.

If there are any other ideas out there, I'm all ears!
#timbradley, did you ever get your CAN to work? I can't seem, for the life of me, to send out any messages from my inverter. Tried everything proposed here and no success. Starting to think it is a board issue.
User avatar
johu
Site Admin
Posts: 6969
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 455 times
Been thanked: 1771 times
Contact:

Re: Sending Custom CAN messages from SDU openinverter board

Post by johu »

Have you tried the other way around, i.e. sending from Arduino and receiving on the SDU side? Have you ever observed the CAN bus with something else than your Arduino setup i.e. a proper USB-CAN interface and SavvyCAN?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply