Closed MCUdude closed 2 years ago
@valeros I've now reviewed the script again and added support for the multi-voltage IO support fuse present on AVR-DB's. Please review so this can hopefully be merged.
There's one thing that would be nice to resolve though.
In #34 one can't use the on-board programmer on the Nano Every to set fuses, since it requires a 1200bps touch to enable programming mode, and the fuses.py script doesn't currently support this. How can this be accomplished "properly"?
As a proof of concent, I've added the following code at the bottom of the script, right before the Avrdude command gets invoked. @valeros please let me know if there is a better way!
from platformio.util import get_serial_ports
#...
#...
#...
print_fuses_info(fuse_values, fuse_names, lock_fuse)
upload_options = env.BoardConfig().get("upload", {})
if upload_options.get("use_1200bps_touch", False):
before_ports = get_serial_ports()
env.AutodetectUploadPort()
env.Append(UPLOADERFLAGS=["-P", '"$UPLOAD_PORT"'])
env.TouchSerialPort("$UPLOAD_PORT", 1200)
if upload_options.get("wait_for_upload_port", True):
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
fuses_action = env.VerboseAction("$SETFUSESCMD", "Setting fuses...")
Return("fuses_action")
I guess this PR can be merged as it is, and the 1200bps touch issue can be solved as a separate issue/PR
Thanks for the PR, please do open a separate topic.
This is a work in progress and has not yet been tested properly due to #18 hasn't been merged or considered merged yet. I'm submitting this PR to hopefully speed up AVR-DA/DB integration.