It's marked confidential so becarefull...

It's marked confidential so becarefull...
Interesting, I recived it directly from them without any prerequisites so should be ok.
Got it working guys!
I'm assuming you are talking about this function in the code:EV_Builder wrote: ↑Wed Oct 19, 2022 10:27 pm Cant we better make an lookup table? For the temps?
That formula is costly...
like:
https://www.sebulli.com/ntc/index.php?l ... 10&tmax=60
Code: Select all
/***************************************************************************
* Stores measured temperature sensor voltage data in cellTemperature array *
***************************************************************************/
void storeCellTemperature(uint8_t readRegisterData[29])
{
int8_t cellTemperature[12];
for(int i=0; i<12; i++)
{
if((i == 0) || (i == 7) || (i == 8) || (i == 11)) // No temp sensor connected
{
cellTemperature[i] = 0;
}
else
{
uint16_t beta = 3800;
uint16_t measTemperature = ((readRegisterData[25-i*2] << 8) + readRegisterData[24-i*2]);
measTemperature = (measTemperature >> 4);
int8_t temperature = beta / (log((float)measTemperature / (4095 - measTemperature)) + beta / 298.15) - 273;
cellTemperature[i] = temperature;
}
}
cellBlockTemp[0] = cellTemperature[1];
cellBlockTemp[1] = cellTemperature[2];
cellBlockTemp[2] = cellTemperature[3];
cellBlockTemp[3] = cellTemperature[5];
cellBlockTemp[4] = cellTemperature[6];
cellBlockTemp[5] = cellTemperature[9];
cellBlockTemp[6] = cellTemperature[10];
cellBlockTemp[7] = cellTemperature[4]; // Battery box internal temperature
}
Code: Select all
int8_t temperature = beta / (log((float)measTemperature / (4095 - measTemperature)) + beta / 298.15) - 273;
Yes indeed correct assumptions
Code: Select all
int8_t temperatureArray[52] = {80, 76, 72, 69, 65, 62, 59 ... -18, -20}
int8_t ADCLookUpValue = (ADC >> 6) - 7;
if(ADCLookUpValue < 0) {
return 0;
}
else if(ADCLookUpValue > 51) {
return 51;
}
else
return ADCLookUpValue;
}
int8_t temperature = temperatureArray[ADCLookUpValue];
Please post your code or a link to it in this thread. Helps everyone to find it.EV_Builder wrote: ↑Thu Oct 20, 2022 7:16 am Yeah i made a lookup table class with C# GUI tool to generate the table / code.
It's on the forum.
You can fill in a table with Temp and a column with the ADC value.
It will linear interpolate between the 2 cells. I Changed your sheet (easy) to 3 degrees jump (to save some RAM).
(i don't think the error would be big in each step of 3 degrees agree?)
I see it as a simple but solid way to add dynamic behavior.
Do have to add that its not rock solid code yet...
For example first column should go from min to max (order).
Code: Select all
uint16_t beta = 3800;
uint16_t measTemperature = ((readRegisterData[25-i*2] << 8) + readRegisterData[24-i*2]);
measTemperature = (measTemperature >> 4);
int8_t temperature = beta / (log((float)measTemperature / (4095 - measTemperature)) + beta / 298.15) - 273;
cellTemperature[i] = temperature;
Code: Select all
const int8_t tempMap[52] = {80,76,72,69,65,62,59,57,54,52,49,47,45,43,42,40,38,36,35,33,32,30,29,27,26,
24,23,21,20,18,17,16,14,13,11,10,8,7,5,4,2,0,-1,-3,-5,-7,-9,-11,-13,-16,-18,-20};
uint16_t dataADC = ((readRegisterData[25-i*2] << 8) + readRegisterData[24-i*2]);
dataADC = (dataADC >> 10); // >> 4 for 12bit value & >> 6 for correct array index size
if(dataADC < 7) {
dataADC = 7;
}
if(dataADC > 58) {
dataADC = 58;
}
cellTemperature[i] = tempMap[dataADC-7];
Aha, that makes sens.EV_Builder wrote: ↑Fri Oct 21, 2022 12:55 pm Programs run from RAM too. So the log function isn't loaded anymore. And It might be quite a big function.
What step of the initialisation is failing? Have you made the correct adjustments to the SW to use only one slave? Is the slave wired correctly?inkubate1981 wrote: ↑Sun Nov 13, 2022 12:59 pm Hi there,
Firstly many thanks for the information and code posted here. This has allowed me to progress a long way already towards using the MAX17841b IC.
I am working on a communication interface so I can get the BMS data from a bank of 6 Land Rover Samsung SDA modules which use this interface. I have generally used the circuit diagram published here with some changes to suit my application. The main change in the BMS interface is that I recovered the isolation transformers from the original BMS controller rather than buying new - these are 2 x Sumida CEP99 devices. I have tried to communicate with a single battery module for the time being but the chain initialisation is failing. As such I am now checking the hardware first and notice what may be the problem. The Rx back from the battery on the MAX17841 side of the isolation is AC. I doubt this is correct so ask if anyone can please assist and let me know if this is the problem? My circuit is below and I have marked the scope test points as TP A and TP B. They are both ref to GND. Many thanks.
Thanks for getting back to me. The chain initialisation failed, however I scoped the signal at the Rx of the IC and it was a distorted triangle wave. I'm going to reduce the 1.5k resistors as maybe the RC combination with my different xfmrs is slowing the rise / fall. I checked the Maxim schematic for their dev board and they use 470R so I'll change these first and see if I can get the waveform clean. The plots pictured on my previous post are on the xfmr side of the resistors.
To summarize, the signal at TP A and TP B looks resonable and the signal received back at the max17841 looks terrible, correct?inkubate1981 wrote: ↑Thu Nov 17, 2022 11:09 pm Thanks for getting back to me. The chain initialisation failed, however I scoped the signal at the Rx of the IC and it was a distorted triangle wave. I'm going to reduce the 1.5k resistors as maybe the RC combination with my different xfmrs is slowing the rise / fall. I checked the Maxim schematic for their dev board and they use 470R so I'll change these first and see if I can get the waveform clean. The plots pictured on my previous post are on the xfmr side of the resistors.
I'll post when I've tested and hopefully will work. Luckily the pin out is marked on the battery module bms PCB. I cross referenced to the original cables so expect this is ok. I'll share once I got a working system.
I've made quite a few adjustments to work for 1 X test board and then the 6 modules in my pack. Your code has made this much more possible for me and I understand most of it now so I think if the hardware works I can debug from there.