Other Parts Discussed in Thread: HALCOGEN
Hello,
i need help. Sorry, I tried to publish in Safety Microcontrollers forum but choosing RM46L852 as device, this web form automatically selects "Other microcontroller forum".
Using NHET, i'm trying to use interrupts at end of duty and end of period of PWM0, N2HET1[0] pin 25. The device we use is RM46L852CPGET.
Using HalCoGen to set PWM:
setting direction on N2HET1[0]:
enabling interrupts HET high level:
Enabling IRQ VIM channel 10:
Of course in "PINMUX" i choose NHET1[0] for pin 25.
In the code:
void HetConfig(void){
hetInit();
pwmEnableNotification(hetREG1,pwm0,pwmEND_OF_BOTH);
}
in notification.c (in pwmNotification function):
/* USER CODE BEGIN (35) */
if (hetREG ==hetREG1 && (pwm == pwm0)){
if(notification == pwmEND_OF_PERIOD ){
if((IsPowerOn > 0) && (PulseCount > 0)){
SetQorvoOnOff(ON);
}
else SetQorvoOnOff(OFF);
}
if (notification == pwmEND_OF_DUTY){
SetQorvoOnOff(OFF);
PulseCount++;
}
}
/* USER CODE END */
the real code is more complex, but i cutted off almost all instructions in order to avoid side effects.
Using the debugger I can see that the execution arrives correctly in pwmNotification but the variable "notification" passed to it has always the value 4U (pwmEND_OF_PERIOD) and never 2U (pwmEND_OF_DUTY). So the instruction SetQorvoOnOff(OFF) is never executed.
SetQorvoOnOff() is a very simple function, acts on a single GPIO, pin 125 configured as N2HET1(14).
It seems that the event "end of duty" is never captured.
What's wrong in my programming?
Thanks
Vasco