lpcware

SPI Configuration Problem in LPC 1777

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by anandana on Thu Nov 28 00:13:23 MST 2013
Hi,

I am trying to configure SPI in LPC1777 as per chapter 17. But after configuring that I am getting Hard fault error. Here I have attached my pieace of code. Please suggest how i can proceed..

#define LPC_APB0_BASE         (0x40000000UL)
#define LPC_SPI_BASE(LPC_APB0_BASE+0x20000)
#define LPC_SPI((LPC_SPI_TypeDef*)LPC_SPI_BASE )

LPC_SC->PCONP=  0x0508939E; 8th bit high to enable SPI

LPC_IOCON->P0_15  |= 3;
LPC_IOCON->P0_18  |= 3;

typedef struct
{
  __IO uint32_t SPCR;
  __I  uint32_t SPSR;
  __IO uint32_t SPDR;
  __IO uint32_t SPCCR;
  __IO uint32_t SPTCR;
       uint32_t RESERVED0[2];
  __IO uint32_t SPINT;
} LPC_SPI_TypeDef;

LPC_SPI->SPCR = 0x00000820;             //1010  0100
LPC_SPI->SPCCR = 0x00000008; 

When it reaches the above instucion it goes to Hard fault error.

Please somebody help me if there is any error..






Outcomes