Using the FPB-RA6E1, and trying to get the ADC to trigger at 1 kHz using GPT6. I have the GPT6 running, and it can hit the timer callback. If I try to use GPT6 timer overflow for the ADC trigger, nothing happens. If use software trigger for the ADC, it hits the ADC callback. Seems like this should be simple, but it's not working if I try to use the GPT6 trigger. I have Normal/Group A trigger for the ADC configured as GPT6 COUNTER_OVERFLOW.
void hal_entry(void){ /* TODO: add your own code here */ R_ELC_Open (&g_elc_ctrl, &g_elc_cfg); R_ELC_LinkSet (&g_elc_ctrl, ELC_PERIPHERAL_ADC0, ELC_EVENT_GPT6_COUNTER_OVERFLOW); R_ADC_Open (&g_adc0_ctrl, &g_adc0_cfg); dscan.scan_mask = ADC_MASK_CHANNEL_0; dscan.scan_mask_group_b = 0; dscan.priority_group_a = 0; dscan.sample_hold_mask = 0; dscan.add_mask = 0; dscan.sample_hold_states = 0; R_ADC_ScanCfg (&g_adc0_ctrl, &dscan); R_ADC_ScanStart (&g_adc0_ctrl); R_GPT_Open (&g_timer0_ctrl, &g_timer0_cfg); R_GPT_Start (&g_timer0_ctrl);#if BSP_TZ_SECURE_BUILD /* Enter non-secure code */ R_BSP_NonSecureEnter();#endif}
Found it, I needed to call R_ELC_Enable. That was the missing piece.