<?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>LPC MicrocontrollersのトピックRe: Hello I am doing communication with MCP3202 with LPC1768 via SPI .....But I am unable to see my data in SPDR I only got 0X00FF</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hello-I-am-doing-communication-with-MCP3202-with-LPC1768-via-SPI/m-p/759756#M30638</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to isolate the issue (hardware or software) could you please test the LPCopen spi examples?&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX" title="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX"&gt;LPCOpen Software for LPC17XX|NXP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Have a great day,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Sol&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Jan 2018 23:05:00 GMT</pubDate>
    <dc:creator>soledad</dc:creator>
    <dc:date>2018-01-03T23:05:00Z</dc:date>
    <item>
      <title>Hello I am doing communication with MCP3202 with LPC1768 via SPI .....But I am unable to see my data in SPDR I only got 0X00FF</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hello-I-am-doing-communication-with-MCP3202-with-LPC1768-via-SPI/m-p/759755#M30637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is my interrupt based code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;lpc17xx.h&amp;gt;&lt;BR /&gt;#include "spi.h"&lt;BR /&gt;#include "lcd.h"&lt;/P&gt;&lt;P&gt;uint8_t dummy_u8=0,test=0;&lt;/P&gt;&lt;P&gt;void spi_init(void)&lt;BR /&gt;{&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; //clksetting for SPI &lt;BR /&gt; //pclk= cclk divide by 4 = 24Mhz...&lt;BR /&gt; LPC_SPI-&amp;gt;SPCCR = SPCCR_VAL ; //24// 24Mhz is now divided by 24=1Mhz final clk&lt;BR /&gt; &lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL0 |=(3U&amp;lt;&amp;lt;30); //SCK&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |=(3U&amp;lt;&amp;lt;0); //SSEL&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |= (3U&amp;lt;&amp;lt;2); //MISO&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL1 |= (3U&amp;lt;&amp;lt;4); //MOSI&lt;/P&gt;&lt;P&gt;//clk setting for SPI &lt;BR /&gt; LPC_SPI-&amp;gt;SPCCR = SPCCR_VAL ;&lt;BR /&gt; // SPI0_CLK=(SystemFrequency / 8 ) /(SPCCR_VAL) ; // ussed to check in watch at debug&lt;BR /&gt; //Config SPI = Master,8Bit,CPOL=0,CPHA=0&lt;BR /&gt; LPC_SPI-&amp;gt;SPCR &amp;amp;= ~(1&amp;lt;&amp;lt;3); // CPHA = 0 = Rising Clock Shift Data &lt;BR /&gt; LPC_SPI-&amp;gt;SPCR &amp;amp;= ~(1&amp;lt;&amp;lt;4); // CPOL = 0 = Normal Clock "0",Active = "1"&lt;BR /&gt; LPC_SPI-&amp;gt;SPCR |= (1&amp;lt;&amp;lt;5); // MSTR = 1 = Master SPI&lt;BR /&gt; LPC_SPI-&amp;gt;SPCR &amp;amp;= ~(1&amp;lt;&amp;lt;6); // LSBF = 0 = MSB First&lt;/P&gt;&lt;P&gt;LPC_SPI-&amp;gt;SPCR &amp;amp;= ~(15&amp;lt;&amp;lt;8); // BITS = 0000 (Reset Bits Format)&lt;BR /&gt; LPC_SPI-&amp;gt;SPCR |= (1&amp;lt;&amp;lt;11); // BITS = 1000 (8 Bit Data)&lt;BR /&gt; LPC_SPI-&amp;gt;SPCR |= (1&amp;lt;&amp;lt;2); // BitEnable = 1 = Enable SPI&lt;BR /&gt;}&lt;BR /&gt;void spi_dir(void)&lt;BR /&gt;{&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR |= SCK ; //output&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR |= SSEL ; //output&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR &amp;amp;= ~MISO; //input&lt;BR /&gt; LPC_GPIO0-&amp;gt;FIODIR |= MOSI; //output&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void SPI_Chsel(uint8_t spich_u8)&lt;BR /&gt;{&lt;BR /&gt; &lt;BR /&gt; if(spich_u8 == 0)&lt;BR /&gt; {&lt;BR /&gt; LPC_SPI-&amp;gt;SPDR = 0X01;//start bit&lt;BR /&gt; LPC_SPI-&amp;gt;SPDR = 0XA0;//for MCP ADC only....start,ch0,single ended mode,MSB first&lt;BR /&gt; }&lt;BR /&gt; else &lt;BR /&gt; {&lt;BR /&gt; LPC_SPI-&amp;gt;SPDR = 0X01;//start bit&lt;BR /&gt; LPC_SPI-&amp;gt;SPDR = 0XE0;//for MCP ADC only....start,ch1,single ended mode,MSB first&lt;BR /&gt; } &lt;BR /&gt; //return spich_u8;&lt;BR /&gt;}&lt;BR /&gt;uint8_t SPI_write(uint8_t spidata_u8)&lt;BR /&gt;{&lt;BR /&gt; LPC_SPI-&amp;gt;SPDR = spidata_u8; &lt;BR /&gt; // while(util_GetBitStatus(LPC_SPI-&amp;gt;SPSR,SBIT_SPIF) == 0); /* wait until data is sent */&lt;BR /&gt; test = Read_SPI_Status;&lt;BR /&gt; dummy_u8 = LPC_SPI-&amp;gt;SPDR;&lt;BR /&gt; return spidata_u8;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;uint32_t dummy;&lt;BR /&gt;uint8_t value_1=0,value_2=0,value_3=0;&lt;BR /&gt;uint16_t adc_count=0;&lt;BR /&gt;unsigned int i;&lt;/P&gt;&lt;P&gt;//uint8_t slave_data,dummy;&lt;BR /&gt;void SPI_IRQHandler(void) //interrupt handler for spi&lt;BR /&gt;{&lt;BR /&gt; //value |=((LPC_SPI-&amp;gt;SPDR) &amp;lt;&amp;lt; (16-(8*i)));//ADC is sending bit data but my spdr... &lt;BR /&gt; //..is 8 bit so by shifting data has been taken.. &lt;BR /&gt; //...on 3 times recieve interrupt&lt;BR /&gt; if(i==1)&lt;BR /&gt; {&lt;BR /&gt; value_1 = LPC_SPI-&amp;gt;SPDR &amp;amp; 0X00;&lt;BR /&gt; i++;&lt;BR /&gt; } &lt;BR /&gt; else if(i==2) &lt;BR /&gt; {&lt;BR /&gt; value_2 = LPC_SPI-&amp;gt;SPDR &amp;amp; 0X0F;&lt;BR /&gt; i++;&lt;BR /&gt; } &lt;BR /&gt; else if(i==3)&lt;BR /&gt; {&lt;BR /&gt; value_3 = LPC_SPI-&amp;gt;SPDR;&lt;BR /&gt; i++;&lt;BR /&gt; } &lt;BR /&gt; LPC_SPI-&amp;gt;SPINT |=(1&amp;lt;&amp;lt;0); //Clear SPI interrupt&lt;BR /&gt; &lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; &lt;BR /&gt; i=0;&lt;BR /&gt; SystemInit();&lt;BR /&gt; NVIC_DisableIRQ(SPI_IRQn); // disable interrupt first&lt;BR /&gt; spi_init();&lt;BR /&gt; spi_dir();&lt;BR /&gt; //LPC_SPI-&amp;gt;SPDR = 0x00; //clr garbage data&lt;BR /&gt; dummy=LPC_SPI-&amp;gt;SPDR; // read weather clr or not&lt;BR /&gt; Enable_SPI;&lt;BR /&gt; Enable_SPI_Interrupt ; &lt;BR /&gt; NVIC_EnableIRQ(SPI_IRQn);&lt;BR /&gt; &lt;BR /&gt; while(1)&lt;BR /&gt; {&lt;BR /&gt; &lt;BR /&gt; i=1;&lt;BR /&gt; clr_salve;&lt;BR /&gt; SPI_Chsel(0);//start and channel sel for MCPADC only&lt;BR /&gt; delayus(2000000);&lt;BR /&gt; dummy=SPI_write(0x00);//0 padding&lt;BR /&gt; adc_count= value_1 | value_2 | value_3 ;&lt;BR /&gt; set_salve;&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jan 2018 07:09:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Hello-I-am-doing-communication-with-MCP3202-with-LPC1768-via-SPI/m-p/759755#M30637</guid>
      <dc:creator>akshaybuchake</dc:creator>
      <dc:date>2018-01-03T07:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Hello I am doing communication with MCP3202 with LPC1768 via SPI .....But I am unable to see my data in SPDR I only got 0X00FF</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Hello-I-am-doing-communication-with-MCP3202-with-LPC1768-via-SPI/m-p/759756#M30638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to isolate the issue (hardware or software) could you please test the LPCopen spi examples?&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX" title="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX"&gt;LPCOpen Software for LPC17XX|NXP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Have a great day,&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Sol&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jan 2018 23:05:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Hello-I-am-doing-communication-with-MCP3202-with-LPC1768-via-SPI/m-p/759756#M30638</guid>
      <dc:creator>soledad</dc:creator>
      <dc:date>2018-01-03T23:05:00Z</dc:date>
    </item>
  </channel>
</rss>

