Help Needed: unable to program SPI flash if it's not empty

9 posts / 0 new
Last post
gouzhuang
Offline
Last seen:4 years 9 months ago
加入:2015-04-16 08:10
Help Needed: unable to program SPI flash if it's not empty

Hi Dialog Support,

我们已经建立了一些董事会完全复制了聪明Tag reference design and encountered some very strange behaviours on programming the boards.

SmartSnippets 3.7 SPI Flash Programmer is used for programming. If a board is being programmed for the first time, it will succeed. When I try to program it for the 2nd time, it fails.

There were 2 cases:
case 1:
On board 1, The first successfully programmed firmware was the SmartTag reference applicaiton. When I tried to program it to another custom firmware, the following message is display when I click "Connect"
[INFO @15-04-29 23:58:16] Could not measure total IR len. TDO is constant high.
[ERROR @15-04-29 23:58:16] Could not read memory.
[ERROR @15-04-29 23:58:16] No known chip found while opening JLink connection. Terminating proccess...
[INFO @15-04-29 23:58:16] Failed downloading firmware file to the board.

If I press the reset button while click "Connect", it connects successfully
[INFO @15-04-30 00:02:40] BTLE device selected.
[INFO @15-04-30 00:02:40] Firmware File C:\Users\bgou\SmartSnippets\resources\jtag_programmer.bin has been selected for downloading.
[INFO @15-04-30 00:02:41] Successfully downloaded firmware file to the board.

Then I selected f/w file to download and click Burn, the following log message is displayed which looks like it was successful, however the memory content read is different from the f/w file
[INFO @15-04-30 00:04:35] Header records have been removed from hex file custom_fw.hex.
[INFO @15-04-30 00:04:35] Read 17416 bytes from file custom_fw.hex.
[INFO @15-04-30 00:05:01] Started burning memory with 17736 bytes of data at address 0x00000.
[INFO @15-04-30 00:05:05] Memory burning completed successfully.
[INFO @15-04-30 00:05:05] Reading memory to refresh memory contents....
[INFO @15-04-30 00:05:08] Reading has finished. Read 32768 bytes.

I disconnected the board and tested it and found it still ran the old f/w. I have repeated the above procedure many times, all have the same result.

case 2:
On another board, I connected it in SmartSnippets and it showed:
[INFO @15-04-30 00:02:40] Firmware File C:\Users\bgou\SmartSnippets\resources\jtag_programmer.bin has been selected for downloading.
[INFO @15-04-30 00:02:41] Successfully downloaded firmware file to the board.

Then I disconnected the board WITHOUT burn any f/w image. Then I connected the board again and tried to burn a f/w this time, and it behaves similar to case 1: the log says the burning completed successfully but refreshed memory contents are different, and test showed no f/w was burnt.

Thanks,
Bill

gouzhuang
Offline
Last seen:4 years 9 months ago
加入:2015-04-16 08:10
One thing to add: for both

One thing to add: for both boards, I can use Keil to load f/w into RAM without problem.

summer20100514
Offline
Last seen:4 years 4 months ago
Guru
加入:2014-12-30 05:01
嗨,SPI FLASH should be

嗨,SPI FLASH should be erased (at least the sector you are writting to) before you do writing operations.

gouzhuang
Offline
Last seen:4 years 9 months ago
加入:2015-04-16 08:10
是的,我试图抹去

是的,我试图抹去flash first but unfortunately the refreshed contents looks strange: some are 00, some are FF and some are random values.

JE_Dialog
Offline
Last seen:1 month 16 min ago
Staff
加入:2013-12-05 14:02
Hi gouzhuang, what image are

Hi gouzhuang, what image are you trying to burn into FLASH ? is this generated from the standard source code for the Smart Tags project, or your own customised version ? and do you have a secondary bootloader burnt into OTP ?
BR JE_Dialog

gouzhuang
Offline
Last seen:4 years 9 months ago
加入:2015-04-16 08:10
The image I'm trying to burn

The image I'm trying to burn is a very simple one based on the template project with just battery service and a customized adv content.

I do not have a secondary bootloader in otp.

Thanks.

gouzhuang
Offline
Last seen:4 years 9 months ago
加入:2015-04-16 08:10
I figured out what's the

I figured out what's the problem. If the flash was programmed once, the board boots from flash every time it is powered up. This seemed to get in the way of erasing/writing the flash again. What I do to get around this is to trun the power switch on RIGHT BEFORE clicking connect in SmartSnippets, so that I have a chance to connect before it boots from flash. I have successfully re-programmed 3 boards using this trick.

Note: RESET does not work for me, I have to use the power switch on the board.

Is this expected behaviour or did I do something wrong? Hope somebody could shed a light on this.

Thanks.

JE_Dialog
Offline
Last seen:1 month 16 min ago
Staff
加入:2013-12-05 14:02
Hello gouzhuang, it is

Hello gouzhuang, it is expected behavior in that the device will boot directly from FLASH if it has no OTP and detects external connection ( that shows ROM bootloader is working properly). The problem wtih UART programming of the reference designs is that there is sometimes voltage on the UART lines at the time of Power On Reset, and that stop sthe device booting. We typically program the reference design boards using JTAG , although tihs requires a specific cable and alreayd having access to a JLINK debugger.

BR JE_Dialog

gouzhuang
Offline
Last seen:4 years 9 months ago
加入:2015-04-16 08:10
Hi JE_Dialog, the fact is

Hi JE_Dialog, the fact is that I was programming the boards using JTAG through the DevKit Basic.

Thanks,
Bill