<?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 Re: LPC1227 SPI PROBLEM  in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1227-SPI-PROBLEM/m-p/752398#M30277</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike Jaber,&lt;BR /&gt;Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support I'd highly recommend you to refer to SSP demos in the LPC12xx CMSIS Driver Library.&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&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>Wed, 06 Jun 2018 07:29:30 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2018-06-06T07:29:30Z</dc:date>
    <item>
      <title>LPC1227 SPI PROBLEM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1227-SPI-PROBLEM/m-p/752397#M30276</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'm using the LPC1227 to read data from an accelerometer via SPI. I configured the SPI using some functions in the SPP library. The accelerometer sensor is the LSM6DS3. This sensor has an only read register&amp;nbsp; (who is called "WHO_I_AM") which its value is always 0x69. In order to test the spi communication I wanted to see if I can get this value in the SSP data register (DR). The problem is that I'm always getting a 0 in this data register. Could someone please check this code below and tell me if I did something wrong. I also attached the SPP library from where I used these functions. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_GPIO0-&amp;gt;DIR|=1&amp;lt;&amp;lt;1; //&amp;nbsp;MEMS CS&lt;BR /&gt; LPC_GPIO0-&amp;gt;DIR|=(1&amp;lt;&amp;lt;17); // MOSI&amp;nbsp;&lt;BR /&gt; LPC_GPIO0-&amp;gt;DIR&amp;amp;=~(1&amp;lt;&amp;lt;16); // MISO&amp;nbsp;&lt;BR /&gt; LPC_GPIO0-&amp;gt;DIR|=1&amp;lt;&amp;lt;14; // SCK&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// ****************&amp;nbsp;PIN CONFIGURATION **************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_IOCON-&amp;gt;PIO0_14&amp;amp;=~(0b111&amp;lt;&amp;lt;0); // Select SCK on PIO0_14&amp;nbsp;&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_14|=(1&amp;lt;&amp;lt;1);&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_1 &amp;amp;=~(0b111&amp;lt;&amp;lt;0); // Select&amp;nbsp;MEMS nCS&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_16&amp;amp;=~(0b111&amp;lt;&amp;lt;0); // Select MISO on PIO0_16&amp;nbsp;&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_16|=(1&amp;lt;&amp;lt;1);&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_17&amp;amp;=~(0b111&amp;lt;&amp;lt;0); // Select MOSI on PIO0_17&amp;nbsp;&lt;BR /&gt; LPC_IOCON-&amp;gt;PIO0_17 |=(1&amp;lt;&amp;lt;1);&lt;/P&gt;&lt;P&gt;LPC_GPIO0-&amp;gt;OUT&amp;amp;=~(1&amp;lt;&amp;lt;1); // nCS MEMS = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// ***********&amp;nbsp;MEMS SPI CONFIGURATION ************* //&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SSP_InitTypeDef param_MEMS;&lt;/P&gt;&lt;P&gt;(param_MEMS).CPHA=0;&lt;BR /&gt; (param_MEMS).CPOL=0;&lt;BR /&gt; (param_MEMS).Mode=0;&lt;BR /&gt; (param_MEMS).FrameFormat=0;&lt;BR /&gt; (param_MEMS).DataSize=0;&lt;/P&gt;&lt;P&gt;(param_MEMS).DataSize|=DATASIZE_8&amp;lt;&amp;lt;0; // transfert de 8 bits (attention Datasize est un uint16_t)&lt;BR /&gt; (param_MEMS).CPHA|=1&amp;lt;&amp;lt;7; // voir p 37 datasheet du MEMS&lt;BR /&gt; (param_MEMS).CPOL|=1&amp;lt;&amp;lt;6; // garde le sck à l'état haut entre deux transferts et MISO ET MOSI en high impedance&lt;BR /&gt; (param_MEMS).FrameFormat&amp;amp;=~(0b11&amp;lt;&amp;lt;4);&lt;BR /&gt; (param_MEMS).Mode&amp;amp;=~(1&amp;lt;&amp;lt;2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// **************** CONFIGURATION DU SPI ****************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SSP_DeInit(); // Deinitializes the SSP peripheral registers to their default reset values.&lt;BR /&gt; SSP_Init(&amp;amp;param_MEMS); // Initialization&lt;BR /&gt; SSP_SetClockRate(MEMS_SPI_CLK); // 10 MHz Max&lt;BR /&gt; SSP_Cmd(ENABLE); // Enable SPI&lt;BR /&gt; SSP_LoopbackCmd(DISABLE); // Normal mode operation&amp;nbsp;&lt;BR /&gt; SSP_SlaveOutputCmd(DISABLE); // Slave mode disabled&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// ****************&amp;nbsp;MEMS TEST ********************&lt;/P&gt;&lt;P&gt;int who_i_am=0;&lt;BR /&gt; SSP_Test_Send_Data(0x8F);&lt;BR /&gt; SSP_Test_Send_Data(0);&lt;BR /&gt; who_i_am =SSP_Test_Receive_Data();&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 08:40:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1227-SPI-PROBLEM/m-p/752397#M30276</guid>
      <dc:creator>mikejaber17</dc:creator>
      <dc:date>2018-06-05T08:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1227 SPI PROBLEM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1227-SPI-PROBLEM/m-p/752398#M30277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike Jaber,&lt;BR /&gt;Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support I'd highly recommend you to refer to SSP demos in the LPC12xx CMSIS Driver Library.&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&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>Wed, 06 Jun 2018 07:29:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1227-SPI-PROBLEM/m-p/752398#M30277</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2018-06-06T07:29:30Z</dc:date>
    </item>
  </channel>
</rss>

