MCUdude / MiniCore

Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
Other
980 stars 242 forks source link

Question: How do I add a custom clock option for ATMega328P in the Arduino IDE menu? #316

Open sidharthbhatia opened 2 days ago

sidharthbhatia commented 2 days ago

Hi @MCUdude,

Thanks a lot for the awesome core! It really simplifies a ton of things. I am using the core version 3.0.2 with Arduino IDE 2.3.2 and I want to add a new clock option to the Clock selection menu for the ATMega328P. I want to call it 2MHz_16MHz_external. Using this, I intend to activate the CKDIV8 fuse bit to run the MCU at 2MHz with the 16MHz external oscillator found on most ATMega328P Arduino boards. I followed the changes you did in your recent commit Add 9.216 MHz clock. Here are the changes that I did to the boards.txt file:

328.menu.clock.2MHz_16MHz_external=External 2 16 MHz
328.menu.clock.2MHz_16MHz_external.upload.default_speed=9600
328.menu.clock.2MHz_16MHz_external.bootloader.low_fuses=0b0111{bootloader.cksel_bits}
328.menu.clock.2MHz_16MHz_external.build.clkpr=
328.menu.clock.2MHz_16MHz_external.build.f_cpu=2000000L

Even after doing these changes and restarting the Arduino IDE, I am not able to see this option in the menu. I also tried changing the name of an existing clock option, e.g. changing External 2 MHz to External 2 MHz Osc but no change seems to be reflecting in the menu. However, when I change the fuse bits for the External 2 MHz and burn the bootloader to the MCU, I am getting the correct fuse values getting written to the MCU.

I can, although, see the updated options in the Arduino IDE 1.8.13.

Can you please let me know what else I need to do here?

As an additional info, I also tried deleting the cache and staging folders, which didn't work.

MCUdude commented 1 day ago

Hi!

I'm not sure what the problem is. I've installed MiniCore though the boards manager, and when editing the boards.txt located in the following path on my mac, the 2 16 MHz external option shows up without any issues:

/Users/hans/Library/Arduino15/packages/MiniCore/hardware/avr/3.0.2/boards.txt

image
sidharthbhatia commented 1 day ago

Hmm. That's strange. I tried removing and reinstalling MiniCore via the Arduino IDE boards manager, but I didn't get any success doing that as well. I could try uninstalling and reinstalling the Arduino IDE to see if that solves it.