2004 BMW 330 with SMG/SSG Gearbox

Tell us about the project you do with the open inverter
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Yeah. Exactly. :)

In other news:
IMG_20200729_212729.jpg
I am starting to attempt things with my port and the Teensy. Just replaying traffic makes it do some interesting / weird stuff, do I'll try and get it doing more reasonable things soon enough. :)

-Matt
arber333
Posts: 3265
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 233 times
Contact:

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by arber333 »

Isaac96 wrote: Wed Jul 29, 2020 12:00 am Range - I'm getting up to 90 with careful driving (having to keep my motor cool, it's full of air still) with a double string.
Also my cells are staying at exactly the same voltage difference (13mv, the modules were at slightly different voltages when I installed them). Which seems promising for longevity.

-Isaac
Well i recommend you use additional hose length and a bucket and force the coolant into the motor with an additional pump on top. Car needs to be on incline hood down so that motor is the lowest part of system. Then you set the pump to pull the coolant from the bucket and on the other end coolant returns to the bucket. While system is working in that position you grab the return hose and you limit/squeeze it to increase dP in the system. This will cause some cavitation on the bends, but faster liquid (dv) will take air bubbles further along the lines.
When you are certain you dont have any bubbles there you take apart the additional pump and hoses.

I found out 12V Bosch Audi pump core needs to be immersed in coolant to work properly. So i pour coolant into the pump first and then run it.
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Interesting / weird stuff == "Everything is in trouble, SHUT DOWN".

The replay had a lack of the keepalive counter, so the "bus reset" behavior I was seeing was preceded by a shutdown request in this case.

At this point it is going into a AC_CHARGER_FAULT state. A a few possibilities:
* Missing more messages
* Latch enable needs to be in the correct state (unclear if high or low)
* Motor needs to be hooked up

The fault pin is ~4V. Goes into that state immediately on boot-up, so not related to the latch not enabling. That's not to say that the motor not being there isn't causing this...
Proximity line does the expected thing, 12V idle, 0V when plugged in.
Just unclear what to do with the latch enable.

On the note of power supplies... Probably need a 5V and a 12V supply. Any suggestions for a reasonably inexpensive bench supply?

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

4V is normal. Thanks to there being a lot of debug info, I looked at the working charge log, and saw that when things are good it goes high.

We'll see.
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Ugh.

Finally pulled a log from the 330 yesterday, opened it, and realized the channels I moved around to clean things up also meant..I forgot to log them. So, useless data there.

On the charge port front there's so much data to go through its kinda nuts.
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

M3 is instrumented to try and figure out what I'm doing wrong with my full-throttle shifts
330 is instrumented and I'm doing something silly as the stock ECU torque request vs mine seem to be about 2:1.
I have a Charge Port Door on the way from EBay to see if this moves me further along. Until then, I've found a 1.3A current-limiting power supply:
power_supply_solution.jpg
:D :D :D

For $10 from Best Buy, I bought a supply which came with multiple plugs. A Deutsch connector is more fitting, so there you go. Lots of capacitance in there, as that was a good 30+ seconds after unplugging and there was still enough voltage to keep that LED going. :)

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

To those trying to get the CP ECU to work: good luck.

I can't even get it to open the damn door. :(

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

I'm going to take a more methodical approach here today.
I am going to try and open the charge port door from the touch screen, that way there's no timing involved regarding pushing the button on the charge cable.
I'm going to attempt to put the scope on the 3 pins - prox, fault, and latch, and see what they do. The latch pin is..odd.

I'm then going to take the EVTV box and turn it into a CAN Gateway and try and filter out only what's needed to make the port happy in an idle state. Because as of right now it's quite a frustrating experience, so definitely need to step back.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Ah... Ahhhhh, a-ha!

They are NOT replay-attack resistant; rather - they support multiple units!

I replayed the traffic capture from my car on the purchased ECU. Nothing.

I pulled the connection off the HV ECU connector and replayed from my laptop (filtered out for the original messages from the CP ECU, of course)...and the door opened.

Now to just figure out how to do address the thing.

-Matt
Isaac96
Posts: 656
Joined: Sat Oct 05, 2019 6:50 pm
Location: Northern California, USA
Been thanked: 1 time
Contact:

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by Isaac96 »

Right. What you're seeing is the firmware difference -- this is why they want you to have a software upgrade ready when you replace parts.
It's possible to telnet into a Model S to force a firmware redeploy, but the 3 may or may not be more locked down. The Toolbox software can certainly do what you need, if you can either get it or find a helpful service center.
Or just walk around looking for 3's and steal all their CAN logs :evil:
-Isaac
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Maybe. That is yet to be determined.

However, I have the minimum required to make the door open, the minimum to have a non-red LED, and the minimum to set Number of Alerts to 0.

Next steps is to see what happens manipulating the proximity, latch, and fault lines, as well as finding the serial number. After that, try and replicate on the eBay unit.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

I'm unsure what I saw on one of the IDs, but it was not an (obvious) serial number comparing to the label on the outside of the CP ECU on my model 3. So that wasn't it.
Manipulating the proximity, latch, and fault lines did not change a value which I was expecting a change on my Model 3.

I did however have trouble reproducing my results from last night when I went back today. Until I switched CAN devices. It seems SavvyCAN / the CANDue board is a bit processor hungry. It was not able to smoothly transmit the info required. When I put the same playback through my ValueCAN device with Vehicle Spy, voila, the door opened on my command.

Ok, so now lets try and replicate this. Lesson: Don't ignore your discrete signals!

Still no go, even when brought down to the bare minimum required to make the door open. Ok, what's the difference here. The latch. When I set the latch signal to what it should be...Voila! The door opens and closes on my command, on the bench. Now we're getting somewhere.

There's some slight variance, as even though I'm replaying the 'no error' filter, I still have 1 alert, and the LED is red, not white. Very close though. Definitely the most progress I've made in some time.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »



Later I'll try and plug in the charger and see what happens now that I know I really need to manipulate the latch.

-Matt
Isaac96
Posts: 656
Joined: Sat Oct 05, 2019 6:50 pm
Location: Northern California, USA
Been thanked: 1 time
Contact:

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by Isaac96 »

Awesome!
Is this your ebay part?
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Isaac96 wrote: Tue Aug 18, 2020 8:58 pm Awesome!
Is this your ebay part?
Yep. Thanks for reminding me. Updated first post details and total.

-Matt
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by Jack Bauer »

Excellent work.
I'm going to need a hacksaw
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Jack Bauer wrote: Wed Aug 19, 2020 6:51 am Excellent work.
Thanks! :)

Been working on the Arduino code a lot - at this point if the door is already opened, I can keep the system stable. Need to figure out what I'm doing wrong. But the code was cleaned up a bit (no more if count == X blocks), I'm using a simple If (this - previous) > interval style of loops, and that seems to work well - as long as you aren't doing an analogRead too often. Do it too often..and you're gonna be upset. My cycle timing was off by a factor of 2 for the longer intervals. Short intervals were fine, oddly.

Onward.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

So it turns out that the single bolt holding in the CP ECU is really easy to remove.
So I did, and swapped the existing port / door with the eBay one. Because otherwise it's impossible to contort the assembly to fit in any way other than the correct way.

I did some tests with that and figure out this much:
* There's verification on voltages between the wall charger and the onboard charger - as it sits in "blinking blue" when it should switch to blinking green as the cable wasn't exactly connected to anything. :D
* It will sit in a "scheduled charge" mode just fine, so I'm going to try and reproduce that on the bench.


I also logged switching from scheduled charge to on-demand charge to see what it does. I also logged the car going to sleep (which required me to turn off bluetooth on my phone, ensure everything was closed, and turn off Teslafi), and then a wake-up about 30 minutes later.

I thought I had a cold-start solution on the bench, but when I refactored code to be less awful, not so much.

I can't wait to share a clip of my multimeter showing 120VAC on the end of the cable :)

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

:: sigh ::

Great news and terrible news.

Great news: playback of such sessions does what I expect, and things go about their business.
Terrible news: this works only on the ECU from the car.

I haven't tried it yet, but I think I could get my Arduino code working with the ECU from the car.

Now I need to troll the Internet for other HV / Charge port bus logs. I just looked at Damien's github for the PCS..I think HVcon_onown_poweron_off.csv is the file I'm interested in, but I'm not 100% sure.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

So trying with the arduino code highlighted an issue. One of the 'OMG this is insane' IDs turned out to be...voltages. But, we don't need that ID.

The ID we did need...can be substituted with static values (again, multiplexed however) and that produced a blue Tesla logo.

For s___ and grins I connected the eBay ECU....and it went blue for about 0.25 seconds before going to the red logo. So it looks like the tolerances for error conditions are much tighter on the older firmware, but gives me hope to make it work! For reference, it goes through the colors so fast my Pixel 3 picks it up as a slightly shaded white lol. On a subsequent try, with stabilization off, I clearly got it to sit on blue for a second. The camera picks it up as white. Yay for bayer filters...

In any case, microscopically small progress, but forward progress again at least.

Power up is still a pain in the butt with respect to door control. To make things fun, there's also event-based CAN messages that can thrown around too....

This has been a bit more work than I anticipated to get this thing to work...

In other news I've started cleaning up the M3 harness from the horrible spaghetti monster it was, trying to do 5-10 pins a day. Should have that done in a week. Just trying to not overwhelm myself.

Haven't done the sanity checking of data on the 330 yet. Just...want to overcome this charge port challenge first.

-Matt

EDIT: LOL night mode on my phone is what did it..desaturates the blue...The video itself does show it. I'll upload a vid tomorrow with less junk around it :D
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Power up still an issue.

eBay ECU still not happy.

Car ECU will sit in standby for as long as I'd like it to now. :)

I've got control over the LED colors too, aside from white or yellow. White is only from the CP ECU when happy / latch unlocked, and yellow I have been unable to reproduce.



I have verified that I can get 120ish volts to show up at the connector, but it's not exactly easy to probe and record. :) There seems to be current monitoring built into the mobile connector as it eventually decides its a bad idea and shuts the relay off.

I also am sending data somewhere that says the car is locked, because the LED turns off after about 90 seconds (will reappear if you push the button on the handle, but not unlatch - as it thinks it is locked).

I need to get the mating connector now, which will eventually go on to my junction box. Then I can try wiring it up to the charger. Need to get the ratings on the contactors.

Next steps are probably further refining the existing controls, and trying to figure out what's up with the eBay CP ECU.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

No idea what the deal is with the locked / unlocked item. Not as simple as one would like (of course).

Cleaned up the serial console / command input code greatly. It looks pretty, but doesn't do much more yet :D

Also found out that again it was not sending all IDs. I needed to increase the TX buffers from the default of 2 to 8! But I'm sending 26 IDs at this point....that should give you a better idea of how involved this is. I can get a white LED at times depending on timing of when I power on the ebay ecu. I can also get it to turn on the relay if the cable is plugged in when powering it on, sometimes. So it's annoyed (therefore red LED), but there's a small window in which it will listen.

Haven't looked for the mating connector yet.

Greatly cleaned up the M3 wiring harness, but that's not done yet.

-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

console_progress.png
Behold the power of ANSI color codes and positioning.

Like so:

Code: Select all

  Serial.print("Commands: ");
  Serial.write(27);
  Serial.println("[4;44H CAN Loop Status:");
  Serial.println("d / D - Open / Close door.");
  Serial.println("r / R - Start / End Rainbow / Rave mode.");
  Serial.println("c / C - Start / End Charge.");
  Serial.println("l / L - Lock / Unlock doors.");





  Serial.write(27);
  Serial.print("[15H");
  Serial.print("Activity: "); // Response on 11
  Serial.write(27);
  Serial.print("[14H");
  Serial.print("Command? "); // Response on 10[/code}
  
//  Then in the loops themselves:
// Globals
  const char COMMAND_POSITION[9]  = { 27, '[', '1', '4', ';', '1', '0', 'H', '\0' }; // 14,10
  const char ACTIVITY_POSITION[9] = { 27, '[', '1', '5', ';', '1', '1', 'H', '\0' }; // 15,11
  const char NO_ATTRIB[5] = { 27, '[', '0', 'm', '\0' };
    // CAN status
    Serial.write(27);
    Serial.print("[5;44H 10   ms: ");
    if (loop10msResult == 31) // Returns 1 for success - use bitshifting for multiple IDs - 5 in this case.
    {
      Serial.println("OK");
    }
    else
    {
      Serial.println(loop10msResult);
    }
    Serial.print(COMMAND_POSITION);
    ...
-Matt
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Moving development over to Eclipse, trying to get away from the .ino files to a normal C toolchain. There's a distribution called Sloeber which is a good intermediate - it has the right wrappers to work with .cpp/.h and .ino files. Reduced some global variables.

Bought: MISRA C 2012 PDF to try and write more safety-conscious code. I definitely need a refresher on good coding practices. Working != good, that's for sure.

* https://www.ebay.com/itm/114158760746 - End of cable connector which will eventually connect to contactors (for now just to connect AC to charger eventually)
* https://www.ebay.com/itm/2019-Tesla-Mod ... 4830121802 - Another CP ECU, lets see if this one is more cooperative.

Air quality is atrocious right now. AQI is in the 330s. :(
User avatar
mdrobnak
Posts: 692
Joined: Thu Mar 05, 2020 5:08 pm
Location: Colorado, United States
Has thanked: 1 time
Been thanked: 5 times

Re: 2004 BMW 330 with SMG/SSG Gearbox

Post by mdrobnak »

Just got the new eBay CP ECU from a 2019 Tesla. I got the DC connector yesterday. I'll add pics later, but for now:



So, definitely need to take into account differences in firmware on these CP ECUs. 2019+ seems to be where the change was made that my code was already working for. Now I should be able to put together my trunk again for now. :D

Yay for progress!

-Matt
Post Reply