Other Parts Discussed in Thread: BQ76PL455EVM, HALCOGEN
Tool/software: Code Composer Studio
Hello everyone,
I am trying to develop a BMS algorithm on TMS570 with BQ76PL455EVM. I need to add a rti on the code to the sample code that has been presented by Texas Instruments.
extern void rtiCompare1Interrupt(void); extern void rtiCompare2Interrupt(void); extern void rtiCompare3Interrupt(void);
I have added code depicted above to sys_vim.h and code depicted below (rtiCompare1Interrupt, rtiCompare2Interrupt,rtiCompare3Interrupt, ) to sys_vim.c
static const t_isrFuncPTR s_vim_init[96U] = { &phantomInterrupt, &esmHighInterrupt, /* Channel 0 */ &phantomInterrupt, /* Channel 1 */ &rtiCompare0Interrupt, /* Channel 2 */ &rtiCompare1Interrupt, /* Channel 3 */ &rtiCompare2Interrupt, /* Channel 4 */ &rtiCompare3Interrupt, /* Channel 5 */ &phantomInterrupt, /* Channel 6 */ &phantomInterrupt, /* Channel 7 */ &phantomInterrupt, /* Channel 8 */ ..... }
I have added below part to rt.c
*/ #pragma CODE_STATE(rtiCompare1Interrupt, 32) #pragma INTERRUPT(rtiCompare1Interrupt, IRQ) /* SourceId : RTI_SourceId_023 */ /* DesignId : RTI_DesignId_022 */ /* Requirements : HL_SR95 */ void rtiCompare1Interrupt(void) { /* USER CODE BEGIN (77) */ /* USER CODE END */ rtiREG1->INTFLAG = 2U; rtiNotification(rtiNOTIFICATION_COMPARE1); /* USER CODE BEGIN (78) */ /* USER CODE END */ } /* USER CODE BEGIN (79) */ /* USER CODE END */ /** @fn void rtiCompare2Interrupt(void) * @brief RTI1 Compare 2 Interrupt Handler * * RTI1 Compare 2 interrupt handler * */ #pragma CODE_STATE(rtiCompare2Interrupt, 32) #pragma INTERRUPT(rtiCompare2Interrupt, IRQ) /* SourceId : RTI_SourceId_024 */ /* DesignId : RTI_DesignId_022 */ /* Requirements : HL_SR95 */ void rtiCompare2Interrupt(void) { /* USER CODE BEGIN (80) */ /* USER CODE END */ rtiREG1->INTFLAG = 4U; rtiNotification(rtiNOTIFICATION_COMPARE2); /* USER CODE BEGIN (81) */ /* USER CODE END */ } /* USER CODE BEGIN (82) */ /* USER CODE END */ /** @fn void rtiCompare3Interrupt(void) * @brief RTI1 Compare 3 Interrupt Handler * * RTI1 Compare 3 interrupt handler * */ #pragma CODE_STATE(rtiCompare3Interrupt, 32) #pragma INTERRUPT(rtiCompare3Interrupt, IRQ) /* SourceId : RTI_SourceId_025 */ /* DesignId : RTI_DesignId_022 */ /* Requirements : HL_SR95 */ void rtiCompare3Interrupt(void) { /* USER CODE BEGIN (83) */ /* USER CODE END */ rtiREG1->INTFLAG = 8U; rtiNotification(rtiNOTIFICATION_COMPARE3); /* USER CODE BEGIN (84) */ /* USER CODE END */ }
and added below part to notification.c
#pragma WEAK(rtiNotification) void rtiNotification(uint32 notification) { if ( notification == rtiNOTIFICATION_COMPARE0) { printf("SELAM \r\n"); } else if ( notification == rtiNOTIFICATION_COMPARE1) { RTI_TIMEOUT = 1; } else if ( notification == rtiNOTIFICATION_COMPARE2) { printf("HOP \r\n"); } else if ( notification == rtiNOTIFICATION_COMPARE3) { printf("HOP \r\n"); } /* enter user code between the USER CODE BEGIN and USER CODE END. */ /* USER CODE BEGIN (9) */ /** - Clear all pending interrupts */ //rtiREG1->INTFLAG = 0x0007000FU; //RTI_TIMEOUT = 1; /* USER CODE END */ }
My interrupts are now working but now I can not read voltage value etc from BQ76PL455EVM. All readings are 0. When I revert code to the previous version. It works again but on that condition I do not have any timer interrupt.
Min Cell : 1 , Voltage : 0.000000
Max Cell : 0 , Voltage : 0.000000
Pack Voltage= 0.000000
What may be wrong. How can I solve that problem?
Thanks.