I try to use the FRDM-KW41Z with the BLE OTAP client example and configure it to use the internal Flash for temporary storing the image sent over the air (Kinetis Thread Stack Over-the-Air (OTA) Firmware Update User’s Guide, Chapter 3 Software implementation) and (BLEApplicationDevelopersGuide, Chapter11.7.2 The OTAP Client) . I can connect to the OTAP client using the IoT Toolbox. But when I start the upload the uploading stops at 9% and restart at 0% for several cycles. What can I do to get the OTAP client work with this configuration?
Hi!
I am implementing the reprogramming of a KW41Z board using the OTAP Client Software, with Internal Storage. Following the instructions of the link Reprogramming a FRDM-KW41 board using the OTAP Client Software
I got update the firmware using the otap_client_att as base and updating to the glucose sensor example. However the glucose sensor does not include the OTAP service so it is possible to reprogramming only once.
I tried to add the OTAP service to the glucose sensor example but I did not get succesfully. I copied the code of the OTAP service at otap_client_att following the document AN12775. The OTAP service requires OtaSupport.h and Eeprom.h. Selecting #define gEepromType_d gEepromDevice_InternalFlash_c and copying the MKW41Z512xxx4_connectivity.ld I achieved build without errors but the uploading does not start when I try to upload with the IoT Toolbox. It remains at 0%
Do you have any idea of the wrong proccess I am following?
Thanks and regards!
Hi,
I hope this will help you.
Regards
/* Workaround for SRAM boundary GCC placement issue,
not to place variables that are accessed by the code
overlapping this boundary (forbidden by the Kinetis architecture) */
__region_RAM1_start__ = (0x1FFF8000);
__region_RAM1_end__ = (0x1FFFFFFF);
__region_RAM2_start__ = (0x20000000);
__region_RAM2_end__ = (0x20017FFF);
That is a bit unsettling to see.
 Variables would normally be aligned to a 16 or 32 bit boundary would they not?
So why would they cross that boundary?
I can see that a struct with the packed attribute could do it, anything else?
I'm really surprised that it works fine becuse i compare your file and the one in USB sdk, and i have note some differences like :
___________________________________________
Lothar:
gUseBootloaderLink_d : 0;
USB SDK linker file:
gUseBootloaderLink_d : 1;
____________________________________________
Lothar:
gUseInternalStorageLink_d : 0;
USB SDK linker file:
gUseInternalStorageLink_d : 1;
____________________________________________
m_bootFlags_end = (m_bootFlags_start + 7);
m_bootFlags_end = (m_bootFlags_start + 16);
____________________________________________
/* #if gUseNVMLink_d && gEraseNVMLink_d */
/* .NVM : */
/* { */
/* FILL(0xFFFFFFFF); */
/* . = ORIGIN(NVM_region) + LENGTH(NVM_region) - 1; */
/* BYTE(0xFF) */
/* } > NVM_region */
should be linke this according to the tutorial:
.NVM :
 {
 FILL(0xFFFFFFFF);
 . = ORIGIN(NVM_region) + LENGTH(NVM_region) - 1;
 BYTE(0xFF)
 } > NVM_region
but ORIGIN should stay and Lothar remove all.
So it seems that Lothar , you don't use the bootloader that is necessary to upgrade the firmware once downloaded and it seems you use external memory. Then how is it possible that you successfully use internal memory OTA feature please?
in one month an application note will be written to merge OTAP example into HRS demo code. I will do the job upfront. I already did on previous sdk. With the new there is few differences. I will upte all my tool and re do the job to start clean. then i will follow this first tutorial:
Reprogramming a FRDM-KW41 board using the OTAP Client Software
doo you have the samedi linker fiile than the one in USB sdk now ?Or something quiet similar ?
Hi,
I also started with an usb sdk and had to modify the linker file. The tutorial is helpful.
Regards.
Hi Felipe,
how long does it takt to get a solution? Sorry, but I'm a little bit under pressure.
Regards
Lothar
 
					
				
		
 FelipeGarcia
		
			FelipeGarcia
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Lothar,
Sorry but I don’t have that information. Sorry for any inconvenience.
Regards,
Felipe
Hi Felipe,
what issue will be fixed? The OTAP IoT Toolbox problem, the map file or both?
Regards
Lothar
 
					
				
		
 FelipeGarcia
		
			FelipeGarcia
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Lothar,
The internal team has confirmed Internal Flash Storage is currently not supported on KW41Z linker and bootloader. They will take a look into this, thanks for bringing this issue to our attention.
Best regards,
Felipe
Hi Felipe,
the document describes the same thinks I did in KW41Z configuration. Sorry but that didn't help me. I tried to replace the Linker file. After building the application with the KW36 linker file I compare the memory configuration in the map file and I get totally confused. The Symbol _APP_START_ is 0x00000000 and __BootFlags_Start__ is 0x000020c0. How can this be? The Symbol gUseBootloaderLink_d is set to 1 in the MCUXpresso.
               0x00000400                HEAP_SIZE = DEFINED (__heap_size__)?__heap_size__:0x400
                0x00000400                STACK_SIZE = DEFINED (__stack_size__)?__stack_size__:0x400
                0x00000000                M_VECTOR_RAM_SIZE = DEFINED (__ram_vector_table__)?0xc0:0x0
                0x1fffc000                _RAM_START_ = 0x1fffc000
                0x2000c000                _RAM_END_ = 0x2000c000
                0x00000000                _ROM_START_ = 0x0
                0x00080000                _ROM_END_ = 0x80000
                0x0007f800                FREESCALE_PROD_DATA_BASE_ADDR = 0x7f800
                0x00000800                __sector_size__ = 0x800
                0x000000c0                __vector_table_size__ = 0xc0
                0x00000000                _APP_START_ = DEFINED (gUseBootloaderLink_d)?(_ROM_END_ / 0x40):_ROM_START_
                0x000020c0                __BootFlags_Start__ = (_APP_START_ + __vector_table_size__)
                0x00000000                __BootFlags_Size__ = DEFINED (gUseBootloaderLink_d)?0x20:0x0
                0x0007f800                NV_STORAGE_START_ADDRESS = FREESCALE_PROD_DATA_BASE_ADDR
                0x00000800                NV_STORAGE_SECTOR_SIZE = __sector_size__
                0x00000004                NV_STORAGE_MAX_SECTORS = 0x4
                0x0007d800                NV_STORAGE_END_ADDRESS = (NV_STORAGE_START_ADDRESS - (NV_STORAGE_MAX_SECTORS * NV_STORAGE_SECTOR_SIZE))
                0x00000800                INT_STORAGE_SECTOR_SIZE = NV_STORAGE_SECTOR_SIZE
                0x0007f800                INT_STORAGE_START = DEFINED (gUseNVMLink_d)?NV_STORAGE_END_ADDRESS:FREESCALE_PROD_DATA_BASE_ADDR
                0x00000000                INT_STORAGE_SIZE = DEFINED (gUseInternalStorageLink_d)?(INT_STORAGE_SECTOR_SIZE * ((((INT_STORAGE_START - _APP_START_) / 0x2) / INT_STORAGE_SECTOR_SIZE) + 0x1)):0x0
                0x0003f800                INT_STORAGE_END = (INT_STORAGE_START - INT_STORAGE_SIZE)
                0x00000400                _FLASH_CONFIG_START_ = DEFINED (gUseBootloaderLink_d)?(__BootFlags_Start__ + __BootFlags_Size__):0x400
                0x00000010                _FLASH_CONFIG_SIZE_ = 0x10
                0x000020f0                _TEXT_START_ = (_FLASH_CONFIG_START_ + _FLASH_CONFIG_SIZE_)
                0x0007f800                _TEXT_END_ = DEFINED (gUseNVMLink_d)?NV_STORAGE_END_ADDRESS:FREESCALE_PROD_DATA_BASE_ADDR
Second:
I tried to update the FRDM-KW41Z using the NXP Test Tool 12 with a FRDM-KW41Z Server module. In this case I can do the OTAP Update. So the problem isn't the configuration of the FRDM-KW41Z Client it is the iOS IoT OTAP application. Please be so kind and do some test bevor replay to my request.
 
					
				
		
 FelipeGarcia
		
			FelipeGarcia
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Lothar,
This issue has been confirmed as an error in the OTAP example when using internal flash. It has been reported internally so it can be fixed for next releases. Thanks for your comments.
Best regards,
Felipe
 
					
				
		
 FelipeGarcia
		
			FelipeGarcia
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Lothar,
Could you please try using the following document? It is intended for KW36 but it should work for KW41Z.
https://community.nxp.com/docs/DOC-342493
Best regards,
Felipe
I am implementing the same with FRDM-KW36Z OTAP client internal storage eeprom device internal flash, and have the same issue. Firmware update restarts at 24 percent.
Also i found the progress bar of the Firmware update is fake, even if the device is switched/powered off the App still shows connected and the progress bar increases to the percent last shown and starts again.
NXP please update this and stop misleading us.
