This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ76PL455A-Q1: Series communication between two Bq76pl455a-Q1 chips on the same board

Part Number: BQ76PL455A-Q1
xiaoming geng

Dears:

There are some troubles about series communication between two Bq76pl455a-Q1 chips on the same board.According to the manual about BQ76PL455AQ1,I made the following configuration about series communication.But the expected result did not appear, I am also not sure if there is an communication between the two chips.Please help me to check the configuration,and if it is incorrect please show me how to insolve this problem,ecpecte your response,thanks!

Best Regards!

xiaoming GENG

const uint8_t PWRCONFIG[5]={0xf1,0x0f,0x80,0x55,0xa3};
/*configu for auto-address*/
//const uint8_t COMCONFIG[6]={0xf2,0x10,0x00,0xe0,0x32,0xf5};//Communication Configuration for auto_address125k
const uint8_t COMCONFIG[6]={0xf2,0x10,0x10,0xe0,0x3f,0x35};//Communication Configuration for auto_address250k
const uint8_t ADDR_SEL[5]={0xf1,0x0e,0x10,0x54,0x5f};// auto addressing to select address
const uint8_t AUTO_ADDRESS[5]={0xf1,0x0c,0x08,0x55,0x35};//auto_address mode
const uint8_t CONFIGADDR00[5]={0xf1,0x0a,0x00,0x57,0x53};//confige device 1 to address 0
const uint8_t CONFIGADDR01[5]={0xf1,0x0a,0x01,0x96,0x93};//confige device 2 to address 1
const uint8_t ReadAddress00[6]={0x81,0x00,0x0a,0x00,0x2e,0x9c};//read device 1 address 
//const uint8_t ReadAddress00[6]={0x00,0x00,0x00,0x00,0x00,0x00};
const uint8_t ReadAddress01[6]={0x81,0x01,0x0a,0x00,0x7f,0x5c};//read device 1 address 
const uint8_t HighSideCommDisable[7]={0x92,0x01,0x10,0x10,0x20,0xb5,0xfc};//disable high-side receiver on differential interface on top of stack 
const uint8_t LowSideCommDisable[7]={0x92,0x00,0x10,0x10,0xc0,0xb5,0x88};//disable low-side trasmitter on differential interface on bottom of stack 
/*CLEAR ALL FAULT*/
const uint8_t CLEAR_FALUT_SUM01[7]={0x92, 0x01, 0x52, 0xFF,0xC0, 0x58,0x50};//clear device01 fault,start at top
const uint8_t CLEAR_FALUT_SUM00[7]={0x92, 0x00, 0x52, 0xFF,0xC0, 0x59,0xAC};//clear device00 fault
/*broadcast configuration for AFE*/
const uint8_t SMPL_SLY1[5]={0xf1,0x3d,0x00,0x41,0x63};//initial sampling delay :no delay
const uint8_t Cell_CSPER[5]={0xf1,0x3e,0xbb,0x01,0xe0};//first voltage and internal sampling period :60us
const uint8_t AUX_SPER[8]={0xf4,0x3f,0xbb,0xbb,0xbb,0xbb,0x67,0x33};// first tempe sample period:60us
const uint8_t OVERSMPL[5]={0xf1,0x07,0x7b,0x13,0xe0};//oversampling rate 12.6us
const uint8_t NCHAN[5]={0xf1,0x0d,0x10,0x54,0xaf}; //16 cells
const uint8_t CHANNELS[8]={0xf4,0x03,0xff,0xff,0xff,0x00,0x10,0xa0};//all cell and AUX and both internal tempe channels

  • Hi Xiaoming,

    Can you please explain what hardware you are using, is it our EVM board or custom? And please test your boards using our GUI first to check if the boards are working properly before moving towards custom software.

    Best Regards,

    Taylor
  • Hi Taylor,
    Thanks for your help.
    It is a custom board for one certain peoject with two BQ76PL455A-Q1 devices for 32 cells. I have made a successful board with one BQ76PL455A-Q1 for 16 cells before this and it works well. This matter is too urgent to test the EVM board with enough time.
  • Hi xiaoming,

    Ok, please test your custom hardware with our GUI and then our example mcu code if you are using a TMS570. That way we can tell if your hardware or software is at fault. Once you have verified if the GUI is working properly and recognizes both devices, then the second step would be to change your sw follow our auto address sequence exactly as in our software reference guide here: www.ti.com/.../slva617a.pdf

    Best Regards,

    Taylor
  • HI Taylor,

    Now there is such a sitiuation :the bottom stack device works well,but the top stack device do not response yet.I made the configuration with broadcast write command, they should have the same configuration.so if one responsed the right data,so did the other one.But the expected

    reusult din not appear.I can not find out what cause this,I hope you can help me to resolve this trouble.The software configuration is as above.The series communication circuit is as below screenshot,please help me to check if it is correct.

  • RH850TI32S.PDFTayor,

    First,thanks for your ansower with fully patient,thank you very much.There is an difference betwwen schematic and board ,i did not use the series fault sircuit thus it appears in the schematic,there is only comm circuit for using on the board,if it affect the result? Now my mcu is the renesas,does that mean i can not use the GUI for test?

  • #include "extern.h"
    uint8_t UartSendCont=0;
    extern uint8_t uart_rx_date[55];
    uint16_t Volt[32];
    uint8_t  Tempe[16];
    uint8_t  InTempeDevice[4];
    uint16_t ADTempe;
    
       
        
    const uint16_t crc16_table[256] = {
    	0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
    	0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
    	0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
    	0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
    	0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
    	0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
    	0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
    	0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
    	0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
    	0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
    	0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
    	0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
    	0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
    	0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
    	0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
    	0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
    	0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
    	0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
    	0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
    	0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
    	0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
    	0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
    	0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
    	0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
    	0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
    	0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
    	0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
    	0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
    	0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
    	0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
    	0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
    	0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
    };
    
    const uint8_t PWRCONFIG[5]={0xf1,0x0f,0x80,0x55,0xa3};
    /*configu for auto-address*/
    //const uint8_t COMCONFIG[6]={0xf2,0x10,0x00,0xe0,0x32,0xf5};//Communication Configuration for auto_address125k
    const uint8_t COMCONFIG[6]={0xf2,0x10,0x10,0xe0,0x3f,0x35};//Communication Configuration for auto_address250k
    const uint8_t ADDR_SEL[5]={0xf1,0x0e,0x10,0x54,0x5f};// auto addressing to select address
    const uint8_t AUTO_ADDRESS[5]={0xf1,0x0c,0x08,0x55,0x35};//auto_address mode
    const uint8_t CONFIGADDR00[5]={0xf1,0x0a,0x00,0x57,0x53};//confige device 1 to address 0
    const uint8_t CONFIGADDR01[5]={0xf1,0x0a,0x01,0x96,0x93};//confige device 2 to address 1
    const uint8_t ReadAddress00[6]={0x81,0x00,0x0a,0x00,0x2e,0x9c};//read device 1 address  
    //const uint8_t ReadAddress00[6]={0x00,0x00,0x00,0x00,0x00,0x00};
    const uint8_t ReadAddress01[6]={0x81,0x01,0x0a,0x00,0x7f,0x5c};//read device 1 address  
    const uint8_t HighSideCommDisable[7]={0x92,0x01,0x10,0x10,0x20,0xb5,0xfc};//disable high-side receiver on differential interface on top of stack 
    const uint8_t LowSideCommDisable[7]={0x92,0x00,0x10,0x10,0xc0,0xb5,0x88};//disable low-side trasmitter on differential interface on bottom of stack 
    /*CLEAR ALL FAULT*/
    
    const uint8_t CLEAR_FALUT_SUM[6]={0xf2,0x82, 0xFF,0xC0, 0xd2,0xc9};//clear device00 fault
    /*CLEAR device state FAULT*/
    const uint8_t CLEAR_FALUT_state[5]={0xf1,  0x81, 0x38, 0x6d,0xb1};//clear device01 fault,start at top
    
    const uint8_t SMPL_SLY1[5]={0xf1,0x3d,0x00,0x41,0x63};//initial sampling delay :no delay
    const uint8_t Cell_CSPER[5]={0xf1,0x3e,0xbb,0x01,0xe0};//first voltage and internal sampling period :60us
    const uint8_t AUX_SPER[8]={0xf4,0x3f,0xbb,0xbb,0xbb,0xbb,0x67,0x33};// first tempe sample period:60us
    const uint8_t OVERSMPL[5]={0xf1,0x07,0x7b,0x13,0xe0};//oversampling rate 12.6us
    const uint8_t NCHAN[5]={0xf1,0x0d,0x10,0x54,0xaf};  //16 cells
    const uint8_t CHANNELS[8]={0xf4,0x03,0xff,0xff,0xff,0x00,0x10,0xa0};//all cell and AUX and both internal tempe channels
    /*read cells*/
    const uint8_t BroadcastSample[5]={0xf1,0x02,0x00,0x50,0x93};/* send broadcast to all devices to sample adn store results without response*/ 
    const uint8_t ReqRespDevice01[6]={0x81,0x01,0x02,0x20,0x79,0x44};/*send single devices01 with response,16 cells,8 AUX tempe,*/
    const uint8_t ReqRespDevice00[6]={0x81,0x00,0x02,0x20,0x28,0x84};/*send single devices00 with response*/
    /*CELL Banlance CHANNEL SEL*/
     const uint8_t TX_Volt_Command[10]     = {0x85,0x00,0x02,0x00,0xff,0xff,0x00,0x00,0xC9,0x99}; 
     const uint8_t TX_Tempe_Command[10]    = {0x85,0x00,0x02,0x00,0x00,0x00,0xff,0x00,0x88,0x4d};
    const uint8_t SMPL_SLY11[6]={0x91,0x00,0x3d,0x00,0x3c,0x6c};//initial sampling delay :no delay
    const uint8_t Cell_CSPER1[6]={0x91,0x00,0x3e,0xbb,0x7c,0xef};//first voltage and internal sampling period :60us
    const uint8_t AUX_SPER1[7]={0x92,0x00,0x3f,0x44,0x44,0x33,0x00};// first tempe sample period:12.6us
    const uint8_t OVERSMPL1[6]={0x91,0x00,0x07,0x7b,0x6e,0xef};//oversampling rate 12.6us
    const uint8_t TX_Power_Config1[6]     = {0x91,0x00,0x0f,0x80,0xf9,0xd9};
    uint8_t TI_CBCHANSEL01[7]={0xa2,0x01,0x14,0x00,0x00,0x00,0x00};
    uint8_t TI_CBCHANSEL00[7]={0xa2,0x01,0x14,0x00,0x00,0x00,0x00};
    void delay(uint8_t num)
    {
    	uint8_t i,j;
    	for(i=0;i<num;i++)
    	{
    		for(j=0;j<100;j++)
    		{;}
    		
    	}
    }
    uint16_t CRC16(uint8_t *pBuf, uint8_t nLen )
    {
    	int i;
            uint16_t wCRC=0;
    	for (i = 0; i < nLen; i++)
    	{
    		wCRC ^= (*pBuf++) & 0x00FF;
    		wCRC= crc16_table[wCRC & 0x00FF] ^ (wCRC >> 8);
    	}
    	return wCRC;
    }
    void COMCONFIG455(void)//Communication Configuration for auto_address250k
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x11;
    	Uart_midbuffer[2]=0xe0;
    	//Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void PWRCONFIG455(void)//sampling delay 100us
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x0f;
    	Uart_midbuffer[2]=0x80;
    	//Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void ADDR_SEL455(void)//auto addressing???
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x0e;
    	Uart_midbuffer[2]=0x19;
    	//Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void AUTO_ADDRESS455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x0c;
    	Uart_midbuffer[2]=0x08;
    	//Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void CONFIGADDR00455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x0a;
    	Uart_midbuffer[2]=0x00;
    	//Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void CONFIGADDR01455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x0a;
    	Uart_midbuffer[2]=0x01;
    	//Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void ReadAddress00455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0x81;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x0a;
    	Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void ReadAddress01455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0x81;
    	Uart_midbuffer[1]=0x01;
    	Uart_midbuffer[2]=0x0a;
    	Uart_midbuffer[3]=0x00;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void HighSideCommDisable455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x01;
    	Uart_midbuffer[2]=0x10;
    	Uart_midbuffer[3]=0x20;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void LowSideCommDisable455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x10;
    	Uart_midbuffer[3]=0xc0;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void CLEAR_FALUT_SUM455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0xf2;
    	Uart_midbuffer[1]=0x52;
    	Uart_midbuffer[2]=0xff;
    	Uart_midbuffer[3]=0xc0;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void CLEAR_FALUT_state455(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf2;
    	Uart_midbuffer[1]=0x51;
    	Uart_midbuffer[2]=0xff;
    	//Uart_midbuffer[3]=0xc0;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void SMPL_SLY1455(void)//no delay
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x3d;
    	Uart_midbuffer[2]=0x00;
    	//Uart_midbuffer[3]=0xc0;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void Cell_CSPER455(void)//60us
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x3e;
    	Uart_midbuffer[2]=0xbb;
    	//Uart_midbuffer[3]=0xc0;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xff;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void AUX_SPER455(void)//60us
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[8];
    	Uart_midbuffer[0]=0xf4;
    	Uart_midbuffer[1]=0x3f;
    	Uart_midbuffer[2]=0xbb;
    	Uart_midbuffer[3]=0xbb;
     	Uart_midbuffer[4]=0xbb;
    	Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],6);
    	
     	Uart_midbuffer[6]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[7]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<8;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void OVERSMPL455(void)//12.6us NCHAN
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x07;
    	Uart_midbuffer[2]=0x7b;
    	//Uart_midbuffer[3]=0xbb;
     	//Uart_midbuffer[4]=0xbb;
    	//Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void NCHAN455(void)// NCHAN
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x0d;
    	Uart_midbuffer[2]=0x10;
    	//Uart_midbuffer[3]=0xbb;
     	//Uart_midbuffer[4]=0xbb;
    	//Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void CHANNELS455(void)// NCHAN
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[7];
    	Uart_midbuffer[0]=0xf3;
    	Uart_midbuffer[1]=0x03;
    	Uart_midbuffer[2]=0xff;
    	Uart_midbuffer[3]=0xff;
     	Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],5);
    	
     	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[6]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<7;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void BroadcastSample455(void)// NCHAN
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[5];
    	Uart_midbuffer[0]=0xf1;
    	Uart_midbuffer[1]=0x02;
    	Uart_midbuffer[2]=0x00;
    	//Uart_midbuffer[3]=0xff;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],3);
    	
     	Uart_midbuffer[3]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<5;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void ReqRespDevice01455(void)// NCHAN
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0x81;
    	Uart_midbuffer[1]=0x01;
    	Uart_midbuffer[2]=0x02;
    	Uart_midbuffer[3]=0x20;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void ReqRespDevice00455(void)// NCHAN
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
    	Uart_midbuffer[0]=0x81;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x02;
    	Uart_midbuffer[3]=0x20;
     	//Uart_midbuffer[4]=0xff;
    	//Uart_midbuffer[5]=0xbb;
    	//Uart_midbuffer[6]=0x00;
    	//Uart_midbuffer[7]=0x00;
    	//Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=CRC16(&Uart_midbuffer[0],4);
    	
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    		delay(1);
    }
    void TIConfiInit(void)
    {
     	
    	CLEAR_FALUT_SUM455();
    	CLEAR_FALUT_state455();
    	PWRCONFIG455();
    	COMCONFIG455();
    	ADDR_SEL455();
    	AUTO_ADDRESS455();
    	//delay(1);
    	CONFIGADDR00455();
    	//delay(1);
    	CONFIGADDR01455();
    	//delay(1);
    	//ReadAddress00455();
    	//delay(1);
    	//ReadAddress01455();
    	//delay(1);
    	//HighSideCommDisable455();
    	//LowSideCommDisable455();
    	SMPL_SLY1455();
    	Cell_CSPER455();
    	AUX_SPER455();
    	OVERSMPL455();
    	NCHAN455();
    	CHANNELS455();
    }
    void TIConfiInit1(void)
    {
    	UART_send_string1(&SMPL_SLY11[0],6);
    	delay(1);
    	UART_send_string1(&Cell_CSPER1[0],6);
    	delay(1);
    	UART_send_string1(&AUX_SPER1[0],7);
    	delay(1);
    	UART_send_string1(&OVERSMPL1[0],6);
    	delay(1);
    	UART_send_string1(&TX_Power_Config1[0],6);
    }
    
    
    
    void UartSendCommand(void)
    {
    	if(UartSendCont==0)
    	{
    		UART_send_string1(&ReqRespDevice01[6],6);
    		//delay(5);
    		UartSendCont=1;
    	}
    	if(UartSendCont==2)
    	{
    		UART_send_string1(&ReqRespDevice00[6],6);
    		//delay(5);
    		UartSendCont=3;
    	}
    	
    }
    void UartCRCCheck(void)
    {
    	volatile uint8_t  data_index;
    	volatile uint16_t VoltDevice00[16];
    	volatile uint16_t VoltDevice01[16];
    	volatile uint8_t  TempeDevice00[8];
    	volatile uint8_t  TempeDevice01[8];
    	volatile uint8_t  InTempeDevice00[2];
    	volatile uint8_t  InTempeDevice01[2];
    	volatile uint32_t middlebuff;
    	if((UartSendCont==1)&&(CRC16(&uart_rx_date[0],55)==0))
    	{
    		for(data_index=0;data_index<16;data_index++)
    		{
    			middlebuff=(uart_rx_date[32-data_index*2]&0x00ff)+(uart_rx_date[32-data_index*2-1]&0xff00);
    			middlebuff*=5000;
    			middlebuff/=65535;
    			VoltDevice01[data_index]=middlebuff&0xffff;
    		}
    		for(data_index=0;data_index<8;data_index++)
    		{
    			//ADTempe=(uart_rx_date[48-data_index*2]&0x00ff)+(uart_rx_date[48-data_index*2-1]&0xff00);
    			//TempeDevice01[data_index]= look1_iu16lu64n48yu8tu_Qhph2rVP(ADTempe, ((const uint16_t *)
                                                     // &(ADTempeTable[0])), ((const uint8_t *)&(TempeTable[0])), 22U);
    		}
    		for(data_index=0;data_index<2;data_index++)
    		{
    			//ADTempe=(uart_rx_date[52-data_index*2]&0x00ff)+(uart_rx_date[52-data_index*2-1]&0xff00);
    			//InTempeDevice01[data_index]= look1_iu16lu64n48yu8tu_Qhph2rVP(ADTempe, ((const uint16_t *)
                                                     // &(ADTempeTable[0])), ((const uint8_t *)&(TempeTable[0])), 22U);
    		}
    		UartSendCont=2;
    	}
    	if((UartSendCont==3)&&(CRC16(&uart_rx_date[0],55)==0))
    	{
    		for(data_index=0;data_index<16;data_index++)
    		{
    			middlebuff=(uart_rx_date[32-data_index*2]&0x00ff)+(uart_rx_date[32-data_index*2-1]&0xff00);
    			middlebuff*=5000;
    			middlebuff/=65535;
    			VoltDevice00[data_index]=middlebuff&0xffff;
    		}
    		for(data_index=0;data_index<8;data_index++)
    		{
    			//ADTempe=(uart_rx_date[48-data_index*2]&0x00ff)+(uart_rx_date[48-data_index*2-1]&0xff00);
    			//TempeDevice00[data_index]= look1_iu16lu64n48yu8tu_Qhph2rVP(ADTempe, ((const uint16_t *)
                                                     // &(ADTempeTable[0])), ((const uint8_t *)&(TempeTable[0])), 22U);
    		}
    		for(data_index=0;data_index<2;data_index++)
    		{
    			//ADTempe=(uart_rx_date[52-data_index*2]&0x00ff)+(uart_rx_date[52-data_index*2-1]&0xff00);
    			//InTempeDevice00[data_index]= look1_iu16lu64n48yu8tu_Qhph2rVP(ADTempe, ((const uint16_t *)
                                                     // &(ADTempeTable[0])), ((const uint8_t *)&(TempeTable[0])), 22U);
    		}
    		UartSendCont=4;
    	}
    	if(UartSendCont==4)
    	{
    		for(data_index=0;data_index<16;data_index++)
    		{
    			Volt[data_index]   =VoltDevice00[data_index];
    			Volt[data_index+16]=VoltDevice01[data_index];
    		}
    		for(data_index=0;data_index<8;data_index++)
    		{
    			Tempe[data_index]=TempeDevice00[data_index];
    			Tempe[data_index+8]=TempeDevice00[data_index];
    		}
    		for(data_index=0;data_index<2;data_index++)
    		{
    			InTempeDevice[data_index]=InTempeDevice00[data_index];
    			InTempeDevice[data_index+2]=TempeDevice01[data_index];
    		}
    		UartSendCont=0;
    	}
    }
    //void GetVoltMax(void)
    //{
    	
    //}
    void UartSend455VBAT(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[11];
    	Uart_midbuffer[0]=0x86;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x02;
    	Uart_midbuffer[3]=0x00;
     	Uart_midbuffer[4]=0xff;
    	Uart_midbuffer[5]=0xff;
    	Uart_midbuffer[6]=0x00;
    	Uart_midbuffer[7]=0x00;
    	Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<9;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[9]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[10]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<11;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    	
    }
    
    void UartSend455TEMP(void)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[11];
     	Uart_midbuffer[0]=0x86;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x02;
    	Uart_midbuffer[3]=0x00;
    	Uart_midbuffer[4]=0x00;
    	Uart_midbuffer[5]=0x00;
    	Uart_midbuffer[6]=0xff;
    	Uart_midbuffer[7]=0xc3;
    	Uart_midbuffer[8]=0x7b;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<9;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[9]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[10]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<11;cnt++)
    		R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    
    
    void UartSend455VON1()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x13;
    	Uart_midbuffer[3]=0x08;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    
    
    void UartSend455VON2()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x1f;
    	Uart_midbuffer[3]=0x05;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    
    
    void UartSend455VON3(uint16_t PL455_channel)
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[7];
     	Uart_midbuffer[0]=0x92;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x14;
    	Uart_midbuffer[3]=PL455_channel>>8;
    	Uart_midbuffer[4]=PL455_channel;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<5;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[6]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<7;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    
    void UartSend455VON4()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x81;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x14;
    	Uart_midbuffer[3]=0x01;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    void UartSend455set()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x28;
    	Uart_midbuffer[3]=0x00;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    void UartSend455reset()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x11;
    	Uart_midbuffer[3]=0xf8;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    
    }
    void UartSend455setchannel()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x0d;
    	Uart_midbuffer[3]=0x05;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }
    void UartSend455clear0()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[7];
     	Uart_midbuffer[0]=0x92;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x82;
    	Uart_midbuffer[3]=0xff;
    	Uart_midbuffer[4]=0xc0;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<5;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[6]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<7;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    
    }
    void UartSend455clear1()
    {
    	uint8_t cnt;
    	uint16_t Uart_crcbuffer;
    	uint8_t Uart_midbuffer[6];
     	Uart_midbuffer[0]=0x91;
    	Uart_midbuffer[1]=0x00;
    	Uart_midbuffer[2]=0x81;
    	Uart_midbuffer[3]=0x38;
    	Uart_crcbuffer=0;
    	for (cnt=0;cnt<4;cnt++)
    	{
    		Uart_crcbuffer ^= (Uart_midbuffer[cnt]) & 0x00FF;
    		Uart_crcbuffer= crc16_table[Uart_crcbuffer&0x00FF]^(Uart_crcbuffer>>8);
    	}
     	Uart_midbuffer[4]=(uint8_t)(Uart_crcbuffer&0x00FF);
    	Uart_midbuffer[5]=(uint8_t)(Uart_crcbuffer>>8);
    	for(cnt=0;cnt<6;cnt++)
    	R_UART_SEND_CHAR(Uart_midbuffer[cnt]);
    	
    }

    This file include my c code for software configuration ,please hlep to verify it.thanks!

  • Hi Xiaoming,

    Please test with the GUI if possible, you will have to bypass the mcu directly to the Rx/tx/wakeup/vcc/gnd pins using the FTDI cable so I am not sure if your board is capable to do so. Your autoaddressing code routine looks okay but it would be better to take our example code sequence exactly and test it that way. Also I do not see where you send the wakeup pulse. I do not fully understand your explanation of the failure for the top of stack board - does it respond to any commands ever or does it timeout?

    Regards,

    Taylor
  • Hi Taylor,
    I am afraid there is no condition for GUI to test my code routine accodring to that you said.wakeup pulse only exist in the bottom stackdevice,no existence in the top bottom stack device.I think the top stack device should be wakedup by daisy-chain signal from the bottom stack device,if it is true ?if there is no problem about both of schematic and code routine,the series communication should work well.so there must be some peoblem exist,I just could not find what the fault really is.It will be very thakful to let me know that whenever you find a way to solve it .Thanks for your help and patient reply.
  • Hi Talor,

    Thanks for you help again ,I have made a great progress with the issue of serial communication between two devices on the same board,It looks stable now.If I want to implement a new board that can sample 48 cells with three BQ76PL455A-Q1 devices,are there some deffirence between them, especially in communication and isolation power?What details should I pay attenion to?Thanks!

    Best regards

    xiaoming GENG

  • Hi Xiaoming,

    Glad to hear you were able to make progress! Would you mind sharing what your issue was to solve the communication problem? Mostly for 48 cells, it should be the same implementation for a 3rd device as your 2nd device that was stacked. Generally, in higher voltage BMS systems, we recommend to include a bridge only device as described in section 1.1 of our Use Case Scenarios app note but it is ultimately up to your preference and needs.

    Best Regards,

    Taylor
  • Hi Taylor,

    I did noting but soldered the chip once more ,so I feel the problem is that some pins of the chip is not soldered.Though it was just a simple error, it was the truth.I have never doubted it berore ,and I checked the code routine once and once,it also did't work normally,so I could do noting except soldered it again .surprised,it made an effect.Tough just a simple error ,however it was resolved  and I make a progress on my work and i can implemednt my next plan.Thanks again.

    Best Regards,

    xiaoming Geng