Error in downloading DCT image to external FLash

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I'm trying to run OTA_FR app. I've connected an external SPI flash (S32FL032P). I'm using MXCHIP EMW3162 board. This board has STM32f205 with BCM43362. I'm able to download fr_app into serial flash, but it fails to download DCT Image.

When downloading the images, I get following log,

Downloading Bootloader ...

Building apps lookup table

Download complete

Downloading DCT ...

Download complete

Downloading Application ...

Download complete

Downloading FR_APP (build/snip_ota_fr-MXCHIP3162-FreeRTOS-LwIP-SDIO/binary/snip_ota_fr-MXCHIP3162-FreeRTOS-LwIP-SDIO.stripped.elf) at sector 1...

Downloading DCT_IMAGE (build/snip_ota_fr-MXCHIP3162-FreeRTOS-LwIP-SDIO/DCT.stripped.elf) at sector 114...

tools/makefiles/wiced_apps.mk:101: recipe for target 'DCT_IMAGE_DOWNLOAD' failed

make.exe[1]: *** [DCT_IMAGE_DOWNLOAD] Error 1

Makefile:185: recipe for target 'main_app' failed

make: *** [main_app] Error 2

0 Likes
8 Replies
Anonymous
Not applicable

Hi,

the problem goes in to two parts, first writing to external serial flash itself through the sflash read and write APIs. this requires platform configurations, have a look at apps/waf/sflash_write.c and see if you can through the code read and write in to the serial flash.

Once this part is done, you need to configure your platform to indicate that OTA is configured and supported. have a look at Error in downloading DCT image to external FLash, where i explained steps needed to configure for OTA.

Regards,

Bassem

0 Likes
Anonymous
Not applicable

sorry, I meant have a loot at SDK 3.1.2 SN8205 snip.ota_fr FR_APP_SECTOR_START

0 Likes
Anonymous
Not applicable

Thanks Bassem,

I was missing the define PLATFORM_HAS_OTA.

But even after doing all as per mentioned in the discussion link mentioned above, I'm getting following error

Downloading FR_APP (build/snip_ota_fr-MXCHIP3162-FreeRTOS-LwIP-SDIO-debug/binary/snip_ota_fr-MXCHIP3162-FreeRTOS-LwIP-SDIO-debug.stripped.elf) at sector 1...

tools/makefiles/wiced_apps.mk:89: recipe for target 'FR_APP_DOWNLOAD' failed

make.exe[1]: *** [FR_APP_DOWNLOAD] Error 1

make: *** [main_app] Error 2

Makefile:185: recipe for target 'main_app' failed

When I checked in OpenOCD log, I see that a few locations are written, then verification fails at a particular location always.

Open On-Chip Debugger 0.8.0 (2014-05-02-12:11)

Licensed under GNU GPL v2

For bug reports, read

  http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : only one transport option; autoselect 'jtag'

trst_and_srst separate srst_nogate trst_push_pull srst_push_pull connect_assert_srst

adapter speed: 1000 kHz

adapter_nsrst_delay: 100

jtag_ntrst_delay: 100

Warn : target name is deprecated use: 'cortex_m'

jtag_init

post_init_setup

Warn : Using DEPRECATED interface driver 'ft2232'

Info : Consider using the 'ftdi' interface driver, with configuration files in interface/ftdi/...

Info : device: 4 "2232C"

Info : deviceID: 72467242

Info : SerialNumber: cc3101A

Info : Description: USB <-> JTAG/SWD A

Info : clock speed 1000 kHz

Info : JTAG tap: stm32f2xxx.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)

Info : JTAG tap: stm32f2xxx.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0)

Info : stm32f2xxx.cpu: hardware has 6 breakpoints, 4 watchpoints

Info : JTAG tap: stm32f2xxx.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)

Info : JTAG tap: stm32f2xxx.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0)

platformBusDebug = MXCHIP3162-SDIO

53020 bytes written at address 0x20000000

downloaded 53020 bytes in 0.742641s (69.721 KiB/s)

entry_address= 536888789

stack_address= 536933460

buffer_size= 16384

pc (/32): 0x200045D5

Total write size is 527240

writing 16384 bytes at 4096

loadimage address 536870940 foffset 0 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.232162s (68.917 KiB/s)

****************** Result: OK

writing 16384 bytes at 20480

loadimage address 536870940 foffset 16384 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.232170s (68.915 KiB/s)

****************** Result: OK

writing 16384 bytes at 36864

loadimage address 536870940 foffset 32768 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.230116s (69.530 KiB/s)

****************** Result: OK

writing 16384 bytes at 53248

loadimage address 536870940 foffset 49152 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.232204s (68.905 KiB/s)

****************** Result: OK

writing 16384 bytes at 69632

loadimage address 536870940 foffset 65536 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.230163s (69.516 KiB/s)

****************** Result: OK

writing 16384 bytes at 86016

loadimage address 536870940 foffset 81920 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.230171s (69.514 KiB/s)

****************** Result: OK

writing 16384 bytes at 102400

loadimage address 536870940 foffset 98304 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.230145s (69.521 KiB/s)

****************** Result: OK

writing 16384 bytes at 118784

loadimage address 536870940 foffset 114688 16384

16384 bytes written at address 0x2000001c

downloaded 16384 bytes in 0.230152s (69.519 KiB/s)

****************** Result: Verify after write failed

Runtime Error: apps/waf/sflash_write/sflash_write.tcl:204:

in procedure 'sflash_write_file'

in procedure 'program_sflash' called at file "apps/waf/sflash_write/sflash_write.tcl", line 252

in procedure 'exit' called at file "apps/waf/sflash_write/sflash_write.tcl", line 20

I've printed log from serial_write app as well on UART.

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 4096

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 20480

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 36864

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 53248

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 69632

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 86016

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 102400

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Waiting for command

Received command: POST_WRITE_VERIFY WRTIE_ERASE_IF_NEEDED

Destination address: 118784

Size: 16384

Initialising

Done initialising

Verifying existing data!

Verifying after write

Verify error - Data was not written successfully - abort!

Waiting for command

I'm not able to debug what might be the possible issue.

0 Likes
Anonymous
Not applicable

Another question : where do I set size of exernal flash that I'm attaching?

I've got a feeling that I'm getting this write failure because of external flash size being set as 128KB, device is erasing only 128KB of memory and when it goes for writing beyond 128KB, it fails.

I'm not sure though.

0 Likes
Anonymous
Not applicable

Hi,

First, Please follow the steps indicates SDK 3.1.2 SN8205 snip.ota_fr FR_APP_SECTOR_START

Regarding Flash size, it is currently hard coded to 4096, but you can find this in tools/makefiles/wiced_apps.mk

search for the  4096 size and replace it. This needs to be tested though.

Regards,

Bassem

0 Likes
Anonymous
Not applicable

Hi Bassem,

4096 is number of sectors there, so I'm fine with that.

I figured out what the actual problem is. In the memory chip that I'm using, first 128KB can be divided into sub-sectors of size 4KB. Beyond 128KB, sector is 64KB.

So in erase sector, I changed the code for erasing 64KB sectors. After that I'm able to write successfully.

Now the issue that I get is booting from updated app. As mentioned in ota_fr application example, I follow the steps and download new image using web browser. After upload is done, device calls for reset, but doesn't reboot ever again. Even after I hard reset the device, it doesn't boot up.

I'm guessing it has got something to do with loading new app.

Here is the snippet of upload log from device

Erasing secotr 0xe4000

Writing chunk 434 of size 1024 from offset 443392

Writing chunk 435 of size 1024 from offset 444416

Writing chunk 436 of size 1024 from offset 445440

Writing chunk 437 of size 1024 from offset 446464

Erasing secotr 0xe5000

Writing chunk 438 of size 1024 from offset 447488

Writing chunk 439 of size 1024 from offset 448512

Writing chunk 440 of size 1024 from offset 449536

Writing chunk 441 of size 1024 from offset 450560

Erasing secotr 0xe6000

Writing chunk 442 of size 1024 from offset 451584

Writing chunk 443 of size 1024 from offset 452608

Writing chunk 444 of size 1024 from offset 453632

Writing chunk 445 of size 1024 from offset 454656

Erasing secotr 0xe7000

Writing chunk 446 of size 1024 from offset 455680

Writing chunk 447 of size 1024 from offset 456704

Writing chunk 448 of size 1024 from offset 457728

Writing chunk 449 of size 1024 from offset 458752

Erasing secotr 0xe8000

Writing chunk 450 of size 1024 from offset 459776

Writing chunk 451 of size 808 from offset 460800

Uploaded file size = 461608

Restarting..

0 Likes
Anonymous
Not applicable

Got it working.

Again, it was the same issue - sector size.

Modified sector size to 0x10000 in "wiced_apps_erase_sections" function in "wiced_apps_common.c"

0 Likes
Anonymous
Not applicable

great work !!

0 Likes