Hi again,
Regarding your questions:
1. In the attached project goal is measure period of 10-600 Hz PWM signals.
So, considering max ticks for eMIOS are 65,534 (16 bits)…
For generate a PWM signal 8-600 Hz we will use a Global Prescaler = 250:
1s -> 120MHz/250 (480,000 ticks)
8Hz = (1/8)s
-> 480,000 *(1/600) = 60,000 ticks
10Hz -> 480,000 *(1/10) = 48,000 ticks
600Hz -> 480,000 *(1/600) = 800 ticks
For measure a PWM signal of 10-600 Hz with eMIOS clock frequency of 120MHz and using Global Prescaler = 200 (in Emios_Mcl_Ip driver):
1s -> 120MHz/200 (600,000 ticks)
10Hz = (1/10)s
-> 600,000 *(1/10) = 60,000 ticks
600Hz -> 600,000 *(1/600) = 1,000 ticks
Overflow (theoretically) should happen at -> 600,000/65,534 = 9.1556 Hz, But due to hardware implementation, the Icu Overflow Notification is out of sync with the event for ICU_MODE_SIGNAL_MEASUREMENT, ICU_MODE_TIMESTAMP and ICU_MODE_SIGNAL_EDGE_DETECT modes.
2. Please refer to Table 401. eMIOS channel types of reference manual in order to see which modes support each channel.
3. Please refer to Figure 321. EMIOS channel types, Figure 322. Block diagram and/or Table 403. Counter buses, channels, and timebase sources in order to see counter buses capabilities. EMIOS_ICU_BUS_DIVERSE refers to buses B, C or D.
4. Depending of PWM frequency that you will measure, you should set the Global Prescaler in order to take advantage of the entire counter. For example:
If you need to measure 10Hz and setting Global Prescaler = 200 (as attached example).
1s -> 120MHz/200 (600,000 ticks)
10Hz = (1/10)s
-> 600,000 *(1/10) = 60,000 ticks (very close to the max ticks 65,534).
Then you have 60,000 ticks for duty cycle resolution. Same math for PWM generation.
Hope it helps you.
If you have more questions, please help us creating a new post.
Have a nice day!