Hello,
I am working with a custom board that was designed originally with the ATSAMD21G18A-AF, works perfectly with this chip. Due to chip shortage I decided to buy a batch of ATSAMD21G16B to repair and order a new build of boards. However, trying to write the bootloader to this IC gives me the following error, on the Microchip Studio
Verifying Flash...Failed! address=0x0100 expected=0x00 actual=0x20
This happened on several boards. The boards have been visually inspected on a microscope and soldering is ok.
I am able to read and write fuses. I have checked the NVMCTRL.BOOTPROT is set for 0 Bytes (0x7 value on the register).
Something interesting is that the altered byte value is always on the 0x100 line offset. If I set the programming address to 0x100, for example , the failure happens at 0x200. Reading back the firmware hex file, shows me there are a few bytes changed but always at the 0x100, 0x300, 0x400 lines.
I am using a bootloader derived from Arduino Zero, modified it to accommodate the new Flash/RAM memory sizes. I attach the whole project. Since the "B" versions are not defined in the include files that go with the Arduino package, I used the includes provided with Microchip studio packages, within the Makefile:
INCLUDES=-I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\SAMD21_DFP\1.0.229\samd21b\include"
If I create a new blank project in the IDE, it compiles without using the makefile. But when flashing it to the board, it gives me the same error.
For programmer hardware I am using a Jlink ARMV8 that has worked flawlessly with the previous chip.
Any leads on the issue are appreciated!