主题中讨论的其他器件:BQ76PL455EVM、 HALCOGEN
工具/软件:Code Composer Studio
大家好、
我正在尝试使用 BQ76PL455EVM 在 TMS570上开发 BMS 算法。 我需要在德州仪器提供的示例代码中添加一个 RTI。
extern void rtiCompare1中断(void); extern void rtiCompare2中断(void); extern void rtiCompare3中断(void);
我已将上面描述的代码添加到 sys_vim.h,并 将下面描述的代码(rtiCompare1 Interrupt、rtiCompare2 Interrupt、rtiCompare3 Interrupt)添加到 sys_vim.c
静态常量 t_isrFuncptr s_vim_init[96U]= { phantomInterrupt (&P)、 等高中断(&E)、 /*通道0 */ phantomInterrupt (&P)、 /*通道1 */ rtiCompare0Interrupt (&R)、 /*通道2 */ rtiCompare1中断(&R)、 /*通道3 */ rtiCompare2Interrupt (&R)、 /*通道4 */ rtiCompare3中断(&R)、 /*通道5 */ phantomInterrupt (&P)、 /*通道6 */ phantomInterrupt (&P)、 /*通道7 */ phantomInterrupt (&P)、 /*通道8 */..... }
我已将以下部分添加到 rt.c
// #pragma CODE_STATE (rtiCompare1 Interrupt,32) #pragma INTERRUPT (rtiCompare1 Interrupt,IRQ) //* sourceId:RTI_sourceId_023 *// ////* DesignId:RTI_DesignId_022 *// ///*要求:HL_SR95 * /void rtiCompare1Interrupt (void) */ *用户代码*(void)*/*/*用户代码*/* rtiREG1->INTFLAG = 2U; rtiNotification (rtiNOTIFICATION_COMPARE1); //用户代码开始(78)*// *//*用户代码结束* //* //*用户代码开始(79)*// *//*用户代码结束*// //*@fn void rtiare2Interrupt (void) * IRQ @brief RTI1 Comp2 Interrupt Handler ** RTI1 * RTCompar2 ***中断处理程序***** RTI2,Compar2 *中断处理程序#tirtist 2 *,中断2 *,中断处理程序#tirtic2 *,中断2 *中断处理程序*,比较2 /* sourceId:RTI_sourceId_024 */* DesignId:RTI_DesignId_022 */* 要求:HL_SR95 */ void rtiCompare2Interrupt (void) { //用户代码开始(80)*/* 用户代码结束*/ rtiREG1->INTFLAG = 4U; rtiNotification (rtiNOTIFICATION_COMPARE2); //*用户代码开始(81)*// *//*用户代码结束* / *用户代码开始(82)*// *//*用户代码结束*// //*@fn void rtiare3Interrupt (void) * IRQ @brief RTI1 Comp3 Interrupt Handler * RTI1 ** RTCompar3 Interrupt ******* RTI3 Interrupt Compart #tion ******** Compar3 interrupt Compare 3 interrupt #tion *(Compar3 interrupt Compare ** /* sourceId:RTI_sourceId_025 */* DesignId:RTI_DesignId_022 */* 要求:HL_SR95 */ void rtiCompare3Interrupt (void) { //用户代码开始(83)*/* 用户代码结束*/ rtiREG1->INTFLAG = 8U; rtiNotification (rtiNOTIFICATION_COMPARE3); //用户代码开始(84)*/ //*用户代码结束*/ }
并将以下部分添加到 notification.c 中
#pragma weak (rtiNotification)
void rtiNotification (uint32 notification)
{
如果(notification == rtiNOTIFICATION_COMPARE0)
{
printf ("Selam \r\n");
}
否则(notification == rtiNOTIFICATION_COMPARE1)
{
RTI_TIMEOUT = 1;
}
如果(notification == rtiNOTIFICATION_COMPARE2)则为其他(notification == rtiNOTIFICATION_COMPARE2)
{
printf ("hop \r\n");
}
否则、如果(notification == rtiNOTIFICATION_COMPARE3)
{
printf ("hop \r\n");
}
/*在用户代码开始和用户代码结束之间输入用户代码。 //
//*用户代码开始(9)*/**
-清除所有挂起的中断*///tirREG1->INTFLAG
= 0x0007000FU;
//RTI_TIMEOUT = 1;
//用户代码结束*/}
我的中断现在可以正常工作、但现在我无法从 BQ76PL455EVM 读取电压值等。 所有读数为0。 将代码还原为以前的版本时。 它可以再次工作、但在这种情况下、我没有任何计时器中断。
最小单元:1,电压:0.000000
最大电池数:0,电压:0.000000
电池组电压= 0.000000
可能是什么问题。 如何解决该问题?
谢谢。