AnsweredAssumed Answered

Use ADXL345 and KL25Z

Question asked by Michel Meunier on Dec 19, 2015
Latest reply on Dec 25, 2015 by Alice_Yang

Hello,

I try to make a connection between ADXL345 accelerometer and KL25Z via SPI.

I have connected the ADXL345 like that:

PTD0 SPI0_PCS0 to CS

PTD2 SPI0_MOSI to SDA

PTD3 SPI0_MISO to SDO

PTD1 SPI0_SCK  to SCL

Next I have used the SPIMaster_LDD component

1.jpg

2.jpg

3.jpg

LDD_TDeviceData *masterDevData;
uint8_t Adresse,Value,Error;

  PE_low_level_init();

  masterDevData=SM1_Init(NULL);

  Adresse=0x00+0x80;

  Error=SM1_SendBlock(masterDevData,&Adresse,1);  //to get value at adress 0x00

  Error=SM1_ReceiveBlock(masterDevData,&Value,1); //I should received 0x5A but I received 0x00

 

Any idea?

Thanks

Outcomes