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.

[参考译文] BQ79616:BQ79600反向解决问题

Guru**** 1807890 points
Other Parts Discussed in Thread: BQ79616, USB2ANY
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1409550/bq79616-bq79600-reverse-addressing-question

器件型号:BQ79616
主题中讨论的其他器件: USB2ANY

工具与软件:

尊敬的团队:

我想通过 BQ79600实现反向寻址。 参考本示例、我无法正确收集数据。 示例如下:

我的系统是1个 MCU 加1个 BQ79600加4个 BQ79616

我的说明如下

   SpiWake79600();                                                                       //wake up BQ79600
    delay_us(500);
    delay_ms(3);
  SpiWriteReg(NULL_BQ, CONTROL1, 0x20, Length_1, FRMWRT_SGL_W);    //wake BQ79616
  delay_ms(80);
  SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN1, DummyValue, Length_1, FRMWRT_STK_W);
   SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN2, DummyValue, Length_1, FRMWRT_STK_W);
   SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN3, DummyValue, Length_1, FRMWRT_STK_W);
    SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN4, DummyValue, Length_1, FRMWRT_STK_W);
   SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN5, DummyValue, Length_1, FRMWRT_STK_W);
    SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN6, DummyValue, Length_1, FRMWRT_STK_W);
    SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN7, DummyValue, Length_1, FRMWRT_STK_W);
   SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN8, DummyValue, Length_1, FRMWRT_STK_W);

    SpiWriteReg(NULL_BQ, CONTROL1, 0x80, Length_1, FRMWRT_REV_ALL_W);
    //brdcast Write 0x02 to address 0x308(1)
    SpiWriteReg(NULL_BQ, COMM_CTRL, 0x02, Length_1, FRMWRT_ALL_W);

    //brdcast Write 0x81 to address 0x309 (enable BQ7961X-Q1 auto addressing)
    SpiWriteReg(NULL_BQ, CONTROL1, 0x81, Length_1, FRMWRT_ALL_W); 

    //SET ADDRESSES FOR EVERY BOARD
    for(currentBoard1=0; currentBoard1<5; currentBoard1++)
    {
        SpiWriteReg(NULL_BQ, DIR1_ADDR, currentBoard1, Length_1, FRMWRT_ALL_W);
    }
    //BROADCAST WRITE TO SET ALL DEVICES AS STACK DEVICE
   SpiWriteReg(NULL_BQ, COMM_CTRL, SetStarkDevice, Length_1, FRMWRT_ALL_W);

    //set base device as base
    SpiWriteReg(NULL_BQ, COMM_CTRL, 0x00, Length_1, FRMWRT_SGL_W);

    //SET THE HIGHEST DEVICE IN THE STACK AS BOTH STACK AND TOP OF STACK
    SpiWriteReg(0x04, COMM_CTRL, SetTopDevice, Length_1, FRMWRT_SGL_W);

    //SYNCRHONIZE THE DLL WITH A THROW-AWAY READ
    SpiReadReg(NULL_BQ, OTP_ECC_DATAIN1, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN2, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN3, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN4, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN5, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN6, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN7, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);
   SpiReadReg(NULL_BQ, OTP_ECC_DATAIN8, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R);


 for(currentBoard1=0; currentBoard1<5; currentBoard1++)
    {
        SpiReadReg(currentBoard1, DIR1_ADDR, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_SGL_R);
    }

    //OPTIONAL: read register address 0x2001 and verify that the value is 0x14
       SpiReadReg(NULL_BQ, Bridge_DEV_CONF1, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_SGL_R);

  

无法正常收集数据。 请帮助我找出问题所在。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Xi、

    共享此命令序列的逻辑分析仪捕捉?  

    我还可以自行测试内容以检查顺序。

    此致、

    Luis Hernandez Salomon

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    void ReverseAddressing()
    {
        uint16_t test_response_frame[(1+6)*TOTALBOARDS] ;
        //CHANGE BASE DEVICE DIRECTION
        SpiWriteReg(0, CONTROL1, 0x80, 1, FRMWRT_SGL_W);
    
        //CHANGE REST OF STACK DIRECTION
        SpiWriteReg(0, CONTROL1, 0x80, 1, FRMWRT_REV_ALL_W);
    
        //DO NORMAL AUTO ADDRESS SEQUENCE, BUT FOR DIR1_ADDR
        //DUMMY WRITE TO SNCHRONIZE ALL DAISY CHAIN DEVICES DLL (IF A DEVICE RESET OCCURED PRIOR TO THIS)
        SpiWriteReg(0, OTP_ECC_DATAIN1, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN2, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN3, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN4, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN5, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN6, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN7, 0X00, 1, FRMWRT_ALL_W);
        SpiWriteReg(0, OTP_ECC_DATAIN8, 0X00, 1, FRMWRT_ALL_W);
    
        //ENABLE AUTO ADDRESSING MODE, WHILE KEEPING REVERSE DIRECTION
       SpiWriteReg(0, CONTROL1, 0X81, 1, FRMWRT_ALL_W);
    
        //SET ADDRESSES FOR EVERY BOARD (REVERSE DIRECTION)
        for(currentBoard=0; currentBoard<TOTALBOARDS; currentBoard++)
        {
            SpiWriteReg(0, DIR1_ADDR, currentBoard, 1, FRMWRT_ALL_W);
        }
    
        SpiWriteReg(0, COMM_CTRL, 0x02, 1, FRMWRT_ALL_W); //set everything as a stack device first
    
        if(TOTALBOARDS==1) //if there's only 1 board, it's the base AND top of stack, so change it to those
        {
            SpiWriteReg(0, COMM_CTRL, 0x01, 1, FRMWRT_SGL_W);
        }
        else //otherwise set the base and top of stack individually
        {
           SpiWriteReg(0, COMM_CTRL, 0x00, 1, FRMWRT_SGL_W);
           SpiWriteReg(TOTALBOARDS-1, COMM_CTRL, 0x03, 1, FRMWRT_SGL_W);
        }
    
        //SYNCRHONIZE THE DLL WITH A THROW-AWAY READ
        SpiReadReg(0, OTP_ECC_DATAIN1, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN2, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN3, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN4, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN5, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN6, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN7, test_response_frame, 1, 0, FRMWRT_ALL_R);
        SpiReadReg(0, OTP_ECC_DATAIN8, test_response_frame, 1, 0, FRMWRT_ALL_R);
    
        ////OPTIONAL: read back all device addresses
        //for(currentBoard=0; currentBoard<TOTALBOARDS; currentBoard++)
        //{
        //    ReadReg(currentBoard, DIR0_ADDR, response_frame2, 1, 0, FRMWRT_SGL_R);
        //    printf("board %d\n",response_frame2[4]);
        //}
    
        //RESET ANY COMM FAULT CONDITIONS FROM STARTUP
        SpiWriteReg(0, FAULT_RST2, 0x03, 1, FRMWRT_ALL_W);
    }
    
    

    大家好、我将例程中的反向寻址代码移植到了代码中、测试的逻辑分析仪波形如下:

    在调用 ReverseAddressing 函数之前、我所做的只是唤醒 BQ79600、然后使用命令 SpiWriteReg (NULL_BQ、CONTROL1、0x20、Length_1、FRMWRT_SGL_W)来唤醒 BQ79616

    (1)唤醒 BQ79616

    90 00 03 09 20 13 95

    (2)改变基底器件方向  

    90 00 03 09 80 13 ED

    (3)更改堆栈器件方向

    E0 03 09 80 C0 14

    (4) 此后、我发送的所有命令都将显示0x32

    (理论上、这应该是虚拟写入来同步所有菊花链式器件 DLL)

    您能不能帮我弄清楚为什么会这样?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Xi、

    这是相当奇怪的。 MCU 正在发送 MOSI、那么 MCU 中是否有器件导致发生这种情况?  

    您是否已尝试使用 EVM 或 USB2ANY 使用命令序列运行此测试?

    此致、

    Luis Hernandez Salomom

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Luis:

    感谢您的耐心。 我已经找到了问题的原因并解决了它。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Xi、  

    很高兴听到这个消息。 问题是什么?  

    此致、

    Luis Hernandez Salomon