platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
136 stars 104 forks source link

Change CPU frequency on attiny85 fails to compile in 3.3.0 #255

Closed 5e3 closed 2 years ago

5e3 commented 3 years ago

In 3.2.0 it was possible to set board_build.f_cpu = 16000000L

In 3.3.0 compiling fails with: Compiling .pio\build\attiny85\FrameworkArduino\wiring_shift.c.o C:\Users\xxx.platformio\packages\framework-arduino-avr-attiny\cores\tiny\wiring.c: In function 'init': C:\Users\xxx.platformio\packages\framework-arduino-avr-attiny\cores\tiny\wiring.c:1095:8: error: #error "Frequency requested from internal oscillator that cannot be generated by prescaling"

error "Frequency requested from internal oscillator that cannot be generated by prescaling"

    ^~~~~

C:\Users\xxx.platformio\packages\framework-arduino-avr-attiny\cores\tiny\wiring.c:1096:8: error: #error "Custom tuning is not supported in the current version of ATTinyCore"

error "Custom tuning is not supported in the current version of ATTinyCore"

    ^~~~~

The code I'm compiling depends on the 16MHz PLL clock.

valeros commented 3 years ago

Hi @5e3 ! In the latest release the ATTinyCore was updated to the latest v1.5.2, so something may have changed in the internal implementation. Anyway, the error message seems quite descriptive. Does it work in the Arduino IDE?

5e3 commented 3 years ago

Hi @valeros

Don't know - I didn't try. But if I set

build_flags = -DCLOCK_SOURCE=6

in platformio.ini it seems to resolve the issue...

r4wabr commented 2 years ago

define the F_CPU: beetwine #include #define F_CPU 16000000UL