This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC1788 - Flash Signature Generation

Hello,

I'm having trouble with the "Flash signature generation" on the LPC1788.

First off the LPC178x_7x.h header file does not have the Flash signature generation structure or define macro.

I added the following to my code:

/*------------- Flash Signature Generation ----------------------*/
typedef struct
{
       uint32_t RESERVED1[8];
  __IO uint32_t FMSSTART;
  __IO uint32_t FMSSTOP;
       uint32_t RESERVED2;
  __IO uint32_t FMSW0;
  __IO uint32_t FMSW1;
  __IO uint32_t FMSW2;
  __IO uint32_t FMSW3;
       uint32_t RESERVED3[1001];
  __IO uint32_t FMSTAT;
  __IO uint32_t FMSTATCLR;
} FLASHSIG_TypeDef;

//#define LPC_FLASHSIG_BASE     (LPC_APB1_BASE + 0x04000)

#define LPC_FMC          ((FLASHSIG_TypeDef  *) 0x00200000 )

The problem I have is I get a hardfault when I access the FMSSTOP register.

Basically this is my code:

void CalcSignature()
{
    /* align flash address to refer the flash word in the array */
    uint32_t startAddr =    0x40000;
    uint32_t length =       0x3FFFF;

    startAddr = (startAddr >> 4) & 0x0001ffff;
    length = ((startAddr + length) >> 4) & 0x0001ffff;
    /* write start address of the flash contents to the register*/
    LPC_FMC->FMSSTART = startAddr;

    LPC_FMC->FMSTATCLR |= (1 << 2); // clear the SIG done

    /* write stop address of the flash contents to the register, start generating
    the signature*/
    length |= ( 1 << 17);
    LPC_FMC->FMSSTOP = length;   //HARD FAULT HERE!!!!!!!!!!!!!!!!!


    while((LPC_FMC->FMSTAT & (1 << 2)) == 0);
}

Anybody have any ideas or see what I'm doing wrong?

Thanks.

Marc

0