Clock of the ADC in the teensy 4.1 not modificable

Status
Not open for further replies.

Pasblo

New member
I have been working with changing some properties of the ADC in a Teensy 4.1, like the resolution, and in the datasheet appears that when using a smaller resolution the processor uses fewer clock cycles, which is logical because it uses a successive approximation ADC, but i was always obtaining the same running time, so
I looked at the analog.h code located in C:\Arduino\hardware\teensy\avr\cores\teensy4, and I spotted this piece of code:

Code:
#if 1
	mode |= ADC_CFG_ADIV(1) | ADC_CFG_ADICLK(3); // async clock
#else
	uint32_t clock = F_BUS;
	if (clock > MAX_ADC_CLOCK*8) {
		mode |= ADC_CFG_ADIV(3) | ADC_CFG_ADICLK(1); // use IPG/16
	} else if (clock > MAX_ADC_CLOCK*4) {
		mode |= ADC_CFG_ADIV(2) | ADC_CFG_ADICLK(1); // use IPG/8
	} else if (clock > MAX_ADC_CLOCK*2) {
		mode |= ADC_CFG_ADIV(1) | ADC_CFG_ADICLK(1); // use IPG/4
	} else if (clock > MAX_ADC_CLOCK) {
		mode |= ADC_CFG_ADIV(0) | ADC_CFG_ADICLK(1); // use IPG/2
	} else {
		mode |= ADC_CFG_ADIV(0) | ADC_CFG_ADICLK(0); // use IPG
	}
#endif

And i was wondering why the option to select the ADC clock frequency is disabled, it can be enabled? Or it does not work.
Code:
[CODE]
[/CODE]
 
Status
Not open for further replies.
Back
Top