• AVR Freaks

Can't program my ATSAM with Pickit4

New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2020/09/26 13:00:11
  • Location: 0
  • Status: offline
2020/10/21 17:08:32 (permalink)

Can't program my ATSAM with Pickit4

Hello all !
I'm trying to program my ATSAMC20G16A with my pickit4 but it won't allow me. It is always giving me this error :
Connecting to MPLAB PICkit 4...

Currently loaded versions:
Application version............00.06.47
Boot version...................01.00.00
Script version.................00.03.98
Script build number............4889ea0c51
Tool pack version .............1.3.875
Target voltage detected
Target device ATSAMC20G16A found.
Device Revision Id = 0x4

Calculating memory ranges for operation...


The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
configuration memory

Due to the large memory ranges on this device, only the areas of memory that have been loaded with code (via the build process or loading a hex file) will be read by default. If you wish to read custom ranges, please go to the Memories to Program property page and specify the ranges you want to read.
Verify failed. [ Pgm ] at 0x0, expected 0x20001ff0, got 0xffffffff
You have set the program speed to Normal. The circuit on your board may require you to slow the speed down. Please change the setting in the tool properties to low and try the operation again.
Programming did not complete.

I have little experience with PIC32 and MPLAB from work but I never started a project from scratch. In order to only test programming, I created a blank project in Harmony.

When I searched forums for a solution, I found these potential fix :
  • Tools package not updated - I updated them all, nothing changed
    • XC32 ver. 2.3
    • SAMC20_DFP (3.3.56)
    • CMSIS (5.4.0)
    • AtmellCE_TP 1.2.161
    • EDBG_TP 1.2.161
    • ICD4_TP 1.3.872
    • Pickit4_TP 1.3.875
    • PowerDebugger_TP 1.2.165
  • Wrong wiring -I can detect the device so I don't think it could be the issue here but here's my wiring anyway
I found 2 possible setup from online documentation and datasheet for SWD debug interface with pickit 4 (reset pin on 1 and 6)
I tried both and it didn't work.
  • Pickit4 not generating a reset signal - I verified with a scope and there is a signal
  • Wrong config bits : I configured config bits as suggested, see below
    #pragma config NVMCTRL_BOOTPROT = SIZE_0BYTES
    #pragma config NVMCTRL_EEPROM_SIZE = SIZE_0BYTES
    #pragma config BODVDDUSERLEVEL = 0x8 // Enter Hexadecimal value
    #pragma config BODVDD_DIS = DISABLED
    #pragma config BODVDD_ACTION = NONE

    #pragma config BODVDD_HYST = DISABLED
    #pragma config NVMCTRL_REGION_LOCKS = 0xFFFF // Enter Hexadecimal value

    #pragma config WDT_ENABLE = DISABLED
    #pragma config WDT_ALWAYSON = DISABLED
    #pragma config WDT_PER = CYC8

    #pragma config WDT_WINDOW = CYC8
    #pragma config WDT_EWOFFSET = CYC8
    #pragma config WDT_WEN = DISABLED
  • Slow down programming speed - I tried setting the lowest possible speed
  • Wrong decoupling value of VDDCORE - I tried the recommended value and 4.7uF and no luck
I'm out of options right now, any help would be appreciated

Thank you ! 

0 Replies Related Threads

    Jump to:
    © 2020 APG vNext Commercial Version 4.5