"Unable to enter programming mode" error SAM4S

Discussion around product based on ARM Cortex M4 core.
This forum will be discontinued soon.

Moderators: nferre, ncollot

Yaro
Posts: 13
Joined: Mon May 25, 2015 8:00 pm

"Unable to enter programming mode" error SAM4S

Wed Dec 16, 2015 3:40 pm

Hi all,

I've recently tried SAM4S with a custom board and worked fine in programming and debugging via SWD. Now I started to try another custom board always based on SAM4S with same configurations as previous(ERASE, RESET, ecc..) but I've a problem.

When I try to read device ID or program/erase device I've this error:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Timestamp: 2015-12-12 15:22:43.963
Severity: INFO
ComponentId: 20000
StatusCode: 0

Could not activate interface, but found DAP with ID 0x2ba01477.

This usually indicates that the security bit is set. Please try to perform a chip erase to clear the security bit before accessing the device again.

Unable to enter programming mode. Verify device selection, interface settings, target power, security bit, and connections to the target device.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I've tryed to ERASE using dedicated pin of ATSAM4S. The pin is connected using a pulldown resistor of 100k Ohm on board to GND. I've connected this pin to VCC and power up the board, waited for 25 sec. to perform a complete erase and then disconnected connection between ERASE pin and VCC. After this I was able to read the device ID only one time, the second reading and next readings give me same error "Could not activate interface, but found DAP with ID 0x2ba01477. ". The strange thing is that happen every time for every thing I do, for example I can read ID, but my next actions give me this error, or if I perform erase(erase from Atmel studio) as first action, next actions give me this error. This happens every time I perform ERASE, I can just do only one thing and after that I have this error until I perform another ERASE.

I can exclude that there is some kind of interferences or bad connections on my SWD connection between debugger and board, also I've ensured a well connection between debugger and board.

What can be the problem?
Yaro
Posts: 13
Joined: Mon May 25, 2015 8:00 pm

Re: "Unable to enter programming mode" error SAM4S

Wed Dec 16, 2015 3:52 pm

UPDATE:

I've found that if I press Read ID at the same time I'm powering the device and board(switching to ON a simple ON/OFF switch) I can read 1 or 2 times the Device ID if I hit the "Read" button when I switch power to ON, after that initial working time it start to give me the previous error. Also I can perform any actions in this small amount of time, like to read GPNVMBITS that is set to '0', or ERASE the device. After that I've this error. That's is somehow strange.
jrb114
Posts: 3
Joined: Tue Dec 22, 2015 1:08 am

Re: "Unable to enter programming mode" error SAM4S

Tue Dec 22, 2015 1:19 am

I have exactly this problem with an AT91SAM3S-2B.

With each custom PCB I've produced and an alternative manufacturer's dev board, I have had to erase the chip using ERASE on start up before I can initially program it. I cannot remember if I had to do the same with my Atmel SAM4S-EK2. Can anybody confirm if this is normal/ expected behaviour? I have been unable to find any information on this.

However, I've recently produced a couple of PCBs which I cannot even erase using the pull high during start up trick. (Normally pulled up through 1M to VDD, internal 15k or 100k or whatever to GND. During power up I short across the 1M to directly apply VDD to PB12/ERASE.) One of these behaves so randomly that it even lights an LED sometimes during some power on resets (maybe every 20 times) despite never having been programmed. (To confirm, the behaviour is so erratic that it is not even reproducible.)

(From the same batch I have inconsistent behaviour even on the PCBs that I can erase. They do not execute code correctly after programming, so I am unsure whether this is quite the same issue. I would still like confirmation regarding my question in bold, however.)

If anyone else has observed this behaviour and even better, has a solution, I'd be delighted if you could share it.

Thanks,
J
jrb114
Posts: 3
Joined: Tue Dec 22, 2015 1:08 am

Re: "Unable to enter programming mode" error SAM4S

Thu Feb 18, 2016 7:24 pm

So I have finally figured this bug out.

It turns out in the errata of the SAM3S datasheet, buried deep deep down. (Doc 6500E-ATARM-11-Feb-13, page 1068, (wrongly numbered 11068!).
45.2.4 SAM-BA
45.2.4.1 SAM-BA Boot: Start-up Issue when Using No Clock on XIN
If no crystal (between XIN/XOUT) or no ceramic resonator (between XIN/XOUT) or no bypass mode (on XIN) is used, SAM-BA Boot may not start on some parts. As SAM-BA Boot is running by default when the Flash is erased, the parts cannot be accessed even by JTAG under those conditions.

Problem Fix/Workaround
Use an external crystal or ceramic resonator on XIN/XOUT, or use the Main oscillator in bypass mode (applying a clock on XIN).
My custom made PCB does not have an external clock on XIN/XOUT, I used SCLK (32768 Hz) for timing and the internal oscillator to execute instructions. Consequently, some of my custom PCBs work as SAMBA boots correctly, and some, well, just don't.

So what I did to make these boards work was provide a 1 MHz clock to XIN using a signal generator. Apply power to the PCB, then connect using the ATMEL-Ice. This connects fine. After that I set the GPNVM Bit 1 so we boot from flash, not SAMBA, programmed the device and it works fine.

I sure hope they issue a rev B for this range of chips without this error.

J
talanfree
Posts: 3
Joined: Thu Nov 03, 2016 10:51 am

Re: "Unable to enter programming mode" error SAM4S

Thu Nov 03, 2016 11:09 am

I have the same problem, but external crystal did not work for me.

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest