Skip to content

ATSAMD21E18A - cannot write user_word_0 when BOOTPROT is on #53

@russfretenburg

Description

@russfretenburg

When BOOTPROT (bits 2:0 of user_word_0) is set to anything other than 7 (default, boot protect off), I cannot write to byte 0 of the user_word. If it is set to 7, I can successfully write a different value to it, for example 0xFA, which enables boot protection for 8192 Bytes. I can change byte 0 back to 0xFF using the Microchip Studio programmer interface, and then can write to it again with pymcuprog.

pymcuprog does not report any error and says the write is complete, but when I read the value back it has not changed. I also confirmed with Microchip Studio that the value did not change.

Testing on Windows 11 with Python 3.13.3.
pymcuprog version 3.19.4.61
programmer dongle: Atmel-ICE

Below are the steps to reproduce.

PS C:\Users\russf> pymcuprog -d atsamd21e18a read -m user_row -b 8
Connecting to anything possible
Connected to Atmel-ICE CMSIS-DAP from ATMEL (serial number J42700063793)
Debugger firmware version 1.42.161
Debugger hardware revision 0
Pinging device...
Ping response: 1001031C
Reading...
Memory type: user_row
---------------------------------------------------------
0x804000: FF C7 E0 D8 5D FC FF FF xx xx xx xx xx xx xx xx
---------------------------------------------------------


Done.
PS C:\Users\russf> pymcuprog write -U -d atsamd21e18a -m user_row -l 0xFA -v debug
Connecting to anything possible
Connected to Atmel-ICE CMSIS-DAP from ATMEL (serial number J42700063793)
Debugger firmware version 1.42.161
Debugger hardware revision 0
pymcuprog.programmer - INFO - Setting up programming session for 'atsamd21e18a'
pymcuprog.deviceinfo.deviceinfo - INFO - Looking for device atsamd21e18a
pymcuprog.nvm - INFO - SAM-M0+ stack is in Beta state
pymcuprog.samtarget - INFO - Target voltage read out: 2.53V
pymcuprog.samtarget - INFO - Connecting to SAMD2x DAP
pymcuprog.samtarget - INFO - Using SWD CLK of 2000000 Hz
pymcuprog.nvm - DEBUG - No specific initializer for this provider
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to user_row...
pymcuprog.samtarget - DEBUG - Is device locked?
pymcuprog.nvm - DEBUG - Writing 4 bytes to address 0x804000
pymcuprog.programmer - INFO - Write complete.
Done.
PS C:\Users\russf> pymcuprog -d atsamd21e18a read -m user_row -b 8
Connecting to anything possible
Connected to Atmel-ICE CMSIS-DAP from ATMEL (serial number J42700063793)
Debugger firmware version 1.42.161
Debugger hardware revision 0
Pinging device...
Ping response: 1001031C
Reading...
Memory type: user_row
---------------------------------------------------------
0x804000: FA C7 E0 D8 5D FC FF FF xx xx xx xx xx xx xx xx
---------------------------------------------------------


Done.
PS C:\Users\russf> pymcuprog write -U -d atsamd21e18a -m user_row -l 0xFF -v debug
Connecting to anything possible
Connected to Atmel-ICE CMSIS-DAP from ATMEL (serial number J42700063793)
Debugger firmware version 1.42.161
Debugger hardware revision 0
pymcuprog.programmer - INFO - Setting up programming session for 'atsamd21e18a'
pymcuprog.deviceinfo.deviceinfo - INFO - Looking for device atsamd21e18a
pymcuprog.nvm - INFO - SAM-M0+ stack is in Beta state
pymcuprog.samtarget - INFO - Target voltage read out: 2.56V
pymcuprog.samtarget - INFO - Connecting to SAMD2x DAP
pymcuprog.samtarget - INFO - Using SWD CLK of 2000000 Hz
pymcuprog.nvm - DEBUG - No specific initializer for this provider
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to user_row...
pymcuprog.samtarget - DEBUG - Is device locked?
pymcuprog.nvm - DEBUG - Writing 4 bytes to address 0x804000
pymcuprog.programmer - INFO - Write complete.
Done.
PS C:\Users\russf> pymcuprog -d atsamd21e18a read -m user_row -b 8
Connecting to anything possible
Connected to Atmel-ICE CMSIS-DAP from ATMEL (serial number J42700063793)
Debugger firmware version 1.42.161
Debugger hardware revision 0
Pinging device...
Ping response: 1001031C
Reading...
Memory type: user_row
---------------------------------------------------------
0x804000: FA C7 E0 D8 5D FC FF FF xx xx xx xx xx xx xx xx
---------------------------------------------------------


Done.
PS C:\Users\russf>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions