Other Parts Discussed in Thread: BQ40Z50-R1, EV2400, BQSTUDIO
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号: BQ40Z50-R1
主题中讨论的其他器件: EV2400、 BQSTUDIO
尊敬的先生:
我们正在尝试使用 ATSAMD21J18A (SAMD21 Xplained Pro Board) 和 SMBus 接口开发电池管理系统 (BMS)。 我们正在将德州仪器 (TI) IC - bq40z50-R1 用于 BMS。
我们已在 MPLAB X IDE v6.20 中使用 MCC 将 SERCOM2 配置为 I2C 主器件。 (附加了示例代码)
我们没有获得 bq40z50-r1 的任何响应。 (已连接逻辑探头的屏幕截图)
请帮助我们解决问题。
此致、
Manan Oza.
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include <stddef.h> // Defines NULL
#include <stdbool.h> // Defines true
#include <stdlib.h> // Defines EXIT_FAILURE
#include "definitions.h" // SYS function prototypes
// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************
uint16_t duty = 943U;
uint16_t SMB_Add = 0x0016; //0x0016
uint8_t BAT_Temp = 0x08;
uint32_t wrLength = 1U, rdLength = 2U;
uint8_t rdData[2] = {0};
int main ( void )
{
/* Initialize all modules */
SYS_Initialize ( NULL );
/* Start Systick Timer for delay function*/
SYSTICK_TimerStart();
SERCOM2_I2C_WriteRead(SMB_Add, &BAT_Temp, wrLength, rdData, rdLength);
while ( true )
{
/* Maintain state machines of all polled MPLAB Harmony modules. */
SYS_Tasks ( );
//SMBus PA08:SDA, PA09:SCL EXT1, 50kHz
SERCOM2_I2C_WriteRead(SMB_Add, &BAT_Temp, wrLength, rdData, rdLength);
SYSTICK_DelayMs(2000);
}
/* Execution should not come here during normal operation */
return ( EXIT_FAILURE );
}
/*******************************************************************************
End of File
*/



