lpcware

SPI Clock not coming on P0.15 port Pin

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by gitanjali on Fri Jun 12 22:16:45 MST 2015
Hi,

i made one code for SPI interface(Not using SSP) in master mode .Following is the code used.But when i check the SPI SCK on oscilloscope, it does not give any output.


#ifdef __USE_CMSIS
#include "LPC17xx.h"
#include "uart.h"
#endif

#include <cr_section_macros.h>
#include <NXP/crp.h>

__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;


int main(){

LPC_SC->PCONP |= (1<<8); //Power SPI peripheral

LPC_SC->PCLKSEL0 |= (1<<16); //PCLK for SPI0 = CCLK

LPC_PINCON->PINSEL0=(3<<30);
LPC_PINCON->PINSEL1=(3<<0)|(3<<2)|(3<<4);
LPC_PINCON->PINMODE0 = (3<<30);
LPC_PINCON->PINMODE3 = (3<<0)|(3<<2)|(3<<4);

LPC_SPI->SPCCR= 4;               //SCK= PCLK/4
LPC_SPI->SPCR |= 0x38;         //master mode


int data_in = 0;

    while(1){

        LPC_SPI->SPDR = 0xAAAA;
        while ( (LPC_SPI->SPIF & 0x0080)!=0x0080 );
        data_in = LPC_SPI0->S0SPDR;

    }

}


Please Can any one help?

Thanks a lot.

Gitanjali

Outcomes