LiBSU - Redesigning the "Battery Support Unit" to Support Lithium

Discussion in 'Gen 3 Prius Technical Discussion' started by mudder, Jun 7, 2024.

  1. NHP10L

    NHP10L New Member

    Joined:
    Sunday
    5
    0
    0
    Location:
    Calgary
    Vehicle:
    2012 Prius c
    Model:
    N/A
    So, is the inverter enforcing limits based on HV readings or its own readings?
    Would be fun if the inverter blindly trusts and use the HV readings ;)

    That's only for my Prius C tho, not sure a regular Prius behaves differently.

    I also recall that you would like the LiBSU to work for any chemistry, while making it non user interactable. Any thoughts on the implementation yet?
     
  2. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    27,590
    18,186
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    There's a middleman in the story being left unnamed: in a gen 3 Prius, the BSU is really talking to the power management control ECU, under the dash. That ECU drives most 'macro' behaviors here being attributed to the inverter. Most of the comments above about what the inverter does or what the inverter cares about are really about the power management control ECU.

    (In fact, the power management control ECU is really just talking to another ECU, the MG ECU that's inside the inverter enclosure. The MG ECU is what directly controls the inverter switching, and all the 'micro' details like synchronizing to the MG rotors' rotational position.)
     
    mudder, hurricos and Brian1954 like this.
  3. NHP10L

    NHP10L New Member

    Joined:
    Sunday
    5
    0
    0
    Location:
    Calgary
    Vehicle:
    2012 Prius c
    Model:
    N/A
    Would be great if you can share any diagrams, or link us to posts about this in detail!
     
  4. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    27,590
    18,186
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV

    Attached Files:

    • mfc.png
      mfc.png
      File size:
      7.5 KB
      Views:
      0
    NHP10L likes this.
  5. mudder

    mudder Active Member

    Joined:
    Mar 13, 2024
    265
    336
    0
    Location:
    Chattanooga, TN
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    I don't know (yet).

    What do you mean by "non user interactable"?

    Correct.

    For now, I've abstracted the rest of the Toyota system, treating it all as a black box, because that's all I need to develop LiBSU so far. LiBSU could be talking to the fuel pump – which then relayed controls to the head lights, which forwarded them to the inverter – and it wouldn't make any difference for LiBSU development purposes. Modularity and black boxes are awesome concepts. I can peel back the non-BSU architecture later, if needed.

    Noted.

    Noted.

    Noted.
     
  6. NHP10L

    NHP10L New Member

    Joined:
    Sunday
    5
    0
    0
    Location:
    Calgary
    Vehicle:
    2012 Prius c
    Model:
    N/A
    I should rephrase my question, how do I tell LiBSU my battery chemistry and battery capacity?
     
  7. Headgasket

    Headgasket New Member

    Joined:
    Tuesday
    1
    0
    0
    Location:
    SLC, UT
    Vehicle:
    2010 Prius
    Model:
    Three
    New to the site but not new to the Prius! I'll be following this project it looks pretty sweet. This stuff looks like the reason I dropped out of electrical engineering classes LOL.
     
  8. mudder

    mudder Active Member

    Joined:
    Mar 13, 2024
    265
    336
    0
    Location:
    Chattanooga, TN
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    Update on my previous video (post#73), wherein I stated:
    "I haven't used Microchip's MPLAB enough yet to have a negative opinion, but I've used it enough to know I'll probably have a negative opinion":

    I've used MPLAB enough now to verify it is in fact a steaming pile of fail (for more reasons than the one issue I mention next).

    I spent yesterday and this afternoon troubleshooting why none of my analog inputs worked correctly. ChatGPT was useless as a troubleshooting tool, confidently hallucinating some of the worst debug code I've ever seen. At one point it was trying to get me to configure the ADC to run at 12 MHz (8x more than its max rated frequency). For some reason it kept confusing register names and values with other unknown MCUs. ChatGPT was truly a waste of time troubleshooting this issue.

    I'll spare all the details, but the ultimate root cause was I had the wrong CPU configured (totally my mistake). LiBSU uses the AVR64DB48, but I incorrectly selected AVR64DB64. Totally my fault, but somehow Microchip's official tool never bothered to tell me that the device IDs were different. It just uploaded the code blindly.

    Even with the incorrect part selected, the MCU worked for the most part. Over the past few days I've verified USARTs (including USB), timers, clock, GPIO, and pretty much all the digital stuff. No issues. However, the analog signals were wonky in really bizarre ways.

    The 3rd party programmer I purchased last week showed up today. I was excited because this tool allows me to ditch Microchip MPLAB entirely. I can now use GCC+avrDude to program the board directly. In doing so, it immediately identified the root cause:
    WARNING - ID read ('1E9617') does not match expected device id! ('1E9616')

    In plain English, this 3rd party tool is saying:
    "Hey dummy, you've got the wrong MCU selected"

    Unlike Microchip's native MPLAB programming environment, the 3rd party programming tool actually verifies the MCU's device ID matches the compiler settings. I'm really amazed I got this far with the wrong MCU selected... again, pretty much all the digital stuff works correctly.

    And what do you know, with the correct MCU selected the ADC works correctly. Crazy!
     
    #88 mudder, Dec 10, 2025 at 5:18 PM
    Last edited: Dec 10, 2025 at 5:27 PM
  9. hurricos

    hurricos Junior Member

    Joined:
    Aug 20, 2023
    56
    16
    0
    Location:
    Burlington, Vermont
    Vehicle:
    2008 Prius
    Model:
    One
    I, too, hate MPLAB. Want to share the new programmer?

    I admittedly really like my XGecu T48, but I do a lot of nonsense with DIPs and EEPROM programmable stuff, so.
     
    mudder likes this.
  10. mudder

    mudder Active Member

    Joined:
    Mar 13, 2024
    265
    336
    0
    Location:
    Chattanooga, TN
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    HV-UPDI Friend...
    ...best $10 I spent this year. It worked immediately out of the box, which is more than I can say for the four different versions I attempted to build myself. I suspect the Arduino core was sniping my Uno-derived kludges, which was preventing the upload from succeeding. Redditors say the CH340 is the best SerialUPDI transceiver, but I didn't have one on hand... UPDI Friend uses CH340 and works great. Regardless, I don't care what the root cause was, as UPDI Friend solves the problem for the cost of lunch.
     
    #90 mudder, Dec 10, 2025 at 5:26 PM
    Last edited: Dec 10, 2025 at 6:37 PM
    hurricos likes this.