I'm using an Arduino Nano Every Board for a project and want to protect my program from unauthorized reading. I have researched the internet that this is possible with Lock Bits and Fuses.
But I only found examples where I need a SPI programmer.
Is there a way to program the lock bits or fuses in the Arduino IDE software?
Thanks in advance.
From the Atmega4809 datasheet:
7.8 Fuses (FUSE)
Fuses hold the device configuration and are a part of the nonvolatile memory. The fuses are available from device
power-up. The fuses can be read by the CPU or the UPDI, but can only be programmed or cleared by the UPDI. The
configuration values stored in the fuses are copied to their respective target registers at the end of the start-up
sequence.
The fuses are preprogrammed but can be altered by the user. Altered fuse values will be effective only after a Reset.
Note: When writing the fuses, all reserved bits must be written to ‘0’.
7.9 Memory Section Access from CPU and UPDI on Locked Device
The device can be locked so that the memories cannot be read using the UPDI. The locking protects both the Flash
(all BOOT, APPCODE, and APPDATA sections), SRAM, and the EEPROM including the FUSE data. This prevents
successful reading of application data or code using the debugger interface. Regular memory access from within the application still is enabled.
The device is locked by writing any invalid key to the LOCKBIT bit field in FUSE.LOCKBIT.
- UPDI - Unified Program and Debug Interface
30.1 Features
• Programming:
– External programming through UPDI one-wire (1W) interface
• Uses a dedicated pin of the device for programming
• No GPIO pins occupied during operation
• Asynchronous Half-Duplex UART protocol towards the programmer with the programming time up to
0.9 Mbps.
• Debugging:
– Memory mapped access to device address space (NVM, RAM, I/O)
– No limitation on device clock frequency
– Unlimited number of user program breakpoints
– Two hardware breakpoints
– Run-time readout of CPU Program Counter (PC), Stack Pointer (SP), and Status register (SREG) for code
profiling
– Program flow control
• Go, Stop, Reset, Step Into
– Non-intrusive run-time chip monitoring without accessing system registers
• Monitor CRC status and sleep status
• Unified Programming and Debug Interface (UPDI):
– Built-in error detection with error signature readout
– Frequency measurement of internal oscillators using the Event System
30.2 Overview
The Unified Program and Debug Interface (UPDI) is a proprietary interface for external programming and on-chip
debugging of a device.
The UPDI supports programming of nonvolatile memory (NVM) space; FLASH, EEPROM, fuses, lockbits, and the
user row. In addition, the UPDI can access the entire I/O and data space of the device. See the NVM controller
documentation for programming via the NVM controller and executing NVM controller commands.
Programming and debugging are done through the UPDI Physical interface (UPDI PHY), which is a one-wire UART based half duplex interface using a dedicated pin for data reception and transmission. Clocking of UPDI PHY is done by the internal oscillator. The UPDI access layer grants access to the bus matrix, with memory mapped access to system blocks such as memories, NVM, and peripherals.
The Asynchronous System Interface (ASI) provides direct interface access to On-Chip Debugging (OCD), NVM, and
System Management features. This gives the debugger direct access to system information, without requesting bus
access.
So, fuses are not accessed via an ICSP/SPI interface as they are on the Nano with Atmega328P.
I don't know enough yet about UPDI to address how that is used.
UPDI connection on the Nano Every: