Kia Niro BMS

User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

Yes, in your second case nothing is working as init fails as per " UARTSlaveDevicesWakeUp WD timeout".

In first case the slave com is up as there are no messages after "Daisy chain init", before "Set all slaves". You also get a response to a readAll command, 2 3 2 30 0 B0 A6 D3.
And later you get several reponds.

From the reponses it seem that you have poor communication integrety.
The last byte "D3" should be equal to the number of slaves you have connected, in your case "01".
And all of the alerts are regarding slave com.

This is a good start but I urge you to check slave com from the 17841 chip and onwards. Is all solder joints ok? Double check component values. Wiring? etc.
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

Thankyou, I think the isolator transformers im using are causing the problem. With everything wired up between the BMS and Module, I see that the signal before the transformers isn't the same after the transformers. So I will look at other ones that I can use. I will also check other components etc.

The iso transformers I have now are the SM91502ALE

EDIT: Looking at the datasheet of the SM91502ALE, it should work with my circuit
User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

I use SM91501ALE which is basically two SM91502ALE in one package. So I don't think this is the problem.
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

Do these signals look right?

TXP before transformer
TXP_before_transformer.jpg
TXP after transformer
TXP_after_transformer.jpg
TXN before transformer
TXN_before_transformer.jpg
TXN after transformer
TXN_after_transformer.jpg
User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

They don't look bad to me.
How does the RX singals look before and after the transformer?
woleg
Posts: 53
Joined: Thu May 05, 2022 6:09 pm
Has thanked: 14 times
Been thanked: 13 times

Re: Kia Niro BMS

Post by woleg »

bexander wrote: Fri Nov 21, 2025 4:15 pm Try this modified code.
BMS_test_OI_modified2.ino

EDIT:
Code updated again.
Added clearing more registers at start-up and during fault detection.
Changed setup to take numberOfSlaves, numberOfCellsPerSlave and numberOfTemperatureSensors into account.
Hi zuuus,

I assume you are running the above code and MAX17845 slaves. If you want to eliminate the possibility of hardware loopback problem use software loopback, this a bit hacky so some of the init needs to be bypassed. You should see 1 module active assuming you have the RX and TX pair wired up correctly to the slave.
Attachments
BMS_test_OI_modified2_max17845_lb.ino
(46.86 KiB) Downloaded 3 times
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

RXP before transformer
RXP_before_transformer.jpg
RXP after transformer
RXP_after_transformer.jpg
RXN before transformer
RXN_before_transformer.jpg
RXN after transformer
RXN_after_transformer.jpg
With the BMS_test_OI_modified2.ino code from bexander

EDIT: Could someone scope their signals? Then I know what the signals have to look like. Did grab another module, but still no data coming out of them
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

Did test the BMS_test_OI_modified2_max17845_lb.ino but still no data and the same errorByte 4. So I think my signals are off or are not right.
User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

The RX signals look very similar in amplitude to the TX signals, and that is a very good thing. Your signals seem ok at this stage.

In the last serial print out the last byte is 0xD3 which is very odd as it start at 0x00 and in incremented one step for each slave it passes on its way up the daisy-chain with no increments on its way down the chain. This should in your case end up with 0x01. 0xD3 equals 211 and that seem impossible to me? What happends if you connect all slave modules to thw wiring? If you can do this what is the serial output?
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

Yes 211 is indeed impossible. Don't know where this number comes from. Loose wires? I only have some cables for the loopback and all other connectors are not plugged in. So I think the 0xD3 is just a random number that the code sends? I will have a look at connecting all the slaves. Only got 2 modules missing. One module damaged and the other one lend it to a friend that also recently bought a E-208 pack. I will update my findings.

Also I get the same signal in the loopback that looks like image 1 en 3 from my post about the RX signal. Do these signal come from the MAX17854 chip on the slave PCB or from a circuit on the slave PCB. I don't think my MAX17854 is waking up? Or it doesn't recognize the signal i'm sending? This code was written for modules with a MAX17823 chip if i'm correct?
User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

Well, the 0xD3 is on every message received so it is not random, which makes it very puzzling?

Oh, now I see the problem...
You have been writing MAX17854 all the time but I thought you ment MAX17845... The 845 works the same as the 823, which is the one the code is originally designed for. The 854 does up to 14 cells compared to the other that only do 12 cells. This explains alot!
User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

After a quick look in the MAX17854 datasheet, it should be possible to port the code to work with this chip but it will take some work. Alot of the registers have different addresses, as @woleg says several times.
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

I thought I mention the chips I have on the board so there would be no confusion about what I have. It can happen to the best of us. I know it will take some work to rewrite the code. I am already thankful for you guys on the forum for helping me getting the module to work. I am happy to wait a few days for the new code. I'm guessing the newer packs use MAX17854 chips and the older packs MAX17845/23 chips? The latest date I could find in my pack was on the main BMS (that sadly is broken) 01/08/2022.
User avatar
bexander
Posts: 890
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 75 times
Been thanked: 100 times

Re: Kia Niro BMS

Post by bexander »

To be clear, I will not be doing this work as of now. I encourage you and others to have a look and give it a go.
woleg
Posts: 53
Joined: Thu May 05, 2022 6:09 pm
Has thanked: 14 times
Been thanked: 13 times

Re: Kia Niro BMS

Post by woleg »

bexander wrote: Tue Nov 25, 2025 3:45 pm After a quick look in the MAX17854 datasheet, it should be possible to port the code to work with this chip but it will take some work. Alot of the registers have different addresses, as @woleg says several times.
Your code should work fine up to the point of HELLOALL as addressing is common between MAX17823 and MAX1785x. To be clear, HELLOALL should return a valid number of slaves as is.

Whichever way you init the daisy chain, the processes is identical and you should also be fine with reading register 0 which returns the slave version for either variants. I have written a universal INO which covers both slave types, and the difference is mostly registers, setup, and balancing timers but the daisy chain init is identical.
woleg
Posts: 53
Joined: Thu May 05, 2022 6:09 pm
Has thanked: 14 times
Been thanked: 13 times

Re: Kia Niro BMS

Post by woleg »

zuuus wrote: Tue Nov 25, 2025 2:37 pm Yes 211 is indeed impossible. Don't know where this number comes from.
0xD3 is a fill byte as described in the following data sheets - so there may be an off by one issue here.

https://www.analog.com/media/en/technic ... X17843.pdf
https://www.analog.com/media/en/technic ... X17854.pdf
https://www.analog.com/media/en/technic ... 17823B.pdf
https://www.analog.com/media/en/technic ... 17841B.pdf
Fill Bytes

In the READALL command, the host sends two fill bytes
for each device in the daisy-chain. The fill bytes are the
locations within the packet and are used by the device to
place the read data. The fill-byte values transmitted by the
MAX17841B interface alternate between C2h and D3h.
As the command packet propagates through the device,
the device overwrites the appropriate fill bytes with the
register data. The device uses the ADDRESS register to
determine which specific fill bytes in the packet are to be
overwritten.
I did not know you have damaged packs. You need to start with a known good controller to isolate the problem.
zuuus
Posts: 27
Joined: Wed Sep 10, 2025 9:27 am
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time

Re: Kia Niro BMS

Post by zuuus »

woleg wrote: Tue Nov 25, 2025 6:20 pm I have written a universal INO which covers both slave types, and the difference is mostly registers, setup, and balancing timers but the daisy chain init is identical.
Is this code from your GitHub? https://github.com/analogdevicesinc/MAXREFDES1277
Im guessing if I use this it will not work because it uses the EVKIT board
Do I use BMS2_7_3 or BMS2_7_4 as a start?

I have done some c coding so I will give it a try to edit/add the registers for the MAX17854
Post Reply