Honda Insight Forum banner

Controlling the Instrument Cluster's Display

67751 Views 444 Replies 64 Participants Last post by  mudder


A little project I'm working on. :) (Sorry for the horrid picture!)

Here's the elevator pitch: Directly control the LCD panel with a microcontroller to display custom information on the instrument cluster. The microcontroller will also read the data that would normally be going to the LCD and can choose to display that info or custom info.

Maybe you want to display OBDII parameters where the MPG is. Maybe you want to change the charge, assist, and SOC gauges to accurately reflect amps in/out, real battery SOC, etc.

I've got a few other ideas as well. Once I'm finished with this project I'll open-source everything I've learned and perhaps produce some PCBs to sell. We'll see!

I have work and other projects as well, so it may be slow going at times. But I'll try to give updates fairly regularly.
I don't think this has ever been done before. I hope you guys are excited!
If anybody is or wants to work on something similar, I'll be glad to share what I know; just ask.
421 - 440 of 445 Posts

· Linsight Designer
Joined
·
4,812 Posts
Cool update! Getting the bootloader right is really important. I assume your bootloader has an initial structure that tests for keyON?
Code:
if( isKeyOnNow(void) == KEY_IS_ON) { immediatelyExitBootloader(); }
else                               { waitOneSecondForNewFirmware(); }
If not... I recommend doing so, which will allow LiBCM to start displaying immediately when the key is on.

...

I always love seeing in-house programmers. You'd be amazed how many fortune 500 hardware companies use essentially identical programmers... production bed-of-nail testers are expensive.

So then I guess you have a USB cable attachment somewhere? Pretty soon we're going to have at least three USB cables stashed in some cars (LiBCM, Pegasus, Mudder's Manual IMA).
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #422 ·
The controller is powered from load switches on the Pegasus mainboard. When the controller turns on, if it receives no SPI commands within 1 second, it will automatically run the firmware. Otherwise, you can send commands to load new firmware, or send a command to run the firmware immediately (the normal usecase). To run the application, the bootloader saves a special value in a backup register, then reboots the micro to reset all the other registers. It then checks the backup register and immediately runs the application.
Pegasus is always powered, but detects keyON by monitoring the 5V power to the LCD panel, which is on switched power. It will come out of low-power mode and power up everything else.

Code:
int main(void) {
    // If a certain flag is set, we jump straight to the application without initializing anything else
    // This is how we reset all peripherals and registers in preparation to run the application
    if(read_backup_register() == JUMP_TO_APP_FLAG) {
        run_application(JUMP_STRAIGHT_TO_APP);
    }

    // Otherwise, do a normal startup and get ready to receive firmware data
    system_clock_init();
    buttons_init();
    spi_init();

    while(1) {
        // Check for data received over SPI and process it
        parse_commands();

        // If we go too long with no SPI activity, automatically run the application
        if(exit_timer_is_expired()) {
            run_application(NORMAL_START);
        }
    }
}

Not terribly surprising how many people make custom programmers, it's usually not too difficult and sometimes you just need to!
I've been using TagConnect for all my boards if I have the space. It's just a footprint on the board with some pads, but it requires a special pogo pin connector to interface with it. They have variants that clip into the board or smaller ones without the clip holes. The only downside is the pogo pin connectors are quite expensive (~$50), but at least you only need one.

Pegasus will have a USB-C connector on the OBDII plug. The current prototype, as you know, requires running a USB cable from the mainboard out to an accessible location. Not the worst solution, but it'll be cleaner to have a removable cable, plus it can be replaced if need be.

You know, if other products implement bootloaders that operate through an interface they're connected to (H/K line, METSCI, Pegasus' CAN port, etc), Pegasus could support updating their firmware by loading the firmware image through Pegasus. :) But it's probably more important to have alternate firmware upgrade routes in the case a user doesn't have Pegasus.
 

· Linsight Designer
Joined
·
4,812 Posts
Sweet, glad you've already figured out your particular bootloader solution.

...

I have a confession: I've (still) never used a USB-C cable for data transmission... not even once, for anything, ever. I suspect many G1 Insight owners are in the same camp. If my assumption is correct, then I recommend using a USB-A USB-B connector for Pegasus firmware update process.

USB-C is certainly the future standard, but IMO USB-A USB-Bis more appropriate for this application. It's not the end of the world either way; USB-C-to-A adapters cables are cheap and transparent above the PHY layer.

...

LiBCM will never support METSCI updates... that would be so much work ;). But maybe I'll consider adding BATTSCI updates to LiMCM, so that you only need to connect one USB cable to update the entire IMA system.
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #424 ·
When I say USB-C I intend that somebody would use a USB-A to USB-C cable, which are fairly ubiquitous these days. Like for charging cell phones. C at the Pegasus end, A at the computer end. I've never used a USB-C to USB-C cable for anything, but somebody could use one for Pegasus if they had the port on their computer.

But some connector has to be on the OBDII plug. USB-B is robust but too large. Mini is fragile, micro is alright but C is pretty good! I wouldn't put an A port on it, nobody has a USB-A to A cable.
 

· Premium Member
Joined
·
3,255 Posts
When I say USB-C I intend that somebody would use a USB-A to USB-C cable, which are fairly ubiquitous these days. Like for charging cell phones. C at the Pegasus end, A at the computer end. I've never used a USB-C to USB-C cable for anything, but somebody could use one for Pegasus if they had the port on their computer.

But some connector has to be on the OBDII plug. USB-B is robust but too large. Mini is fragile, micro is alright but C is pretty good! I wouldn't put an A port on it, nobody has a USB-A to A cable.
Yo what I have so many of those xD.
 

· Registered
Joined
·
2,358 Posts
@Mario I like your 3D-printed pogo-pin clamp.

Did I ask you what app you are using for this when you posted about the buttons you made? I happen to like OpenSCAD; not sure what today's cheap (free? open source?) 3D printing model creator software is.
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #427 ·
@Mario I like your 3D-printed pogo-pin clamp.

Did I ask you what app you are using for this when you posted about the buttons you made? I happen to like OpenSCAD; not sure what today's cheap (free? open source?) 3D printing model creator software is.
Thank you!
I use SOLIDWORKS, which sadly is very not free. It is very powerful though.
I have a friend who uses the free version of Onshape, a brower-based CAD software. It's apparently very capable.
 

· Linsight Designer
Joined
·
4,812 Posts
IMO F360 is the best free program out there. AutoDesk keeps removing features from the free version, but it's still incredible. We have several paid seats at work.

However, I personally use AutoDesk Inventor 2017 (the last year they offered a perpetual license). I'll probably still be using 2017 a decade from now.
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #429 · (Edited)
One board's worth of components ready to assemble, plus my placement guide! All in all, 250 parts plus several connectors to solder by hand.

Paste goes first of course.


Ended up taking me 1hr 30min to place all these... I definitely need a pick-n-place machine. The other 5 prototypes will still be done by hand though.

And it passes the smoke test! The 5V switching power supply is working great, the switching waveforms look beautiful and it works fine up to 2x the max current it will ever need to source.
The 3.3V supply is good too, and I'm able to connect to the microcontroller, so that's at least wired properly!
I found out I accidentally ordered the wrong version of the schmitt trigger buffers, I got SOT-23 parts rather than the smaller SOT-323 I meant to get. Thankfully I don't need to change the board, just buy the correct smaller version of the part. Just some wasted money. I did later bend the leads in and hand-solder them on, but for the other 5 prototype boards I'll buy the proper part.
I also assumed the flash chip was a standard SOIC-8 footprint, it's actually a fair bit wider. Again, bend the leads in and it fit fine! No other footprint problems though, so that's good.
That's all I'm doing for today, I'm sick of staring at this board!
 

· Registered
Joined
·
890 Posts
Do you see the components when you close your eyes? That always happens to me after too much close work!
 

· Linsight Designer
Joined
·
4,812 Posts
General comments/questions:
1: Where are your reference designators?
2: What is the purpose for the MS621T lithium battery? realtime clock? Could it be a supercap instead? I see that it's rated up to 85 degC, but if nothing else a supercap doesn't need to be replaced down the road.
3: Your buck SMPS (bottom left corner) is laid out 'long'. Ideally you'd place the input caps much closer to the inductor. In a buck configuration, the input capacitor proximity is much more important (than output capacitors) because the current through the input side is discontinuous, whereas the output current is regulated by the inductor. Here's a better layout (from LiBCM):
Colorfulness Pink Font Magenta Red

(U1 is switcher, top copper fill is Vin, middle is ground, bottom ('+5V') is Vout).

4: Same SMPS: Is the diode to the left of the inductor used for over-voltage, or is this a non-synchronous buck? At 5 volts output, I recommend using a fully synchronous converter, as it will greatly improve efficiency. For a fixed +5V output, my goto is AP63205. Given your inductor size, AP63205 might not source enough current.

5: What is just above the "REV A" silkscreen? Is that a switched open drain?

6: Is the oscillator (to the left of the I2C board connector) stable that far away from the STM32? Maybe it's a low frequency RTC? If it's the system clock, stray capacitance might make it unstable.

7: Those 0.1" headers to the left of the CPU are honkers. If you're looking for a slightly smaller header, I recommend the 2mm C2C Hirose DF11 connector (e.g. DF11-8DS-2C). The terminals are still easy enough to crimp, plus you can purchase pre-crimped leads directly from the manufacturer.

...

If you do end up getting a pick and place machine, you're going to need machine vision for parts that small. For reference, our Neoden 4 machine can only accurately place parts down to 0402... and that's with machine vision and slow speeds. My personal Neoden 3 - that I use to assemble LiBCM PCBs - doesn't have machine vision, so I end up having to manually reposition parts smaller than 0805.

Given how expensive these machines are, if you're only planning to build Pegasus PCBs, then probably contract manufacturing makes more sense.
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #435 · (Edited)
1. There is a dedicated layer for reference designators that I include with the gerbers, that's how I printed the component placement guide in the first image. I prefer silkscreen designators but this board is just too densely packed to fit all of them on, so I figured I'd just go for a cleaner look and have none of them. I mean, just look at the area between the "CAN" and "I2C" text! Even my usual trick of "group the designators elsewhere and put a line showing what they refer to" wouldn't work, there's not enough space overall.

2. The MS621T is indeed a backup battery for the RTC and the microcontroller. It's rechargeable, so shouldn't need to be replaced unless it degrades to less than 10% of its nominal 3.0mAh capacity. According to this graph, if it's stored at 85C for 160 days at 3.1V, it will lose about 15% capacity. Unless you're regularly driving through the hottest deserts for several hours a day, with no A/C, the battery will spend almost no time anywhere near 85C. I'm also planning on keeping it charged to only 2.8V or so.
I was initially looking at supercaps, but I'm very limited on height under the cluster cover. Caps that were rated for -40C - 85C and were short enough were already >50% the price of this battery, large footprint, and not as readily available. The battery also has almost 10x the capacity. So I'm fine with making the customer pay an extra $1.50 to make my life easier. :)
It should also be noted that this battery only comes into effect if the car's 12V battery is disconnected, so one could say it's rather useless even including it... meh, I think it's a nice quality-of-life feature that should be present in a product like this. It will also allow me to set the time and date for you before I ship it so you won't even have to!


3. I think the input caps are pretty well placed given the pinout of the chip and location of VIN and SW. I am also willing to make slight compromises in electrical performance in exchange for aesthetics. :) Here's a closeup of the layout so you can judge it further. There is an uninterrupted ground plane under it all as well. Looking at the scope traces, I think it's performing very well.

These were all captured with a 200MHz Keysight DSOX2024A, with a 14.5V input voltage and 1A load.
Input capacitor closest to the IC:

Closeup on the voltage spike (may partially be due to probing, I even bent and trimmed my ground spring to make the probing loop as small as I could)

Input ripple with the bandwidth limit enabled

SW node, measured directly across the freewheeling diode

Rising and falling edges of SW


Ripple on 5V out


4. It's the freewheeling diode, this is indeed a non-synchronous regulator. I chose this part because I needed 40V input capability (the cluster has a 24V input TVS diode, which typically clamp around 39V at their max current. The cluster 5V regulator is also rated for 40V). I also wanted a large thermal pad to increase power dissipation, and low operating quiescent current (<100uA) to make sure Pegasus will draw very little current while sleeping. 1mA is my max, but <0.3mA is my goal.
Efficiency is really only important in this application to reduce power dissipation. At 14.5V in, and 5V/1A out, I measure 90.9% efficiency, so only 0.5W dissipated. At 0.1A efficiency is only 83.2%, but the absolute power dissipated is so low it doesn't matter.

5. That's the linear 3.3V regulator.

6. That's the RTC with integrated crystal, the 24MHz microcontroller oscillator is the SOT-23-5 under the middle of the STM32.

7. Those connectors actually are 2mm pitch, not 0.1"! The camera always makes electronics look bigger. :) I needed through-hole latching connectors. They also fit perfectly in the cluster cover:


Thank you for the thorough review and suggestions!


Definitely would want machine vision if I got a PnP.
It wouldn't be for producing Pegasus in quantity, I will get a board house to do that. I want a "prosumer"-grade one for prototype boards like this. Like $10k max. They have been getting better and better for cheaper and cheaper!
 

· Linsight Designer
Joined
·
4,812 Posts
Well defended... always good to see data, too. FYI: The spike you're seeing on the triangle waveform (input capacitor) exceeds your scope bandwidth. The ~2 ns ringing is 500 Mhz(min) ABW, which exceeds your ABW by at least 2x (but we can't tell due to Nyquist). If you have access to a higher bandwidth scope with an active head, I imagine you might see quite a bit more switching noise. Does it affect your board? Probably not. Might it be an unintentional radiator? Possibly. I've certainly seen issues with unintended radiators before.

Once I was consulting for a startup you've probably heard of... and this exact issue was killing their USB interface about once per second. Before they hired me to figure out the issue, their workaround was to write their own USB kernel that could re-enumerate the USB interface in just a few ms... so they could get up and running quick, transmit data for about a second (until the aggressor noise killed the bus), and then re-enumerate again. Fortunately that USB was only used internally, and they had ECC so they could tell when the data was bad.

Since you're already revving the PCB, my recommendation is to swap the inductor and that freewheeling diode, so that the inductor is closer to the input capacitors. This will cut your input current loop surface area in half, which will reduce radiated emissions. The current through the freewheeling diode is piecewise continuous (if your load is high enough to stay in continuous conduction mode), whereas the current from the high side FET and input capacitors is discontinuous each time to high side FET turns off.
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #437 ·
Ah, yeah, you are right about the scope bandwidth. I don't have a better scope to look with unfortunately.

That USB story is wild, hah. I guess you do what you have to do to get things working. Classic example of using software to fix a hardware problem.

Here's the best layout I could come up with, what do you think?
 

· Linsight Designer
Joined
·
4,812 Posts
Ah, yeah, you are right about the scope bandwidth. I don't have a better scope to look with unfortunately.

That USB story is wild, hah. I guess you do what you have to do to get things working. Classic example of using software to fix a hardware problem.

Here's the best layout I could come up with, what do you think?
That layout is absolutely better in every way. Ha, that's so many ground vias.
 

· Premium Member
Southern California
Joined
·
973 Posts
Discussion Starter · #439 · (Edited)
Ah, yeah, you are right about the scope bandwidth. I don't have a better scope to look with unfortunately.
I do now. :)


Tektronix DPO7104, 1GHz bandwidth and 20GS/s. Used eBay scopes are awesome, this was about 1/5 the price of an equivalent modern scope. It won't perform as well as a new scope of the same caliber, but it still has excellent specifications and features.
I'm just waiting on some 500MHz passive probes, a 1.5GHz active probe, and a 30A, 120MHz current probe to arrive. All also secondhand off eBay for 1/4 price or less.

For Pegasus, I've been slowly performing various tests that will make sure every functional aspect of the board is working properly. Then I will start writing the bootloader, then finally the firmware!
I already have 40-50 various changes I want to make, but nothing too major. So far everything has been working great, for the most part!


I also installed the power harness (required) and the signal harness (optional) in my test cluster, of course to test that functionality as well.


 
421 - 440 of 445 Posts
Top