1st I tried I as shown in example by creating my own example I can able to read the frequency of individual channel
Refer the below code
My input frequency is 500 hz and I can able to read the 500 hz in this single channel but when I configured for multiple channel iam getting errors please below page
uint32_t frequency;
void clock_pins_init(void)
{
/* Initialize clock module */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* Initialize pins */
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
ic_pal();
}
void ic_pal(void)
{
IC_Init(&ic_pal_1_instanceConfig, &ic_pal_1_InitConfig);
frequency = FTM_DRV_GetFrequency(ic_pal_1_instanceConfig.instIdx);
}
int main(void)
{
/* Write your code here */
clock_pins_init();
for(;;)
{
/* Get the latest value */
inputCaptureMeas = IC_GetMeasurement(&ic_pal_1_instanceConfig, 0);
/* Calculate the signal frequency using recorded data*/
inputCaptureMeas = frequency / (inputCaptureMeas);
}
}
/* END main */
/*!
** @}
*/
@rob
After getting single channel output I configured second channel I got below error
I tried in both option so iam getting now as below error
Error is odd channel is not supported by odd channels
After I got this I skipped only to read even channels with below configuration I am not able to read still second channel frequency
include "sdk_project_config.h"
volatile uint16_t inputCaptureMeas = 0,inputCaptureMeas1 = 0U,inputCaptureMeas2 = 0U;
uint32_t frequency;
void clock_pins_init(void)
{
/* Initialize clock module */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* Initialize pins */
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
ic_pal();
}
void ic_pal(void)
{
IC_Init(&ic_pal_1_instanceConfig, &ic_pal_1_InitConfig);
frequency = FTM_DRV_GetFrequency(ic_pal_1_instanceConfig.instIdx);
}
int main(void)
{
/* Write your code here */
clock_pins_init();
for(;;)
{
/* Get the latest value */
inputCaptureMeas = IC_GetMeasurement(&ic_pal_1_instanceConfig, 0);
/* Calculate the signal frequency using recorded data*/
inputCaptureMeas = frequency / (inputCaptureMeas);
inputCaptureMeas1 = IC_GetMeasurement(&ic_pal_1_instanceConfig, 2);
/* Calculate the signal frequency using recorded data*/
inputCaptureMeas1 = frequency / (inputCaptureMeas1);
}
}
/* END main */
/*!
** @}
*/
I am not getting any channel2 output
Can I get few more tips how can I achieve reading of multiple channel frequency
解決済! 解決策の投稿を見る。
Hi
Sorry for the inconvenience we bring you!
About "The odd channels cannot be configured as a signal measurement mode.", this is the limitation of the IC_PAL and FTM_IC drivers. If FTM Input Capture Mode is configured by register(not use SDK APIs), the frequency can be measured with odd channel. But IC_PAL and FTM_IC will configure FTM in Dual Edge Capture Mode when they are configured as signal measurement mode.
If you use the SDK APIs and S32CT, and can switch to other pins, the easiest way is to choose even channel.
For reading the frequency of multiple channels, it can be configured in S32CT according to the original channel.
uint8_t channel0 = ic_pal_1_InitConfig.inputChConfig[0].hwChannelId;
uint8_t channel2 = ic_pal_1_InitConfig.inputChConfig[1].hwChannelId;
inputCaptureMeas0 = IC_GetMeasurement(&ic_pal_1_instanceConfig, channel0);
inputCaptureMeas2 = IC_GetMeasurement(&ic_pal_1_instanceConfig, channel2);
In the case of Prescaler=8, Frequency of counter clock=6000000Hz. The Max measured frequency is 6MHz, and the Min measured frequency is 91.55Hz.
For more details on IC_PAL, please read its guide.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi
Sorry for the inconvenience we bring you!
About "The odd channels cannot be configured as a signal measurement mode.", this is the limitation of the IC_PAL and FTM_IC drivers. If FTM Input Capture Mode is configured by register(not use SDK APIs), the frequency can be measured with odd channel. But IC_PAL and FTM_IC will configure FTM in Dual Edge Capture Mode when they are configured as signal measurement mode.
If you use the SDK APIs and S32CT, and can switch to other pins, the easiest way is to choose even channel.
For reading the frequency of multiple channels, it can be configured in S32CT according to the original channel.
uint8_t channel0 = ic_pal_1_InitConfig.inputChConfig[0].hwChannelId;
uint8_t channel2 = ic_pal_1_InitConfig.inputChConfig[1].hwChannelId;
inputCaptureMeas0 = IC_GetMeasurement(&ic_pal_1_instanceConfig, channel0);
inputCaptureMeas2 = IC_GetMeasurement(&ic_pal_1_instanceConfig, channel2);
In the case of Prescaler=8, Frequency of counter clock=6000000Hz. The Max measured frequency is 6MHz, and the Min measured frequency is 91.55Hz.
For more details on IC_PAL, please read its guide.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------