MCUdude / MegaCore

Arduino hardware package for ATmega64, ATmega128, ATmega165, ATmega169, ATmega325, ATmega329, ATmega640, ATmega645, ATmega649, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega3250, ATmega3290, ATmega6450, ATmega6490, AT90CAN32, AT90CAN64 and AT90CAN128
Other
384 stars 118 forks source link

Incorrect clock timing #195

Closed ajtwlsdlqp closed 1 year ago

ajtwlsdlqp commented 1 year ago

Hi, Thanks for share a good library.

Internal 8Mhz, Disable BOD, LTO EEPROM Retained MEGA Pin Out

and use external isp uploader(AVR MK II) with export compiled binary

I'm try to use SoftwareSerial, but bps timing is not match well,

so i try in my loop function like that if( millis() - pre_timer > 50) { pre_timer = millis(); // toggle led } and check it use Osilloscope, take 400ms 8times more It was about 414ms to be exact, and it was confirmed that it was continuously reversed to a similar level.

buzzer's frequency also get low, millis() timer also get slow. that's why my serial bps also not match timing i think.

do i need any setting to use correct timmer? 9600 bps is the target, and the speed is 8 times slower, so I tried to communicate with the begin at 76800 bps, but the result was not good. Communication is confirmed by connecting the normal UNO board and the Ble chip, and whether the settings are changed or not. If the same code was applied and operated at 8 MHz, normal communication was not performed.

please checkit

thanks

MCUdude commented 1 year ago

If the chip is 8 times slower, it means that it's running from its 1 MHz internal oscillator instead of the 8 MHz one. You need to run "Burn Bootloader" in Arduino IDE. If you select "No Bootloader" under the Tools menu, this will only set the correct fuses.