SPI questions 1769

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI questions 1769

396 Views
lpcware
NXP Employee
NXP Employee
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);
    }
}
0 Kudos
5 Replies

343 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu May 30 12:59:20 MST 2013

Quote: qwerty
Here's the zipped project, I am using CooCox IDE to develop it.



Sorry, can't read that. This is a LPCXpresso forum, perhaps it's useful to ask in a CooCox forum?

http://www.coocox.org/forum/index.php?language=en
0 Kudos

343 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by qwerty on Thu May 30 12:47:58 MST 2013
Here's the zipped project, I am using CooCox IDE to develop it. LPC1769 as master to MPU6000 slave.

Thanks for any advice...
0 Kudos

343 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu May 30 12:24:13 MST 2013
If you export and post your project, someone else can test it with all the included libraries. Otherwise it's a big guessing game which can take a long time :)
If you want to get fast help, it's useful to post a complete project and describe your hardware. I don't know which libraries you are using, which project settings are used and which hardware we are talking about...
0 Kudos

343 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by qwerty on Thu May 30 12:10:08 MST 2013
Hi,
Currently that's all there is to my code, trying to interface to SPI. But I am very new to the concept.

I want to use the accelerometer MPU6000 which can use either I2C or SPI.

Thank you.
0 Kudos

343 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu May 30 02:29:38 MST 2013

Quote: qwerty
Hope I can get some advice here...



... post the project and describe your hardware (LPCXpresso1769? connected to ?).

More information is useful :)
0 Kudos