Hi,
we need to use the Period and Duty Cycle measurement functionality of the eMios module. However, when trying to apply PWM to the corresponding port - the results of corresponding measurement functions are zeros. Is it possible to verify if the eMios ICU works in this mode?
Setup:
S32K3X4EVB-Q172 board. The eMios PWM example was taken as a base one, ICU module was added on top with corresponding functions:
The corresponding additional pin for measurement was setup:
A jumper wire with no resistance was connected between the pins in the following way (shown with red line):
ICU module configuration:
RTD version:
I can attach the project archive upon request.
Thank you in advance!
Solved! Go to Solution.
Hi @tsirkunenkoa,
You can refer to this example:
It uses customized ISR, but the configuration of the drivers should be very similar to your usecase.
Regards,
Daniel
Hi @tsirkunenkoa,
You can refer to this example:
It uses customized ISR, but the configuration of the drivers should be very similar to your usecase.
Regards,
Daniel
Hello @danielmartynek,
Thank you for your quick reply!
I have tried your example and everything is working! I suppose that these measurement functions should only be called from the interrupt then, right? If so, it would be nice if this was mentioned in the function comments.
Also, I would normally just give the "Interrupt Control" driver the corresponding "EMIOS1_5_IRQ" function handler, however it seems like the only solution currently is to do it the way you said (by creating interrupt handler ourselves) since there is no callback function that can be setup for Singal Measurement mode.
Have a nice day!
You can leave the ISR to the driver.
But as you said, there is no notification, and it would have to be polled.
BR, Daniel
Hello NXP Technical Support: I want a DEMO about the EB MCAL configuration ICU module is configured to input capture PWM duty cycle, because I found that the ICU I configured cannot trigger interrupts, I am using a S32K146 microcontroller, EB tresos version is 27.1.0. So I want a demo to compare and see.
Ok, I see that it shouldn't be necessarily called from an interrupt, but can be checked in a for loop until the period is not zero.
Regarding the notification, it would be great if this functionality could be added. Otherwise, if the asynchornous measurement is required - the developers would need to write their custom ISR handler. The main problem here is that this ISR handler is used by other channels as well if they are configured (e.g. EMIOS1_5_IRQ will handle 0, 1, 2, 3 channels) and in this case we would need to differentiate from which channel the interrupt came from and act accrodingly, e.g. the following way:
if ( 0U != ((Emios_Ip_paxBase[1]->CH.UC[0].S) & (uint32)eMIOS_S_FLAG_MASK)
But anyway, I hope the notifications for measurements or channels will be added soon.
Thanks again and I will continue as is.
You are right.
Let me create a ticket to the RTD team.
Regards,
Daniel