GithubHelp home page GithubHelp logo

Comments (6)

sigprof avatar sigprof commented on June 12, 2024

The intended fuse settings for the atmel-dfu and qmk-dfu bootloaders are described in the ISP flashing guide; however, that guide does not give a detailed explanation of those settings and the corresponding hardware configuration:

  • hfuse = 0x99 (the BOOTRST fuse is not programmed), or 0xD9 if you also want to disable JTAG immediately (but the QMK startup code would disable JTAG during early startup anyway).
  • efuse = 0xF3 (the HWBE fuse is programmed).
  • The PE2/HWB pin is pulled down (preferably with a resistor, so that flashing a firmware which tries to use the E2 pin as output won't overload the pin, but a direct connection to GND could work too — apparently the reference Pro Micro design have it connected like that).
  • The RESET pin must not have a capacitor connected, so that RESET does not get pulled low when power is applied.

The original atmel-dfu bootloader cannot handle the configuration with BOOTRST enabled (the chip would be stuck in the bootloader). There is some code in qmk-dfu which attempts to handle BOOTRST, but apparently that code does not work correctly. Instead of using BOOTRST, those bootloaders rely on HWBE (and a somewhat underdocumented detail that the state of the HWB pin does not affect the behavior of the power-on reset).

The requirement to pull the E2 pin down prevents the usage of that pin in the matrix, but you can still use that pin for some tasks that are compatible with the pull-down — e.g., lots of ATmega32U4-based boards use that pin as WS2812_DI_PIN.

from qmk_firmware.

MaxJ345 avatar MaxJ345 commented on June 12, 2024

That pin (PE2/HWB) is currently not connected to anything in my design. That's probably the source of my problem.

My RESET pin is connected to VCC via a pull-up resistor. Is that fine?

from qmk_firmware.

sigprof avatar sigprof commented on June 12, 2024

Yes, having the PE2/HWB pin floating won't work if you intend to enable the HWBE fuse; however, your efuse value also does not enable HWBE.

Having a pull-up on the RESET pin is fine; but some people also add a capacitor “just for a good measure” (and, e.g., STM32 datasheets recommend having a capacitor on the NRST pin to protect against spurious resets), and adding that capacitor breaks startup when the HWBE fuse is enabled (it effectively converts the power-on reset, which normally ignores the state of the HWB pin, into an external reset, which uses the HWB pin).

The caterina bootloader probably does not need the external PE2/HWB connection, because with that bootloader you need to disable the HWBE fuse and enable the BOOTRST fuse instead; however, that bootloader is very annoying for users, so you should not use it if you have any other options.

Maybe it could be possible to fix the lufa-dfu/qmk-dfu code to work correctly with the BOOTRST configuration, but that would require modifying the LUFA code (the bootloader sources actually live there).

from qmk_firmware.

MaxJ345 avatar MaxJ345 commented on June 12, 2024

I shorted pin 33 (PE2/HWB) to ground. I set the high fuse to 0x99 and extended fuse to 0xF3. My results were:

  • Physical reset (shorting the RESET pin to ground) --> bootloader mode
  • QK_BOOT keycode --> bootloader mode

That solves my bootloader issue!

What is BOOTRST? What is HWBE? How are they related?

from qmk_firmware.

sigprof avatar sigprof commented on June 12, 2024

These are fuse bits, described in the ATmega32U4 datasheet:
extended fuses
high fuses
boot loader behavior
(the documentation is not ideal — e.g., it mentions the ALE name for the HWB pin, but ATmega32U4 does not support the ALE function for that pin — that function is present in some other chips though).

from qmk_firmware.

MaxJ345 avatar MaxJ345 commented on June 12, 2024

Thank you for the help!

from qmk_firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.