lpcware

SPI questions 1769

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by qwerty on Thu May 30 01:28:04 MST 2013
Hi, would like to ask about using SPI with the LCP1769. Right now I am trying to set it up, and using a scope I am only getting random signals from the SCLK. Hope I can get some advice here. My code:

#include <stdio.h>
#include "LPC17xx.h"
#include "lpc_types.h"
#include "lpc17xx_systick.h"
#include "lpc17xx_clkpwr.h"
#include "lpc17xx.h"
#include "lpc_types.h"
#include "semihosting.h"
#include "lpc17xx_pinsel.h"
#include "lpc17xx_timer.h"
#include "lpc17xx_spi.h"

static void init_spi(void)
{
    PINSEL_CFG_Type PinCfg;
    SPI_CFG_Type SPICfg;

    /* Initialize SPI1 pin connect */
    PinCfg.Funcnum = 2;
    PinCfg.Pinnum = 6;
    PinCfg.Portnum = 0;
    PINSEL_ConfigPin(&PinCfg);
    PinCfg.Pinnum = 7;
    PINSEL_ConfigPin(&PinCfg);
    PinCfg.Pinnum = 8;
    PINSEL_ConfigPin(&PinCfg);
    PinCfg.Pinnum = 9;
    PINSEL_ConfigPin(&PinCfg);

    SPI_Init(LPC_SPI, &SPICfg);
}

int main(void)
{

    init_spi();
   
    while(1)
    {
        SPI_ReceiveData(LPC_SPI);
    }
}

Outcomes