Not applicable
Jan 23, 2017
01:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 23, 2017
01:54 AM
Hi,
I am testing the possible use of the XMC4500 in a project.
What I am currently testing is the possibility to measure the time between rising and falling edges of input signal.
I was searching to see if I could find a example in the Apps or in the website but could not find any.
Does anyone know where I can find a example of that or give some pointers?
I already have a system with DAC and USBD_VCOM working correctly, and also tried configuring a PWM_CCU4 to obtain what I need but it did not work.
Best regards,
Filipe
I am testing the possible use of the XMC4500 in a project.
What I am currently testing is the possibility to measure the time between rising and falling edges of input signal.
I was searching to see if I could find a example in the Apps or in the website but could not find any.
Does anyone know where I can find a example of that or give some pointers?
I already have a system with DAC and USBD_VCOM working correctly, and also tried configuring a PWM_CCU4 to obtain what I need but it did not work.
Best regards,
Filipe
2 Replies
Jan 25, 2017
12:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 25, 2017
12:42 PM
Hi,
Have a look to the CAPTURE APP and its documentation.
Regards,
Jesus
Have a look to the CAPTURE APP and its documentation.
Regards,
Jesus
Not applicable
Jan 31, 2017
07:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 31, 2017
07:29 AM
Thanks for the help.
I am now able to have a system using CCU4 configured to capture the time. I also tried to configure the system to have concatenation to 32bits.
This is the code I am using:
Could you please confirm that the configuration I am doing is the correct one regarding the concatenation?
Best regards,
Filipe
I am now able to have a system using CCU4 configured to capture the time. I also tried to configure the system to have concatenation to 32bits.
This is the code I am using:
#define INPUT_PIN_CC P1_3
const XMC_GPIO_CONFIG_t gpio_config =
{
.mode = XMC_GPIO_MODE_INPUT_PULL_UP
};
const XMC_CCU4_SLICE_EVENT_CONFIG_t event_config_0 =
{
.mapped_input = CCU40_IN0_P1_3,
.edge = XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE,
};
const XMC_CCU4_SLICE_EVENT_CONFIG_t event_config_1 =
{
.mapped_input = CCU40_IN0_P1_3,
.edge = XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE,
};
const XMC_CCU4_SLICE_CAPTURE_CONFIG_t capture_config_0 =
{
.prescaler_initval = XMC_CCU4_SLICE_PRESCALER_1,
.timer_concatenation = false
};
const XMC_CCU4_SLICE_CAPTURE_CONFIG_t capture_config_1 =
{
.prescaler_initval = XMC_CCU4_SLICE_PRESCALER_1,
.timer_concatenation = true
};
int SpeedMeasure_Config(void)
{
XMC_GPIO_Init(INPUT_PIN_CC, &gpio_config);
XMC_CCU4_Init(CCU40, XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR);
XMC_CCU4_SLICE_CaptureInit(CCU40_CC41, &capture_config_1);
XMC_CCU4_SLICE_Capture0Config(CCU40_CC41, XMC_CCU4_SLICE_EVENT_0);
XMC_CCU4_SLICE_ConfigureEvent(CCU40_CC41, XMC_CCU4_SLICE_EVENT_0, &event_config_1);
XMC_CCU4_EnableClock(CCU40, 1);
XMC_CCU4_SLICE_SetTimerPeriodMatch(CCU40_CC41, 0xffff);
XMC_CCU4_SLICE_CaptureInit(CCU40_CC40, &capture_config_0);
XMC_CCU4_SLICE_Capture0Config(CCU40_CC40, XMC_CCU4_SLICE_EVENT_0);
XMC_CCU4_SLICE_ConfigureEvent(CCU40_CC40, XMC_CCU4_SLICE_EVENT_0, &event_config_0);
XMC_CCU4_EnableClock(CCU40, 0);
XMC_CCU4_SLICE_SetTimerPeriodMatch(CCU40_CC40, 0xffff);
XMC_CCU4_EnableShadowTransfer(CCU40, XMC_CCU4_SHADOW_TRANSFER_SLICE_0 | XMC_CCU4_SHADOW_TRANSFER_SLICE_1);
XMC_CCU4_SLICE_EnableMultipleEvents(CCU40_CC40, XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT0);
XMC_CCU4_SLICE_SetInterruptNode(CCU40_CC40, XMC_CCU4_SLICE_IRQ_ID_EVENT0, 1);
NVIC_SetPriority(CCU40_1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 63, 0));
NVIC_EnableIRQ(CCU40_1_IRQn);
XMC_CCU4_SLICE_StartTimer(CCU40_CC40);
XMC_CCU4_SLICE_StartTimer(CCU40_CC41);
return 0;
}
Could you please confirm that the configuration I am doing is the correct one regarding the concatenation?
Best regards,
Filipe