<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Use ADXL345 and KL25Z in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497534#M30985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I try to make a connection between ADXL345 accelerometer and KL25Z via SPI.&lt;/P&gt;&lt;P&gt;I have connected the ADXL345 like that:&lt;/P&gt;&lt;P&gt;PTD0 SPI0_PCS0 to CS&lt;/P&gt;&lt;P&gt;PTD2 SPI0_MOSI to SDA&lt;/P&gt;&lt;P&gt;PTD3 SPI0_MISO to SDO&lt;/P&gt;&lt;P&gt;PTD1 SPI0_SCK&amp;nbsp; to SCL&lt;/P&gt;&lt;P&gt;Next I have used the SPIMaster_LDD component&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34918i979E1DDC2D26C9BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/35006i5E316DB15E0BA9BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.jpg" alt="2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="3.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/35079i3B1B39F75323B129/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.jpg" alt="3.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;LDD_TDeviceData *masterDevData;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;uint8_t Adresse,Value,Error;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; PE_low_level_init();&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp; masterDevData=SM1_Init(NULL);&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; Adresse=0x00+0x80;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Error=SM1_SendBlock(masterDevData,&amp;amp;Adresse,1);&amp;nbsp; //to get value at adress 0x00 &lt;/P&gt;&lt;P&gt;&amp;nbsp; Error=SM1_ReceiveBlock(masterDevData,&amp;amp;Value,1); //I should received 0x5A but I received 0x00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 19 Dec 2015 13:14:15 GMT</pubDate>
    <dc:creator>michelmeunier</dc:creator>
    <dc:date>2015-12-19T13:14:15Z</dc:date>
    <item>
      <title>Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497534#M30985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I try to make a connection between ADXL345 accelerometer and KL25Z via SPI.&lt;/P&gt;&lt;P&gt;I have connected the ADXL345 like that:&lt;/P&gt;&lt;P&gt;PTD0 SPI0_PCS0 to CS&lt;/P&gt;&lt;P&gt;PTD2 SPI0_MOSI to SDA&lt;/P&gt;&lt;P&gt;PTD3 SPI0_MISO to SDO&lt;/P&gt;&lt;P&gt;PTD1 SPI0_SCK&amp;nbsp; to SCL&lt;/P&gt;&lt;P&gt;Next I have used the SPIMaster_LDD component&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34918i979E1DDC2D26C9BD/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/35006i5E316DB15E0BA9BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.jpg" alt="2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="3.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/35079i3B1B39F75323B129/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.jpg" alt="3.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;LDD_TDeviceData *masterDevData;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;uint8_t Adresse,Value,Error;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; PE_low_level_init();&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp; masterDevData=SM1_Init(NULL);&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; Adresse=0x00+0x80;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Error=SM1_SendBlock(masterDevData,&amp;amp;Adresse,1);&amp;nbsp; //to get value at adress 0x00 &lt;/P&gt;&lt;P&gt;&amp;nbsp; Error=SM1_ReceiveBlock(masterDevData,&amp;amp;Value,1); //I should received 0x5A but I received 0x00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Dec 2015 13:14:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497534#M30985</guid>
      <dc:creator>michelmeunier</dc:creator>
      <dc:date>2015-12-19T13:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497535#M30986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Michel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What function do you want to realize about this :&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14507651653208423 jive_text_macro" data-renderedposition="71_8_1003_32" jivemacro_uid="_14507651653208423" modifiedtitle="true"&gt;&lt;P&gt;Adresse=0x00+0x80;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Error=SM1_SendBlock(masterDevData,&lt;EM style="text-decoration: underline;"&gt;&amp;amp;Adresse&lt;/EM&gt;,1);&amp;nbsp; //to get value at adress 0x00&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Do you want to read the DEVID ?&amp;nbsp; While the DEVID value is 0xE5 , so could you please tell me what do you want&lt;/P&gt;&lt;P&gt;to do , thank !&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;IMG alt="pastedImage_10.png" src="https://community.nxp.com/t5/image/serverpage/image-id/35656iFED5ECD50646ADEA/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_10.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:27:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497535#M30986</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2020-11-02T13:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497536#M30987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Of course my final goal is to read DEVID of the ADXL345, but to read the coordinate of 1g vector.&lt;/P&gt;&lt;P&gt;But before to write the full code, I try to make a test by reading the DEVID. For the value of DEVID, you are right, it was a mistake from me, it's 0xE5 the good value. So, if the test program is ok, I will write all the program.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 10:09:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497536#M30987</guid>
      <dc:creator>michelmeunier</dc:creator>
      <dc:date>2015-12-22T10:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497537#M30988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes , first check whether can read the DEVID data correctly .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day !&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 10:34:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497537#M30988</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-12-22T10:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497538#M30989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;After a lot of failure, I have decided to write my own SPI-read function.&lt;/P&gt;&lt;P&gt;The source is quite simple and it works!! but only one time :-( I think there is a problem with SPMF but I don't understand very well in the documentation:&lt;/P&gt;&lt;P&gt;------------------&lt;/P&gt;&lt;P&gt;SPMF is set after SPRF is 1 when the value in the receive data buffer matches the value in the M register.&lt;/P&gt;&lt;P&gt;To clear the flag, read SPMF when it is set and then write a 1 to it.&lt;/P&gt;&lt;P&gt;0 Value in the receive data buffer does not match the value in the M register&lt;/P&gt;&lt;P&gt;1 Value in the receive data buffer matches the value in the M register&lt;/P&gt;&lt;P&gt;--------------------&lt;/P&gt;&lt;P&gt;In fact the first time I read the adress 0x00 of the ADXL345, I get 0xe5 wich is ok, but after if I try to read an other adresses, I allways get 0xe5!!In fact it's impossible to write a new value in SPI0_D.&lt;/P&gt;&lt;P&gt;my code is:&lt;/P&gt;&lt;P&gt;------------------------------&lt;/P&gt;&lt;P&gt;uint8_t spi_read(uint8_t adresse)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t retour=0,dummy;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(!(SPI_S_SPTEF_MASK &amp;amp; SPI0_S))&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; //While buffer is not empty do nothing &lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI0_D =adresse+0x80;&amp;nbsp;&amp;nbsp;&amp;nbsp; //write adress+0x80 (read mode)&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(!(SPI_S_SPRF_MASK &amp;amp; SPI0_S))&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp; } //While received buffer is not full do nothing&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; retour=SPI0_D;&amp;nbsp;&amp;nbsp; //read the received value&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;dummy=(SPI_S_SPMF_MASK &amp;amp; SPI0_S);&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp; SPI0_S |= SPI_S_SPMF_MASK;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; return retour;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;---------------------------------------------&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Michel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Dec 2015 15:14:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497538#M30989</guid>
      <dc:creator>michelmeunier</dc:creator>
      <dc:date>2015-12-23T15:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497539#M30990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Michel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The S register must be read when SPTEF is set before writing to the SPI data register; otherwise, the&lt;/P&gt;&lt;P&gt;write is ignored.&lt;/P&gt;&lt;P&gt;- About the SPMF register , i think it is have no link with your problem .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Alice Yang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2015 06:29:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497539#M30990</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-12-24T06:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497540#M30991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The S register must be read when SPTEF is set before writing to the SPI data register; otherwise, the&lt;/P&gt;&lt;P&gt;write is ignored.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hello Alice,&lt;/P&gt;&lt;P&gt;I don't see what you mean, because when I do:&lt;/P&gt;&lt;P&gt;while(!(SPI_S_SPTEF_MASK &amp;amp; SPI0_S))&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; //While buffer is not empty do nothing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read S register, no?&lt;/P&gt;&lt;P&gt;for&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;- About the SPMF register , i think it is have no link with your problem .&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;you are right, it's about the compare register, and have nothing to do with my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2015 17:07:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497540#M30991</guid>
      <dc:creator>michelmeunier</dc:creator>
      <dc:date>2015-12-24T17:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Use ADXL345 and KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497541#M30992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Michel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you read the 0X00&amp;nbsp; address of ADXL345 , then&amp;nbsp; initialize the ADXL345 ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;especially configure the POWER_CTL(0x2D) register the D3 bit to Measure(1) mode ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&amp;nbsp; read the other register .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Dec 2015 08:45:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Use-ADXL345-and-KL25Z/m-p/497541#M30992</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-12-25T08:45:50Z</dc:date>
    </item>
  </channel>
</rss>

