ISL78600 slave identify process is very slow

ISL78600 slave identification process is very slow,

I am using 10 ISL with a daisy chain process. MCU is RL78/F13 series. Below is the process I am following to identify slaves and master.

unsigned char BMS_TX_Buff[27][3] = {0x25,0x80,0x00, //0: Read User Register-1
0xA5,0xBA,0x5A, //1: Write 0x3A5A in User Register-1
0xA5,0x80,0x00, //2: Write 0x0000 in User Register-1
0x26,0xC0,0x00, //3:
0x27,0x00,0x00, //4:
0x31,0x40,0x00, //5:
0x10,0x00,0x00, //6:
0x00,0x00,0x00, //7: Dummy Bytes to Read Data
0x03,0x24,0x04, //8: Identify Master (Device-1)
0x03,0x24,0x20, //9: Identify Slave (Device-2)
0x03,0x24,0x30, //10: Identify Slave (Device-3)
0x03,0x24,0x40, //11: Identify Slave (Device-4)
0x03,0x24,0x50, //12: Identify Slave (Device-5)
0x03,0x24,0x60, //13: Identify Slave (Device-6)
0x03,0x24,0x70, //14: Identify Slave (Device-7)
0x03,0x24,0x80, //15: Identify Slave (Device-8)
0x03,0x24,0x90, //16: Identify Slave (Device-9)
0x03,0x24,0xA0, //17: Identify Slave (Device-10)
0x03,0x24,0xB0, //18: Identify Slave (Device-11)
0x03,0x24,0xC0, //19: Identify Slave (Device-12)
0x03,0x24,0xD0, //20: Identify Slave (Device-13)
0x03,0x24,0xE0, //21: Identify Slave (Device-14)
0x03,0x27,0xFE, //22: Identify Complete
0x13,0x48,0x0C, //23: Reset Master BMS IC
0xF3,0x28,0x0E, //24: Daisy SLEEP Command DC
0xF3,0X3C,0X07, //25: Daisy WAKEUP Command DC
};

unsigned char CalculateCRC4(unsigned char *ArryforCRC, unsigned char NoofByte) {
unsigned char ii;
unsigned char j;
unsigned char k;

unsigned char tempByte, result = 0;

//calculates & returns the CRC4 checksum of array contents excluding
//last low nibble. Array can be any length

//initialize bits
bit0 = 0;
bit1 = 0;
bit2 = 0;
bit3 = 0;

//simple implementation of CRC4 (using polynomial 1 + X + X^4)
for (ii = 0; ii < NoofByte; ii++) {
tempByte = *ArryforCRC++;
//last nibble is ignored for CRC4 calculations
if (ii == NoofByte - 1) {
k = 4;
} else {
k = 8;
}
for (j = 0; j < k; j++) {
//shift left one bit
carry = (tempByte & 0x80) > 0;
tempByte = (unsigned char) ((tempByte & 0x7F) * 2);
//see ISL78610 datasheet, Fig 11: 4-bit CRC calculation
ff0 = carry ^ bit3;
ff1 = bit0 ^ bit3;
ff2 = bit1;
ff3 = bit2;
bit0 = ff0;
bit1 = ff1;
bit2 = ff2;
bit3 = ff3;
}
}

//combine bits to obtain CRC4 result
result = 0;
if (bit0) {
result = (unsigned char) (result + 1);
}
if (bit1) {
result = (unsigned char) (result + 2);
}
if (bit2) {
result = (unsigned char) (result + 4);
}
if (bit3) {
result = (unsigned char) (result + 8);
}

return result;
}

unsigned char CheckDaisy(void)
{
unsigned char temp_BMS_TX, result = 0;
unsigned char DeviceState = 1;
unsigned char IdentifiedDevices = 0, DCIdx;
unsigned char BMS_Retry = 3;

ActiveDevices[0] = 0;
ActiveDevices[1] = 0;
do{
switch(DeviceState){
case 1: //Identifiy Master Device
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[8][0],&BMS_RX_Buff[0]);
BMS_SendData(&BMS_TX_Buff[8][1],&BMS_RX_Buff[1]);
BMS_SendData(&BMS_TX_Buff[8][2],&BMS_RX_Buff[2]);

BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if (BMS_Data_Ready){
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[0]);
BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[1]);
BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[2]);
BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[3]);
}
}
}

IdentifiedDevices = 1;
PIN_LED_FLT_Y_ON;
result = 0;
BMS_Retry = 3;
DeviceState++;
}else{
BMS_SendData(&BMS_TX_Buff[23][0],&BMS_RX_Buff[0]);
BMS_SendData(&BMS_TX_Buff[23][1],&BMS_RX_Buff[1]);
BMS_SendData(&BMS_TX_Buff[23][2],&BMS_RX_Buff[2]);
result = 1;
BMS_Retry--;
}
break;
case 2: //Identify Slave Devices
for (DCIdx = 0; DCIdx < 13;){
BMS_Data_Ready = 0;
temp_BMS_TX = BMS_TX_Buff[DCIdx + 9][2] | CalculateCRC4(&BMS_TX_Buff[DCIdx + 9][0],3);
BMS_SendData(&BMS_TX_Buff[DCIdx + 9][0],&BMS_RX_Buff[0]);
BMS_SendData(&BMS_TX_Buff[DCIdx + 9][1],&BMS_RX_Buff[1]);
BMS_SendData(&temp_BMS_TX,&BMS_RX_Buff[2]);


BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}

if (BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[0]);
BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[1]);
BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[2]);
BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[3]);
if(BMS_RX_Buff[0] != 0x03){
result = 2;
DeviceState = 5;
break; //break for loop
}else{
IdentifiedDevices++;
result = 0;
BMS_Retry = 3;
DCIdx++;
if (BMS_RX_Buff[1] == 0x38){
result = 4;
DeviceState = 5;
break; //break for loop
}else if (BMS_RX_Buff[1] == 0x2C){
result = 5;
DeviceState = 5;
break; //break for loop
}else if((BMS_RX_Buff[1] & 0x03) == 0x02){
DeviceState = 3;
break; //break for loop
}
}
}
}
}
}
else{
BMS_SendData(&BMS_TX_Buff[23][0],&BMS_RX_Buff[0]);
BMS_SendData(&BMS_TX_Buff[23][1],&BMS_RX_Buff[1]);
BMS_SendData(&BMS_TX_Buff[23][2],&BMS_RX_Buff[2]);
result = 1;
DeviceState = 1;
break; //break for loop
}
}
break; //break case
case 3: //Identify Complete Command
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[22][0],&BMS_RX_Buff[0]);
BMS_SendData(&BMS_TX_Buff[22][1],&BMS_RX_Buff[1]);
BMS_SendData(&BMS_TX_Buff[22][2],&BMS_RX_Buff[2]);


BMS_Delay = 500;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if (BMS_Data_Ready){
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[0]);
BMS_Delay = 50;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[1]);
BMS_Delay = 50;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_Data_Ready = 0;
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[2]);
BMS_Delay = 50;
while(!BMS_Data_Ready)
{
if (BMS_Delay == 0)
{
BMS_Data_ReadyErrorCount++;
break;
}
}
if(BMS_Data_Ready)
{
BMS_SendData(&BMS_TX_Buff[7][0],&BMS_RX_Buff[3]);
temp_BMS_TX = (IdentifiedDevices << 4) | 0x03;
if(BMS_RX_Buff[0] != temp_BMS_TX){
result = 3;
BMS_Retry--;
}else{
result = 0;
BMS_Retry = 3;
DeviceState++;
DCIdentified = TRUE;
}
}
}
}
}
else{
BMS_SendData(&BMS_TX_Buff[23][0],&BMS_RX_Buff[0]);
BMS_SendData(&BMS_TX_Buff[23][1],&BMS_RX_Buff[1]);
BMS_SendData(&BMS_TX_Buff[23][2],&BMS_RX_Buff[2]);
result = 1;
DeviceState = 1;
BMS_Retry--;
}
break;
default:
DeviceState = 5;
break;

}
if (BMS_Retry == 0) DeviceState = 5;
}while(DeviceState < 5);
NoOfDevices = IdentifiedDevices;
for (DCIdx = 0; DCIdx < IdentifiedDevices; DCIdx++){
if(DCIdx < 8){
ActiveDevices[1] = ActiveDevices[1] | (unsigned char)(1 << DCIdx);
}else{
ActiveDevices[0] = ActiveDevices[0] | (unsigned char)(1 << (DCIdx - 8));
}
}

return result;
}

Most of the time the above code identify 2 ISL, it take very long time of identify all 10 ISL. What is issue in code and how i can do by which in one time identify all ISL