Two ways to sample at or near a given frequency:
Select the right ADC clock prescaler. This has some limitations and may not get you too the precise sampling frequency.
Use a timer to trigger the sampling. Can be done in either. Hardware or software. It is the most flexible way here, especially if coupled with the ADC isr.