locking USB-ISP via USB serial interface

Hello,

I have programmed a larger sketch that is working quite well.
I am using a Arduino Leonardo ATmega32U8 and programming it over the AVRISP mkII interface with the Ardiuino IDE.

Additionally my application is using the virtual serial port to communicate with the PC companion app. I would like to be able to use my companion app to enable and disable the Arduino programming features. So it should be possible to persistantly enable or disable the ISP on the chip via my own code.

I read about the so called fuse bits and I guess that's the way to go. I found a fuse bit calculator and some fuse bit writers but I am still not sure if it is possible to write fuse bits from the code directly?
And if it is possible, how?
fuse bit calculator: AVR Fuse Calculator for ATmega32U4

What's also a little bit unclear for me is, if it is possible to brick the controller by locking me out of the device. I guess this shoud be possible if I flash a program that just disables all programming functionality?
Or is there a workaround where the chip can always be reset or the fuse bits can be manipulated from outside?

Hope you can help.
Sorry if the question is already answered hundreds of times but I am currently just confused.

Usually, bootloaders can not modify fuses.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.