Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hi,
I am new to Hercules mcu series. I am having prior experience with c2000 series and msp series. I was trying to make a timer isr like cpu timer interrupt in c2000 mcus. I saw few threads in this forum which says that it will be easy to implement timer isr using het. But I couldn't figure out how to implement it correctly.
I was trying to implement it using HET pwm interrupt with pwmEND_OF_PERIOD trigger without enabling it to IO pins in halcogen. I am having few quetions.
1) is that the correct way to implement a timer interrupt?
3) when we configure pwm period 1000us in halcogen, it shows the actual period will be 1000.106us. So is that the actual time period that the interrupt runs?
2) what is the different between HET and RTI? and what is the most suitable way to configure the timer interrupt.
My testing code as below,
thanks
/* USER CODE BEGIN (0) */
#include "HL_gio.h"
#include "stdio.h"
#include "HL_system.h"
#include "HL_het.h"
/* USER CODE END */
/* Include Files */
#include "HL_sys_common.h"
/* USER CODE BEGIN (1) */
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
int i = 0;
int giob4 = 0;
int hetIsr = 0;
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
_enable_IRQ_interrupt_();
gioInit();
hetInit();
gioEnableNotification(gioPORTB, 4);
pwmEnableNotification(hetREG1, pwm0, pwmEND_OF_PERIOD);
// printf("test console print");
while(1){
giob4 = gioGetBit(gioPORTB, 4);
// printf("\n .");
if(giob4 == 0){
gioSetBit(gioPORTB, 6, 1);
}else{
gioSetBit(gioPORTB, 6, 0);
}
}
/* USER CODE END */
return 0;
}
/* USER CODE BEGIN (4) */
void gioNotification(gioPORT_t *port, uint32 bit){
printf("\n GioISR trigger time : %d ",i);
i++;
}
void pwmNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification){
hetIsr++;
printf("\n HetISR trigger time : %d ",hetIsr);
}
/* USER CODE END */