Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed fuse flashing in Nano Every configuration #130

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

d3lta-v
Copy link
Contributor

@d3lta-v d3lta-v commented Oct 24, 2021

I noticed an issue with the current release of MegaCoreX while developing my own board with the following design choices:

  • Uses a SAMD11 for a combined UART+UPDI to USB interface, with JTAG2UPDI and the need for 1200bps touch (identical to the Arduino Nano)
  • Uses an ATmega4809
  • Uses Arduino Uno Wifi pinout and is attached to an onboard ESP32 Wi-Fi chipset

I modified the core in my own internal builds by duplicating the Nano Every's board definition and changed the build.variant to uno-wifi for that specific pinout, while still retaining the other properties for a SAMD11 based programmer (1200bps touch, JTAG2UPDI).

4809.menu.pinout.sstuinoii=SSTuino II
4809.menu.pinout.sstuinoii.build.variant=uno-wifi
4809.menu.pinout.sstuinoii.upload.tool=avrdude_nanoevery
4809.menu.pinout.sstuinoii.upload.use_1200bps_touch=true
4809.menu.pinout.sstuinoii.upload.protocol=jtag2updi
4809.menu.pinout.sstuinoii.program.extra_params=-P{serial.port} -e
4809.menu.pinout.sstuinoii.build.compat=

I started running into UART issues when I changed the board frequency from 20MHz to 16MHz (and by extension, all clock speeds that depend on the 16MHz oscillator). I tried to dump the fuses from the ATmega4809 and found out that the fuses were not burnt, meaning that while F_CPU was altered, the relevant fuse was never changed to reflect the correct frequency.

I dug around further and found that the {bootloader.fuse0} in platform.txt (and by extension, the other fuse and lock bits) were all blank, as tools.avrdude_nanoevery never had definitions for those variables. This commit fixes the issue by adding those variables, although there might be a more elegant solution than duplicating tools.avrdude.bootloader.<insert fuse here> into tools.avrdude_nanoevery.bootloader.<insert fuse here>. If others have more insights on this, please chime in as this is the first time I've modified platform.txt like this :)

@MCUdude
Copy link
Owner

MCUdude commented Oct 24, 2021

Thanks for the detailed breakdown of the issue. I'll give it a try on my own Nano Every and then merge if everything seems OK!

@MCUdude
Copy link
Owner

MCUdude commented Oct 27, 2021

Thank you for your contribution!

@MCUdude MCUdude merged commit a384133 into MCUdude:master Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants