LPC55S16 - Flash IAP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC55S16 - Flash IAP

2,262 Views
Dhaya
Contributor III

We used the IAP Flash concept to store the data in our customised board. In some boards it works properly. But in some of the board, it not executed while entering the function of flash property controller get hanged. How can i resolve this issue. Here by I updated the code we generated

 

#include "fsl_iap.h"
#include "fsl_iap_ffr.h"
 
#include "init.h"
 
#define PAGE_INDEX_FROM_END 1U
 
 
flash_config_t flashInstance;
static uint32_t status;
uint32_t destAdrss; /* Address of the target location */
uint32_t failedAddress, failedData;
uint32_t pflashBlockBase            = 0;
uint32_t pflashTotalSize            = 0;
uint32_t pflashSectorSize           = 0;
uint32_t PflashPageSize             = 0;
 
 
 
void IAP_Flashwrite(void);
void IAP_Flashread(void);
void IAP_Address_cap(void);
 
 
 
 

int main()

{

IAP_Address_cap();
void IAP_Flashwrite(void);
IAP_Flashread();
while(1)
{
}
}
 
 
 
void IAP_Address_cap()
{
FLASH_Init(&flashInstance);
 
/* Get flash properties kFLASH_ApiEraseKey */
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashBlockBaseAddr, &pflashBlockBase);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashSectorSize, &pflashSectorSize);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashTotalSize, &pflashTotalSize);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashPageSize, &PflashPageSize);
 
 
destAdrss = pflashBlockBase + (pflashTotalSize - (PAGE_INDEX_FROM_END * PflashPageSize));
}
 
 
 
void IAP_Flashwrite(void)
{
static uint8_t status;
 
status = FLASH_Erase(&flashInstance, destAdrss, PflashPageSize, kFLASH_ApiEraseKey);
status = FLASH_VerifyErase(&flashInstance, destAdrss, PflashPageSize);
 
/* Start programming specified flash region */
status = FLASH_Program(&flashInstance, destAdrss, (uint8_t *)IAP_data_buffer, sizeof(IAP_data_buffer));
 
// /* Verify if the given flash region is successfully programmed with given data */
// status = FLASH_VerifyProgram(&flashInstance, destAdrss, sizeof(Write_byte), 
// (const uint8_t *)Write_byte, &failedAddress, &failedData);
}
 
 
 
void IAP_Flashread(void)
{
destAdrss = pflashBlockBase + (pflashTotalSize - (PAGE_INDEX_FROM_END * PflashPageSize));
/* Verify programming by reading back from flash directly */
for (uint32_t i = 0; i < 64; i++)
{
IAP_data_buffer[i] = *(volatile uint32_t *)(destAdrss + i * 4); //IAP_data_buffer
}
}
 
0 Kudos
Reply
6 Replies

2,175 Views
Dhaya
Contributor III

We use Keil IDE which having the following configuration of RAM and ROM

0 Kudos
Reply

2,119 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Dhaya 

Is your board custom board or demo board?

Can you confirm whether it can debug simple hello world demo well?

There is no issue with this demo, I have tested on my demo board.

 

BR

Alice

0 Kudos
Reply

2,098 Views
Dhaya
Contributor III
We using our custom board.
0 Kudos
Reply

2,057 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Dhaya 

Can you confirm whether it can debug simple hello world demo well?

BR

Alice

 

0 Kudos
Reply

2,231 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Dhaya 

How about first use SDK demo "flashiap1" to test ?

 

BR

Alice

0 Kudos
Reply

2,201 Views
Dhaya
Contributor III

Hi @Alice_Yang ,

    No its not working fine. It shows the following error while debug SDK example project without edit.

IAP_flashiap1 LinkServer Debug [C/C++ (NXP Semiconductors) MCU Application]
IAP_flashiap1.axf [LPC55S16 (cortex-m33)]
Thread #1 1 (Suspended : Signal : SIGSTOP:Stopped (signal))
HardFault_Handler() at semihost_hardfault.c:53 0x2618
<signal handler called>() at 0xfffffff9
_printf() at 0x21a0
main() at iap_flash.c:58 0x2ce
arm-none-eabi-gdb (12.1.90.20221210)

 

0 Kudos
Reply