According to SAM D5x/E5x datasheet only main memory is handled by Region Lock Bits. However the current implementation of the CAN bootloader performs a NVMCTRL_RegionUnlock(addr) in static void device_config_write(uint32_t addr) resulting in Error Flags PROGE and ADDRE (and DONE) being set. Because ADDRE is set subsequent NVMCTRL_USER_ROW_RowErase fails.
One could argue though that the second part is more a fault of NVMCTRL_USER_ROW_RowErase as it does not clear INTFLAGS....
I will not prepare a PR as I don't know if other Microcontrollers this library applies to use Region Lock Bits for User Row. For SAM D5x/E5x though it would be just a case of dropping that RegionUnlock line of code.
According to SAM D5x/E5x datasheet only main memory is handled by Region Lock Bits. However the current implementation of the CAN bootloader performs a
NVMCTRL_RegionUnlock(addr)instatic void device_config_write(uint32_t addr)resulting in Error Flags PROGE and ADDRE (and DONE) being set. Because ADDRE is set subsequentNVMCTRL_USER_ROW_RowErasefails.One could argue though that the second part is more a fault of
NVMCTRL_USER_ROW_RowEraseas it does not clear INTFLAGS....I will not prepare a PR as I don't know if other Microcontrollers this library applies to use Region Lock Bits for User Row. For SAM D5x/E5x though it would be just a case of dropping that RegionUnlock line of code.