How to halt the CPU (ATSAML21J18B) after PowerOn until the new binary is flashed using Jlink?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am using the controller ATSAML21J18B in my project.
The device is battery powered and has an application flashed and running.
When the device is powered off and powered on again, my intention is to start with a new application instead of the existing application.

Application-A running in the device --> Device is powered off --> Device is powered ON via Jlink (Debugger: Atmel SAM-ICE) and CPU is held in reset (Application-A not running)--> Application B is flashed --> Reset is released and CPU runs with Application-B.

In ATSAML21J18B datasheet attached,in section 15.6.2. it is mentioned that "CPU Reset Extension ensures that the CPU is not executing code at startup while a debugger is connected to the system".
But what I observe is, the application starts running immediately after I power the device via Jlink.

Do anyone know how to halt the CPU immediately after powering the device via Jlink?

Thanks,
Lavanya S P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lavanya S P wrote:
while a debugger is connected to the system

I guess that probably means, "while it has an active debug session connected" - not simply that it is physically plugged-on to the connector?

 

Why does it matter?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Awneil,

 

I understand from your point that the reset extension is applicable for active debug session and it has nothing to do with my question.

My intention is to halt the CPU immediately after powering the device using SAM-ICE via J-Link.

ie., after poweron, the device should never execute the old code that is already available, the CPU should be halted and available for programming. Once the new code is programmed it should start with the new code.

Is this possible using any settings in J-Link to control external RESET pin during powerOn?

I am aware that there are Jlink commands to toggle the RESET pin  but I am afraid once the device is powered on, the old code starts executing.

 

Thanks,

Lavanya S P