LPC845M301JBD48 Problem writing flash after using IAP FAIM Read

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC845M301JBD48 Problem writing flash after using IAP FAIM Read

1,212 Views
PhilG
Contributor I

Hello,

I am currently writing firmware for the LPC845 48 pin part. I have used other LPC824 device in developing products before.

I have implemented a read/write function for accessing the FAIM section. I am only writing once to the FAIM but confirm my pins have been setup corrently by reading FAIM in my initialisation code.

This is working fine. However I have just implemented a flash write function, either sector or page commands. These work fine. However on this processor part I am finding that if I perform a FAIM read, then try and write to flash, the writing is spurious and incorrect even though the returned code indicates succesful.

If however I perofrm a flash write before I check the FAIM, this write is succesful and contents are correct but a subsequent flash write after performing the FAIM read is in error again.

For the time being I have disbaled the FAIM reading and my code runs sucessfully.

Note that I have tried my code on a LPCXpresso MAX for LPC845 this uses the 64 pin variant, and my code runs fine with the FAIM reading and flash writing in any combination. (Using my code and same linker file).

I have checked my hardware implementation for the LPC845 48 pin and power connections are stable and correct.

I am using the internal 12MHz clock for both boards.

So in summary my code runs fine on the LPC845 64 pin, but not on the 48 pin variant.

I look forward getting any replies with any suggestions as to a possible solution.

Regards

Phil Green.

C-Tec

UK

Labels (1)
Tags (2)
0 Kudos
15 Replies

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip Green,

Could you please show a simple project that I can reproduce your question?

I will check it on my side.

BR

Alice

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip Green ,

Please refer to the steps below attach your project and file, thanks.

BR

Alice

0 Kudos

869 Views
PhilG
Contributor I

Hello Alice,

Please find attached my example project.

So my comments on my example code are:-

void Initialise(void)

{

SystemCoreClockUpdate();

NumberFAIMWrites = UpdateFAIM((uint32_t *) &my_faim_write_data[0]); //Update FAIM should only do this once

MyAddress = Flash_Quantec_Address_Area_Data.QuantecAddress;

MyArea = Flash_Quantec_Address_Area_Data.QuantecArea;

MyAddress = 20;

MyArea = 5;

WriteAddressAreaInfo();

MyAddress = Flash_Quantec_Address_Area_Data.QuantecAddress;

MyArea = Flash_Quantec_Address_Area_Data.QuantecArea;

}

If I run this code on my board which uses the LPC845 48 pin part then the writes to the flash memory do not work properly. My FAIM function call is only reading the FAIM.

If I comment out the call to my function to check the FAIM then the flash writes work ok.

If I alter my code and put a flash write before the call to check FAIM, then that works but writes to flash after checking FAIM do not work.

I have also checked this code on the LPC845 64 pin in a LPCXpresso MAX for LPC845 board and that works in all cases! So it looks like an issue with the 48 pin part or my hardware implementation. As I said originally that I have powered my pcb locally at 3.3v so not a power issue on my board. My board uses the internal 12MHz clock.

Please advise.

Regards

Phil Green BSc(Hons)

Senior Development Engineer

Computionics Ltd (C-Tec)

C-TEC, Research & Development Centre

C-TEC, Factory MAP<https://www.c-tec.com/info/contact-us.html>

Dark Lane, Mawdesley, Lancashire,

L40 2QU

General: +44 (0)1704 822974

Challenge Way, Martland Park, Wigan, WN5 0LD

General: +44 (0)1942 322744

Fax: +44 (0)1942 829867

Web: www.c-tec.co.uk<http://www.c-tec.co.uk/>;

Privileged and confidential information and/or copyright material may be contained in or attached to this e-mail. This information and material is intended for the use for the intended addressee(s) only. If you are not an intended addressee you may not copy or deliver it to anyone else or use it in any unauthorised manner. To do so is prohibited and may be unlawful. If you receive this e-mail by mistake, please advise the sender immediately by return e-mail and destroy all copies. If any attachment has been sent with this e-mail, please be advised to virus check the content prior to opening the attachment, as Computionics Ltd does not accept liability for any damage caused by viruses which may be contained within any attachments.

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip,

I haven't find your configure the FAIM on your project,  also the project can't debug well on my side.

and I strongly recommend you use the FAIM demo:

https://www.nxp.com/webapp/Download?colCode=LPC845-EX-CODE-IAR 

This demo can works well on my side, your project can't debug on my side.

0 Kudos

869 Views
PhilG
Contributor I

Hello Alice_Yang

I have created a faim.c & faim.h file in the folder where the other NXP Library files are as there wasn't one for the FAIM control in the original library for the LPC845.

The path to it in the example I sent is:-

C:\ARM Test\NXP_LPC845_Lib\faim.c

The C file contents are, not I copied the NXP supplied iap.c hence the header contents referencing NXP:-

/*
 * @brief Common FAIM support functions
 *
 * @note
 * Copyright(C) NXP Semiconductors, 2013
 * All rights reserved.
 *
 * @par
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * LPC products.  This software is supplied "AS IS" without any warranties of
 * any kind, and NXP Semiconductors and its licensor disclaim any and
 * all warranties, express or implied, including all implied warranties of
 * merchantability, fitness for a particular purpose and non-infringement of
 * intellectual property rights.  NXP Semiconductors assumes no responsibility
 * or liability for the use of the software, conveys no license or rights under any
 * patent, copyright, mask work right, or any other intellectual property rights in
 * or to any products. NXP Semiconductors reserves the right to make changes
 * in the software without notification. NXP Semiconductors also makes no
 * representation or warranty that such application will be suitable for the
 * specified use without further testing or modification.
 *
 * @par
 * Permission to use, copy, modify, and distribute this software and its
 * documentation is hereby granted, under NXP Semiconductors' and its
 * licensor's relevant copyrights in the software, without fee, provided that it
 * is used in conjunction with NXP Semiconductors microcontrollers.  This
 * copyright, permission, and disclaimer notice must appear in all copies of
 * this code.
 */
//23/04/20 PRG Added FAIM Functions
#include "chip.h"
#include "iap.h"
#include "faim.h"
/*****************************************************************************
 * Private types/enumerations/variables
 ****************************************************************************/

/*****************************************************************************
 * Public types/enumerations/variables
 ****************************************************************************/

/*****************************************************************************
 * Private functions
 ****************************************************************************/

/*****************************************************************************
 * Public functions
 ****************************************************************************/

/*
 *  Read FAIM Memory
 */

uint8_t FAIMRead (uint32_t FAIM_Page, uint32_t * RAM_Address)
{
  uint32_t command[5], result[5];
 
  command[0] = IAP_FAIM_READ;                  // READ FAIM PAGE
  command[1] = FAIM_Page;                      // FAIM page number
  command[2] = (uint32_t) RAM_Address;                    // Destination RAM address to store the read value
  iap_entry(command, result);                  // Call the function
  return result[0];
}

/*
 *  Write FAIM Memory
 */

uint8_t FAIMWrite (uint32_t FAIM_Page, uint32_t * RAM_Address)
{
  uint32_t command[5], result[5];
 
  command[0] = IAP_FAIM_WRITE;            // WRITE FAIM PAGE
  command[1] = FAIM_Page;                      // FAIM page number
  command[2] = (uint32_t) RAM_Address;                    // Source RAM address to store the write value
  iap_entry(command, result);                  // Call the function
  return result[0];                                // Finished without Errors
}

/*------------------------------------------------------------------------------------
Function Name   : UpdateFAIM

Description     : Updates FAIM configuration

Input args      : Pointer to 8 words of FAIM data to compare/write
Return args     : Number of page writes, should be zero if no updates

Special Notes   :

--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------*/
/*
Default data as used in manufactured device
const uint32_t my_faim_write_data[8] =
{
  0x28000000,   Word 0 Bit[1]: '0' = normal start, '1' = LP start
  0x00001918,   Word 1
  0x00000000,   Word 2
  0x00000000,   Word 3
  0xAAA00000,   Word 4
  0x555AAAAA,   Word 5
  0xAAAAAAAA,   Word 6
  0xAAAAAAAA    Word 7
};
*/
uint8_t UpdateFAIM(uint32_t * faim_write_data)
{
  uint8_t FAIM_Page;
  uint32_t FAIM_MemoryRead; //Used to read the FAIM Page
  uint8_t  FAIM_Status;   //FAIM function return status
  uint8_t  Num_Writes;
 
  Num_Writes = 0;
  FAIM_Page = 0;
  while(FAIM_Page < NUM_FAIM_WORDS)
  {
    FAIM_Status = FAIMRead (FAIM_Page, &FAIM_MemoryRead);
    if(FAIM_MemoryRead != faim_write_data[FAIM_Page])
    {
      FAIM_Status = FAIMWrite (FAIM_Page, (uint32_t *) &faim_write_data[FAIM_Page]);
      FAIM_Status = FAIMRead (FAIM_Page, &FAIM_MemoryRead); //Read to update live otherwise reset necessary
      Num_Writes++;
    }
    FAIM_Page++;
  }
  return Num_Writes;
}

I have looked at your examples and they work, but my problem is not that I can read/write FAIM or Flash in separate test programs, it is the act of writing to flash having checked, only read in my case, the FAIM contents does not function correctly and the flash writes are in error!

Please advise.

Many thanks

Phil Green

C-Tec.

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip,

Refer to your requirement, I do a test based on NXP lib for lpc845 CodeBundle ,

Read FAIM->Erase and program FLASH->Read FAIM, I just add some code in FAIM demo.

I use LPC845-BRK board:

LPC845 Breakout Board for LPC84x family MCUs | NXP 

// Read FAIM
    while (3) {
      temp = GetConsoleCharacter((const char *)&promptstring_faimr);
      // Accept '0' - '7' only
      if (temp < 0x30 || temp > 0x37) {
        printf("\n\n\r");
        break;
      }
      n = temp - 0x30;                             // n = the FAIM word number 
      FAIMRead(n, (uint32_t)&read_data);           // Call the read API to make the current data visible, and load it into read_data
      printf("The content of FAIM word %d is 0x%x\n\n\r", n, read_data);
    } // end of while 3


//Erase and write flash
    if ((ret_code = ErasePage(ADDR))) {
      printf ("ErasePage failed. Return code was 0x%X\n\r", ret_code);
      while(1);
    }

    // IAP Copy RAM to Flash command
    if ((ret_code = Program(ADDR, NUM_BYTES, (uint8_t *)the_data))) {
      printf ("Copy RAM to Flash failed. Return code was 0x%X\n\r", ret_code);
      while(1);
    }

// read FAIM again
    FAIMRead(2, (uint32_t)&read_data);           // Call the read API to make the current data visible, and load it into read_data
         printf("The content of FAIM word %d is 0x%x\n\n\r", 2, read_data);

Again, recommend you first use this demo on your board.

Attached the project, use UART0 PIN0_24/PIN0_25.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

869 Views
PhilG
Contributor I

Hello Alice_Yang

I have bought a LPC845-BRK which uses the LPC845 48pin part, the same as my application.

I have tried your code and slightly modified it to give debugging output. Here it is:-

//--------------------
// FAIM_and_Clocks.c
//--------------------

#include <stdio.h>
#include "LPC8xx.h"
#include "syscon.h"
#include "swm.h"
#include "faim.h"
#include "utilities.h"
#include "iap.h"
#include "FlashFaimPrg.h"

void setup_debug_uart(void);

#define CLKOUT_DIVIDE 10
#define CLKOUT_PIN P0_16

const char promptstring_clock[] = "Choose a clock to display, or 's' to skip:\n\r0 for fro_clk\n\r1 for main_clk\n\r2 for sys_pll0_clk\n\r3 for external_clk\n\r4 for wdt_osc_clk\n\r5 for system_ahb_clk\n\r6 for fro_div_clk\n\r";
const char promptstring_faimw[] = "Enter a FAIM word to program ('0' - '7'), or 's' to skip\n\r";
const char promptstring_faimr[] = "Enter a FAIM word to read ('0' - '7'), or 's' to skip\n\r";
const char promptstring_lpstrt[]= "Set the low-power start bit? Type 'y' to set, 'n' to clear. Reset the board to make a new value take effect\n\r";
const char promptstring_flashprog[] = "Programming Flash Test Press any key, or 's' to skip\n\r";
uint32_t faim_write_data[NUM_FAIM_WORDS] =
{
  0x28000000,  // Word 0 Bit[1]: '0' = normal start, '1' = LP start
  0x00001918,  // Word 1
  0x00000000,  // Word 2
  0x00000000,  // Word 3
  0xAAA00000,  // Word 4
  0xAAAAAAAA,  // Word 5
  0xAAAAAAAA,  // Word 6
  0xAAAAAAAA   // Word 7
};

#define myADDR 0x00007C00
#define myNUM_BYTES 64

const uint8_t myflashdata[64] @0x00007C00 ={50,5,0,0};
uint8_t mydata[64];

int main(void) {

  unsigned char temp;
  uint32_t read_data, n;

  uint8_t ret_code;
  uint8_t Count;
 
 
  // Configure the debug uart (see Serial.c)
  setup_debug_uart();
    
  // Enable clocks to relevant peripherals
  LPC_SYSCON->SYSAHBCLKCTRL[0] |= (SWM);

  // Enable the clkout clock divider, divide by the previously defined value
  LPC_SYSCON->CLKOUTDIV = CLKOUT_DIVIDE;

  // Configure the SWM for clock out
  ConfigSWM(CLKOUT, CLKOUT_PIN);
 
  // Configure either SYSOSC or CLK_IN as source for external_clk
 
  // Update the global clock variables (this has already been called by setup_debug_uart)
  SystemCoreClockUpdate();
 
 

  while(1) {
    
    // Display internal clock frequencies and connect them to clkout clock divider
    while (2) {
      temp = GetConsoleCharacter((const char *)&promptstring_clock);
      // Accept '0' '1' '2' '3', '4', or '5' only
      if (temp < 0x30 || temp > 0x36) {
        printf("\n\n\r");
        break;
      }
      switch (temp) {
        case '0': printf("fro_clk freq. = %d Hz.\n\n\r", fro_clk);
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_FRO_CLK;
                  break;
        case '1': printf("main_clk freq. = %d Hz.\n\n\r", main_clk);
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_MAIN_CLK;
                  break;
        case '2': printf("sys_pll0_clk freq. = %d Hz.\n\n\r", sys_pll0_clk);
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_SYSPLL0_CLK;
                  break;
        case '3': printf("external_clk freq. is a mystery. See clock out pin.\n\n\r");
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_EXTERNAL_CLK;
                  break;
        case '4': printf("wdt_osc_clk freq. = %d Hz.\n\n\r", wdt_osc_clk);
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_WDT_OSC_CLK;
                  break;
        case '5': printf("system_ahb_clk freq. = %d Hz. Not available on clock out pin.\n\n\r", system_ahb_clk);
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_OFF;
                  break;
        case '6': printf("fro_div_clk freq. = %d Hz. Not available on clock out pin.\n\n\r", fro_div_clk);
                  LPC_SYSCON->CLKOUTSEL = CLKOUTSEL_OFF;
                  break;
      } // end of switch
    } // end of while 2
   
    // Read FAIM
    while (3) {
      temp = GetConsoleCharacter((const char *)&promptstring_faimr);
      // Accept '0' - '7' only
      if (temp < 0x30 || temp > 0x37) {
        printf("\n\n\r");
        break;
      }
      n = temp - 0x30;                             // n = the FAIM word number
      FAIMRead(n, (uint32_t)&read_data);           // Call the read API to make the current data visible, and load it into read_data
      printf("The content of FAIM word %d is 0x%x\n\n\r", n, read_data);
    } // end of while 3

//////////////////////////////////////////////////////////////////////////
//Flash Programming Test
    while (5) {
      temp = GetConsoleCharacter((const char *)&promptstring_flashprog);
      // Accept '0' - '7' only
      if (temp =='s') {
        printf("\n\n\r");
        break;
      }
      printf("myflashdata[0],[1] %02X %02X\n\n\r", myflashdata[0], myflashdata[1]);
      //Erase and write flash
      if ((ret_code = ErasePage(myADDR))) {
      printf ("ErasePage failed. Return code was 0x%X\n\r", ret_code);
      while(1);
      }

      printf("Page Erased \n\rmyflashdata[0],[1] %02X %02X\n\n\r", myflashdata[0], myflashdata[1]);
      for(Count=0;Count<64;Count++)
      {
        mydata[Count]=Count;
      }
      // IAP Copy RAM to Flash command
      if ((ret_code = Program(myADDR, myNUM_BYTES, (uint8_t *)mydata))) {
      printf ("Copy RAM to Flash failed. Return code was 0x%X\n\r", ret_code);
      while(1);
      }

      printf("Page Programmed \n\rmyflashdata[0],[1] %02X %02X\n\n\r", myflashdata[0], myflashdata[1]);
      if((myflashdata[0] != 0) || (myflashdata[1] != 1))
      {
        printf("Flash Data Programmed Wrongly!\n\n\r");
      }
    }
    
// read FAIM again
FAIMRead(2, (uint32_t)&read_data); // Call the read API to make the current data visible, and load it into read_data
printf("The content of FAIM word %d is 0x%x\n\n\r", 2, read_data);  
    
    
    
    
    
    
///////////////////////////////////////////////////////////////////////////////    
    // Write FAIM (Use with great caution! Know the repercussions before proceeding!)
    while (4) {
      temp = GetConsoleCharacter((const char *)&promptstring_faimw);
      // Accept '0' - '7' only
      if (temp < 0x30 || temp > 0x37) {
        printf("\n\n\r");
        break;
      }
      n = temp - 0x30;                             // n = the FAIM word number
      if (n == 0) {                                // If programming FAIM word 0
        temp = GetConsoleCharacter((const char *)&promptstring_lpstrt);
        if (temp == 'y') {
          faim_write_data[0] |= FAIM_LP_BOOT;   // Set the LP start bit
        }
        else {
          faim_write_data[0] &= ~(FAIM_LP_BOOT);// Clear the LP start bit
        }
      }
      FAIMWrite(n, (uint32_t)&faim_write_data[n]); // Call the write API to program the new data word from the faim_write_data array
      FAIMRead(n, (uint32_t)&read_data);           // Call the read API to make the new data visible, and load it into read_data variable
      printf("The new value of FAIM word %d is 0x%x\n\n\r", n, read_data);
    } // end of while 4

  } // end of while(1)

}  // end of main

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

The code runs fine, however I have discovered the problem of programming the flash after reading the FAIM.

If I read FAIM pages 0 to 4 the flash programming works, however if I read page 5 or 6 or 7 the flash contents written are wrong, even though the return code is 0 from the programming function!

If I read FAIM page 5 then 2 then perform a flash write the write contents are ok.

An example of the serial output is below, not I have serial local echo on to show which key I pressed.

=============================================================

Choose a clock to display, or 's' to skip:
0 for fro_clk
1 for main_clk
2 for sys_pll0_clk
3 for external_clk
4 for wdt_osc_clk
5 for system_ahb_clk
6 for fro_div_clk
s

Enter a FAIM word to read ('0' - '7'), or 's' to skip
5The content of FAIM word 5 is 0xaaaaaaaa

Enter a FAIM word to read ('0' - '7'), or 's' to skip
s

Programming Flash Test Press any key, or 's' to skip
 myflashdata[0],[1] 00 01

Page Erased
myflashdata[0],[1] FF FF

Page Programmed
myflashdata[0],[1] 81 09

Flash Data Programmed Wrongly!

Programming Flash Test Press any key, or 's' to skip
 myflashdata[0],[1] 81 01

Page Erased
myflashdata[0],[1] FF FF

Page Programmed
myflashdata[0],[1] 81 09

Flash Data Programmed Wrongly!

Programming Flash Test Press any key, or 's' to skip
s

The content of FAIM word 2 is 0x0

Enter a FAIM word to program ('0' - '7'), or 's' to skip
s

Choose a clock to display, or 's' to skip:
0 for fro_clk
1 for main_clk
2 for sys_pll0_clk
3 for external_clk
4 for wdt_osc_clk
5 for system_ahb_clk
6 for fro_div_clk
s

Enter a FAIM word to read ('0' - '7'), or 's' to skip
1The content of FAIM word 1 is 0x1918

Enter a FAIM word to read ('0' - '7'), or 's' to skip
5The content of FAIM word 5 is 0xaaaaaaaa

Enter a FAIM word to read ('0' - '7'), or 's' to skip
2The content of FAIM word 2 is 0x0

Enter a FFAIM word to read ('0' - '7'), or 's' to skip
s

Programming Flash Test Press any key, or 's' to skip
 myflashdata[0],[1] 81 09

Page Erased
myflashdata[0],[1] FF FF

Page Programmed
myflashdata[0],[1] 00 01

Programming Flash Test Press any key, or 's' to skip
s

The content of FAIM word 2 is 0x0

Enter a FAIM word to program ('0' - '7'), or 's' to skip
s

Choose a clock to display, or 's' to skip:
0 for fro_clk
1 for main_clk
2 for sys_pll0_clk
3 for external_clk
4 for wdt_osc_clk
5 for system_ahb_clk
6 for fro_div_clk

============================================================================

So the problem looks like the ROM flash function is failing after a FAIM read on pages 5 upwards!

I have tested on the LPCXpresso MAX LPC845 board which uses the 64 pin part and do not get the error!

As a matter of interest for the LPC845-BRK board I have to alter chip_setup.h USE_VCOMPORT 0 to get the debug output from USB, whereas for the LPCXpresso MAX LPC845 board I set to 1, looks like the pcb functionality is inverted!:-

//
// The following parameters need to be defined for projects that use the debug UART (used in serial.c)
//
#define DBGUART 0                  // Choose the index for the debug UART (0 for UART0, 1 for UART1, etc.)
#define DBGBAUDRATE 9600           // Choose the baud rate for the debug UART
#define USE_VCOM_PORT 0            // '1' to use VCOM serial port, '0' to use user-defined port pins for debug UART

#if (USE_VCOM_PORT == 1)
  #define DBGTXPIN TARGET_TX       // For VCOM serial port (see board.h)
  #define DBGRXPIN TARGET_RX       // For VCOM serial port (see board.h)
#else
  #define DBGTXPIN P0_25           // Use with USB-to-RS232 break-out cable (choose your own favorite TxD pin)
  #define DBGRXPIN P0_24           // Use with USB-to-RS232 break-out cable (choose your own favorite RxD pin)
#endif

So in summary the problem looks related to only the 48 pin variant and only when reading from FAIM pages 5 upwards.

Please can you test on your board to confirm and advise if there is a work around as I want to alter/test FAIM page 5 in my application as well as flash writing?

Regards

Phil Green

Senior Design Engineer

C-Tec

UK

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello UK,

 Ok, could you please attach your whole project from "Action" as below:

pastedImage_1.png

pastedImage_2.png

0 Kudos

869 Views
PhilG
Contributor I

Hell Alice_Yang

My project a modified varsion of the LPC845-Example-Code-Bundle-IAR as supplied by NXP is attached.

I am using the LPC845-BRK board as you suggested.

I have modified the FAIM_and_Clocks example and added the Flash writing.

So that I can optionally read the FAIM first then write the flash, which causes flash corruption only after imediately reading FAIM block 5 and above.

If I read the FAIM block 5 then block 2 and then write the flash that is ok.

I look forward to your comments.

Regards

Phil Green

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip Green,

I have  reproduce your issue, and have escalated   this case.

After get reply, will reply you .ASAP.

Sorry for the inconvenient to you.

Regards,

Alice 

0 Kudos

869 Views
PhilG
Contributor I

Hello Alice_Yang,

I have a quick work-around to this issue, when checking/writing FAIM, I make sure that I check the FAIM pages, virtually immediately following reset in my running code, in reverse order 7-0, so that when I leave the function the last FAIM page I have used is 0 not 7. Subsequent writes to flash in my running code appear to work fine. 
Regards

Phil Green

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip,

Yes,  you can use the workaround you mentioned.

We also find when use SDK driver,  there is no problem. I attached the test file "iap_flash.c",

you can directly replace the iap_flash.c under  “\boards\lpcxpresso845max\driver_examples\iap\iap_flash\”.

Download sdk from:

https://mcuxpresso.nxp.com/en/select     

Regards,

Alice

0 Kudos

869 Views
PhilG
Contributor I

Hello Alice_Yang

Thank you for the file.

I presume the problem with the IAP function is internal to the chip ROM?

I am happy to continue my development using the workaround.

Regards

Phil Green

0 Kudos

869 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Philip Green,

Because I have escalate your case to SE team, they find when

#define FRO_DIRECT_VAL 1  

in CodeBundles demo "FAIM and Clocks"

then after read FAIM 5, write flash can work well.

And could you tell me your project name or the scenarios you using this chip,

the SE team need this information. If it is secretive, you can send me a private message, thanks!

Regards,

Alice

 

0 Kudos

869 Views
PhilG
Contributor I

Hello Alice_Yang

Only just read your message.

We use this LPC845 part in many of our products so have many products.

Our company designes and manufactures fire alarm products and call systems for use in nursing homes.

See:-

C-TEC | Fire Alarms | Call Systems | Induction Loop Systems 

Regarding your suggestion about using

#define FRO_DIRECT_VAL 1  

We use the IAR Toolchain for development so this may not work.

I will continue to use the workaround for our development.

Regards

Phil Green

0 Kudos