LPC5411x Flash Signature Generator

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

LPC5411x Flash Signature Generator

Jump to solution
1,637 Views
chrispflieger
Contributor IV

Has anyone used this hardware peripheral?

Is there any device driver code for it?

Will support be added to the CMSIS drivers?

Labels (2)
1 Solution
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
Thanks for your reply.
I've ported the fmc_5411x.c and fmc_5411.h in the perph_flashiap demo in the LPCOpen library, and run this demo on the LPCXpresso54114 board, it works well.
I've attached the demo, please give a try.

pastedImage_1.png

Fig 1


Have a great day,
TIC

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

View solution in original post

0 Kudos
17 Replies
1,132 Views
chrispflieger
Contributor IV

As my deadline approaches, I think I will have to abandon the FMC and just use a CRC32.

0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Javier Vallori,
You can use the software way to generate the flash signature instead of this hardware way and please learn the more information via the below link.
https://os.mbed.com/forum/mbed/topic/4557/
Have a great day,
TIC

 

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

1,132 Views
chrispflieger
Contributor IV

Here's a demo - it calls the flash signature generator several times - clearing out the variable each time to prove it's generating a value. As you can see from running it, it seems to fail mid way through.

0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
After reviewing the code, in the flash_write() function, I find that you forget to call the Prepare Sector(s) for Write Operation prior to calling Copy RAM to flash command, otherwise, MCU will fail to execute the Copy RAM to flash command.
I think it's the root cause.
Have a great day,
TIC

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

0 Kudos
1,132 Views
chrispflieger
Contributor IV

Not sure I follow, the Prepare Sector is immediately preceding:

Line 31: retval |= Chip_IAP_PreSectorForReadWrite(sector, sector);

Line 32: retval |= Chip_IAP_CopyRamToFlash(address, data, 1024);

If you run this example, you'll clearly see the correct values have been written to 0x10000. I.e. it does work.

And immediately following the erase, and before the write operations, that odd 0x020015 pattern shows up.

0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
I've replicated the phenomenon, and after digging much deeper, I find that the FMC registers always remain at the same value, so I think it's the root cause of this issue.

I will do more testing later.

pastedImage_1.jpg


Have a great day,
TIC

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

0 Kudos
1,132 Views
chrispflieger
Contributor IV

I'm having a problem with this...

First time I execute this routine I get seemly random data (same data every time) (that's good). Later in the same program, I get a repeating sequence of 0x15000200.

Any thoughts about this?

1. I run the generator, get 0x251519501E148C58.....

2. Erase some sectors, write some sectors (write back the same data every time)

3. I run the generator, get 0x15000200150002001500020015000200

reset, repeat at one.

I did some more testing. After erasing and writing I get 0x15000200150002001500020015000200 no matter how or when, but after reset I get the "correct" value, repeatedly, UNTIL I erase and rewrite. Note that the contents of flash are always the same.

If I run a signature post-erase, pre-write, I get a different and seemly correct value.

AND... if I change the range of signature, I still get 0x15000200150002001500020015000200.

0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
Thanks for your reply.
I was wondering if you can share a compile-able demo which can replicate the phenomenon, as I'd like to dig much deeper.
Looking forward to your reply.
Have a great day,
TIC

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

0 Kudos
1,132 Views
chrispflieger
Contributor IV

OK, now I'm confused - I sent a module with an FMC driver I wrote, and it looks like you tested some other driver, because those functions don't match what I have. Can you post those?

0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
As I said, I use the fmc_5411x.c and fmc_5411.h you shared with, not use other driver files, then add these files in the LPCOpen library for testing.
Have a great day,
TIC

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

0 Kudos
1,132 Views
chrispflieger
Contributor IV

This was why I was confused: I wrote Chip_FMC_Generate_Signature() your code calls Chip_FMC_IsSignatureBusy() and Chip_FMC_GetSignature().

Also, I thought I found an error, turns out I read the wrong data sheet.(I edited this message to remove that).

I actually got some good values, so I'm going to mark this as "answered".

0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.
There is no demo to illustrate how to generate a flash signature, whether you encounter some problems when using the Flash Signature Generator.
Have a great day,
TIC

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

0 Kudos
1,132 Views
chrispflieger
Contributor IV

I see there's code for the 15xx and 11Uxx series - I'll port that over.

Do I need to disable interrupts when running this?

0 Kudos
1,132 Views
chrispflieger
Contributor IV

It seems to get stuck waiting on the status. The output registers are all zero.

/**
 * @brief Signature register block structure
 */
typedef struct {                    /*!< Signature Structure */
    __IO uint32_t FCTR;             /*!< Offset: 0x000 Control register */
    __I  uint32_t RESERVED0[3];
    __IO uint32_t FBWST;            /*!< Offset: 0x010 Wait state register */
    __I  uint32_t RESERVED1[3];
    __IO uint32_t FMSTART;          /*!< Offset: 0x020 Signature start address register */
    __IO uint32_t FMSTOP;           /*!< Offset: 0x024 Signature stop address registers */
    __I  uint32_t RESERVED2;
    __I  uint32_t FMSW0;            /*!< Offset: 0x02C Word 0 of 128-bit signature word */
    __I  uint32_t FMSW1;            /*!< Offset: 0x030 Word 1 of 128-bit signature word */
    __I  uint32_t FMSW2;            /*!< Offset: 0x034 Word 2 of 128-bit signature word */
    __I  uint32_t FMSW3;            /*!< Offset: 0x038 Word 3 of 128-bit signature word */
    __I  uint32_t RESERVED3[1001];
    __O  uint32_t FMSTAT;           /*!< Offset: 0xFE0 FIFO Status register */
    __I  uint32_t RESERVED4;
    __O  uint32_t FMSTATCLR;        /*!< Offset: 0xFE8 FIFO Trigger level register @cond */
} LPC_FMC_T;

/**
 * @brief FMC control register bits
 */
#define FMC_FCTR_FS_RD0             (0x01 << 3)
#define FMC_FCTR_FS_RD1             (0x01 << 4)

/**
 * @brief FMC status register bits
 */
#define FMC_FMSTAT_SIG_DONE         (0x01 << 2)
void Chip_FMC_Generate_Signature(LPC_FMC_T *pFMC, uint32_t signature[4], uint32_t start_address, uint32_t stop_address)
{
    pFMC->FMSTART = (start_address / 16) & 0xFFFF;
    pFMC->FMSTOP = (stop_address / 16) & 0xFFFF;
    pFMC->FMSTATCLR = FMC_FMSTAT_SIG_DONE;




    pFMC->FCTR &= ~FMC_FCTR_FS_RD0;
    pFMC->FCTR |= FMC_FCTR_FS_RD1;
    pFMC->FMSTOP |= 0x00010000;
    pFMC->FBWST = 5;        // Good for 100 MHz

    while (0 == (pFMC->FMSTAT & FMC_FMSTAT_SIG_DONE));
    pFMC->FMSTATCLR = FMC_FMSTAT_SIG_DONE;

    signature[0] = pFMC->FMSW0;
    signature[1] = pFMC->FMSW1;
    signature[2] = pFMC->FMSW2;
    signature[3] = pFMC->FMSW3;
}
0 Kudos
1,132 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
Thanks for your reply.
I was wondering if you can share a compile-able demo, then I can replicate the phenomenon and it can help me to figure it out.
I'm looking forward to your reply.
Have a great day,
TIC

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

0 Kudos
1,132 Views
chrispflieger
Contributor IV

I sent you the demo project via email.

I changed chip.h, and added fmc_5411x.h & fmc_5411x.c.

The demo just attempts to get a signature over the full range.

...and I just figured out how to attach it here, so it's the same as the emailed one.

0 Kudos
1,133 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,
Thanks for your reply.
I've ported the fmc_5411x.c and fmc_5411.h in the perph_flashiap demo in the LPCOpen library, and run this demo on the LPCXpresso54114 board, it works well.
I've attached the demo, please give a try.

pastedImage_1.png

Fig 1


Have a great day,
TIC

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

0 Kudos