Help updating bootloader with Atmel-ICE
-
Hello, I have a 3HC board that is not connecting with CAN and I'm worried that the bootloader is corrupt so I'm trying to re-flash it with an Atmel-ICE. The issue is that I'm getting this error:
I'm following this guide: https://duet3d.dozuki.com/Wiki/Updating_the_bootloader_on_Duet_3_expansion_and_tool_boards
I'm able to read, erase, change USER_WORD_0.NVMCRTL_BOOTPROT to 0, etc. so I think I've got it wired correctly. Do I have the wrong bootloader .elf file? I tried the .bin file as well and had the same issue.
I'm getting the file from here: https://github.com/Duet3D/Duet3Bootloader/releases
What am I doing wrong?
Thanks!!
-
@p8blr that error usually means that you haven't removed the bootloader protection, or that you did but it was immediately reinstated because you didn't disconnect the CAN bus and then erase the firmware first. Check the value of USER_WORD_0.NVMCRTL_BOOTPROT again.
-
-
@p8blr if you go back to the fuses page after programming fails, does it still show the bootloader protection as 0kb ?
-
@dc42 Yes it still shows 0 kbytes.
-
@p8blr your USER_WORD_0 and USER_WORD_1 values look wrong to me. Your screen shot doesn't show the full values, however USER_WORD_1.RAMECC_ECCDIS should be checked, and my USER_WORD_0 value is 0xFE9a9239 which is nothing like your 0x3C000000. My USER_WORD_1 value is 0xAEECFFB1 and USER_WORD_2 is 0xFFFFFFFF.
USER_WORD_0 include some factory calibration values in bits 15 to 25, and unfortunately it looks like those have got cleared to zero in your chip. However I don't think that matters much because those only affect the brown-out threshold.
-
-
@p8blr I think you need to at least set userword2.nvmregionlocks to 0xFFFFFFFF.
-
@dc42 So I managed to get the board to work, but still can't get it to verify. I did several things and I'm not sure which thing I did made it work.
I connected a known good 3HC that I had and saved the Flash and User Page files. Then I connected the bad board and programmed the User Page with the Document.userpage file I backed up. I then tried to program the Flash with the Document.hex file I backed up and that failed verification like before. So I unchecked "Verify Flash after programming" re-programmed it, connected it to CAN and it worked. I was able to detect it with M115 and updated the firmware with M997.
Here's my settings after doing what I did:
Does it matter that it fails verification but works?
-
@p8blr perhaps the security bit has somehow got set and isn't being cleared by chip erase as is supposed to happen. If the bootloader is working and M122 confirms the bootloader version number then I guess it is OK. The firmware itself won't start up if it fails to verify its own CRC.
-
@dc42 Would it be wise to attempt to update the bootloader over CAN now that I have it connected?
-
@p8blr only if you want to. My guess is that the bootloader has installed OK but cannot be read back via the ICE because the MCU thinks the security bit is set.