BotoX / xiaomi-m365-compatible-bms

Xiaomi M365 compatible, open source firmware for ATMega328p+BQ769x0 BMS. Ninebot in proto_test branch
193 stars 45 forks source link

JBD-SP20S001 v1.7 20S BMS #44

Open JakubRybakowski opened 3 years ago

JakubRybakowski commented 3 years ago

Hello, I'm trying to adapt the software to the 20S version. Unfortunately it does not work. This BMS has two bq76930. So far I'm trying to communicate only with the first. I found the pins connected to the processor.

It is: SDA PD6 (6 arduino pin) SCL PD7 (7 arduino pin) ALERT PD3 (3 arduino pin) BOOT PD2 (2 arduino pin)

I found one more pin that is connected to the transistor. This transistor is connected to the SDA and SCL lines through a voltage divider. I think so it is BMS_I2C_FET_PIN?

Even when I adjusted, the program is still getting BMS communication error.

I know you can't help me without having this BMS. But maybe you have some tips or you know what I forgot. Or do you have any materials while you were working on the BMS 15S?

I know microprocessors and electronics. But now I sit for a few days and I can't help myself.

Of course it tests when the balancer tape is attached.

I am connecting BMS to RS232 only with TX RX and GND.

JakubRybakowski commented 3 years ago

IMG_20201027_165016 IMG_20201027_164957 IMG_20201026_102210

BotoX commented 3 years ago

Have you tried connecting the battery ground to B-? I think it might be necessary. Also check with a Multimeter if the BQ76930 is getting power.

https://www.ti.com/lit/ds/symlink/bq76940.pdf Page 4: 6 Device Comparison Table Are you using the correct I2C Address for your part?

On the 15S BMS the BMS_I2C_FET_PIN is for allowing the ATMEGA to talk with the TI chip over I2C. There might be two of those on your BMS to select to which one it is talking.

Do you have a logic analyzer? You could check if the I2C communication is coming through to the TI chip.

But yeah in the end it's all about tracing the PCB and finding out how everything is connected. Sadly I never made a schematic of the 15S BMS, I just kind of wrote down the pins I found in the code and it worked.

JakubRybakowski commented 3 years ago

Have you tried connecting the battery ground to B-? I think it might be necessary.

In fact, B- is not connected to BC0 on the PCB (pin 0 of the balancer). However, the entire BMS is powered by the balancer connector. The Atmega is powered by LDO from the BQ76930 so I assumed that was enough. I don't connect VCC3 (VREG on PCB) with RS232 3.3V. I will connect B- to the BMS and check.

Also check with a Multimeter if the BQ76930 is getting power.

From what I understand from the datasheet, bq7630 is powered from the balancer connector (pin BC0-BC10 and there is no "standard VCC" pin) and has an LDO that powers the atmega. How can I check if it is still powered? If the atmega works (is powered), I assume that the bq7630 must also work.

Are you using the correct I2C Address for your part?

Yes I am using 0x08 and CRC. Both bq7630 are the same. So they have the same address. Even tried auto detection.

bool bq769x0::determineAddressAndCrc(void)
{
  LOG_PRINTLN("Determining i2c address and whether CRC is enabled");

  // check for each address and CRC combination while also set CC_CFG to 0x19 as per datasheet
  I2CAddress = 0x08;
  crcEnabled = false;
  writeRegister(CC_CFG, 0x19);
  if (readRegister(CC_CFG) == 0x19) return true;

  I2CAddress = 0x18;
  crcEnabled = false;
  writeRegister(CC_CFG, 0x19);
  if (readRegister(CC_CFG) == 0x19) return true;

  I2CAddress = 0x08;
  crcEnabled = true;
  writeRegister(CC_CFG, 0x19);
  if (readRegister(CC_CFG) == 0x19) return true;

  I2CAddress = 0x18;
  crcEnabled = true;
  writeRegister(CC_CFG, 0x19);
  if (readRegister(CC_CFG) == 0x19) return true;

  return false;
}

Do you have a logic analyzer?

I don't have an logic analyzer.

There might be two of those on your BMS to select to which one it is talking.

The second bq76930 is connected via an I2C level separator (π220N31) and an optocoupler (BOOT). And connected via other pins (8,9). I think the BOOT pin is the same. I haven't found which pin is responsible for ALERT yet. But it doesn't matter now.

I have not found any pin responsible for choosing bq7630

Przechwytywanie

On the 15S BMS the BMS_I2C_FET_PIN is for allowing the ATMEGA to talk with the TI chip over I2C.

I think that's it? dfs

EDIT ////////////////////////////////////////////////////////////////////////////////////////

Ok, so connecting B- with battery did not help.

JakubRybakowski commented 3 years ago

@BotoX I think my BMS is damaged. That's why I bought a new one and downloaded the firmware. I can't upload the file here, can you contact me? rybakowskijakub@gmail.com

Zanooon97 commented 2 years ago

Hi guys, i am very interested in a 20s compatible bms, was you lucky with your work? I really hope you have made it. Thank you

JakubRybakowski commented 2 years ago

No, my BMS is broken. I have to buy a new one.

Zanooon97 commented 2 years ago

Is the esc not communicating with the original bms firmare?with the original firmware you have the option to read over uart soc ect.Am 09.06.2022 11:56 schrieb Jakub Rybakowski @.***>: No, my BMS is broken. I have to buy a new one.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

JakubRybakowski commented 2 years ago

I have some info about the s20 BMS.

SDA1 PIN: 6 SCL1 PIN: 7 PIN ALERT: 3 BOOT PIN: 2 FET PIN: 12

The pin alert must be HIGH during boot.

Address: 0x08 CRC: true

For the second bq7630:

SDA2 PIN: 8 SCL2 PIN: 9 PIN ALERT: NC BOOT PIN: 11 FET PIN: 12

I was able to start the first one. The second, unfortunately, not.

BLUETOOTH VDD PIN : 13

Zanooon97 commented 2 years ago

and making a translater for communication with an arduino? so you can keep the original bms firmware with bloothoot funktion... is that a solution? for example i ordered this: https://www.lithiumbatterypcb.com/product/4s-to-22s-lithium-or-lifepo4-battery-bms-with-100a-constant-current/ with internal bloothot. is it possible to make a arduino between bms and esc, the esc need only to read data i think.

JakubRybakowski commented 2 years ago

and making a translater for communication with an arduino? so you can keep the original bms firmware with bloothoot funktion... is that a solution? for example i ordered this: https://www.lithiumbatterypcb.com/product/4s-to-22s-lithium-or-lifepo4-battery-bms-with-100a-constant-current/ with internal bloothot. is it possible to make a arduino between bms and esc, the esc need only to read data i think.

You can do that too.