Skip to content

Wrong ADC Prescaler Calculation #124

Open
@CombiesGit

Description

@CombiesGit

Wrong ADC Prescaler Calculation in AVR wiring.c

	#elif F_CPU >= 8000000 // 8 MHz / 64 = 125 KHz
		sbi(ADCSRA, ADPS2);
		sbi(ADCSRA, ADPS1);
		cbi(ADCSRA, ADPS0);
	#elif F_CPU >= 4000000 // 4 MHz / 32 = 125 KHz
		sbi(ADCSRA, ADPS2);
		cbi(ADCSRA, ADPS1);
		sbi(ADCSRA, ADPS0);

If F_CPU=7372800 (baudrate crystal)
The prescaler ist set to DIV_32
7372800/32=230400 Hz
230kHz is too much
between 200 and 50 are fine values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions