LPC2129 SPI communication problem

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ravi7saini on Fri Jan 29 00:33:37 MST 2016
Hi all,


I have designed a board using LPC2129 micro controller and Analog devices ADIS160006 accelerometer. I am trying to establish SPI communication using LPC2129 but somehow the SPI communication is not workinhg. I have tested the SCK pin with oscilloscope but there is no activity. LPC2129 is used as a master and ADIS16006 is used as a Slave. I am using Port 0.7 as GPIO for CS. There is activity on the chip select pin when monitored with the help of oscilloscope but not on other pins. Below is my code for establishing Communication. Please suggest some solution for the same.

#include "lpc21xx.h"
int main(void)
int temp= 0;
IODIR0 |= 0x00000080; // P0.7 defined as SS_ADIS16006
IOSET0 = 0x00000080; // SS_ADIS16006 = 1
PINSEL0 |= 0x00001500; // configure SPI0 pins (except SSEL0)
S0SPCCR = 12; // SCK = 1 MHz, counter > 8 and even
S0SPCR = 0xC8; // CPHA=1, CPOL=1, master mode, MSB first, interrupt disabled
IOCLR0 = 0x00000080; // SS_ADIS16006 = 0
S0SPDR =0xaa;
     while(!(S0SPSR $ 0x80));
temp = S0SPDR;
IOSET0 = 0x00000080; // SS_ADIS16006 = 1


In addition to the above problem my LPC2129 is not going in User flash mode (MEMMAP = 0x01) during power up. It stays in the bootloader mode (MEMMAP = 0x00).

If I power up the board after flashing the code nothing appears on the output. So I use ULINK-ME debugger and while debugging I have to manually change the memory mapping control setting and select the User flash mode. My question is after burning the code in the internal Flash memory and  why it is  not executing the code from the flash memory.