<?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: LPC1788 - SPI performs unexpectedly in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516201#M1545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TKoe on Thu Nov 22 04:28:17 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I must admit, I am not sure how to do this. Also this is the first time I'm using a SPI on an ARM processor. The user manual states that SSEL is an output pin when in master mode, furthermore it is automatically configured through pinsel, yet I am supposed to pulse that high?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:26:22 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:26:22Z</dc:date>
    <item>
      <title>LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516199#M1543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TKoe on Thu Nov 22 03:32:28 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have configured an LPC1788 as SPI master on SSP0 (CPOL = 1; CPHA = 0) to communicate with a DAC chip at 30 MHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This chip needs the chip select pulled down (I do that with a GPIO), then three bytes of command data need to be transmitted and then the chip select needs to be pulled up again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to send any data I use the SSP_ReadWrite function and the data does get transmitted and the DAC updates its outputs accordingly. So everything's fine... except for one thing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The three bytes that I transmit with this function aren't sent directly after another (as I would have expected) but between each byte there's a pause of about one or two microseconds. Below is the code that will transmit one of those three-byte-packages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also between two packages there's a pause of over TEN microseconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is: Why are there so long pauses and how would I go to reduce/remove them? Any hints are greatly appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;void setdac(t_dac_channel ch, uint16_t value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint8_t tx_data[3] = {0,0,0};&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint8_t rx_data[6];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tx_data[0] =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(0 &amp;lt;&amp;lt; 7) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(0 &amp;lt;&amp;lt; 6) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(0 &amp;lt;&amp;lt; 5) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(1 &amp;lt;&amp;lt; 4) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(0 &amp;lt;&amp;lt; 3) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;((ch &amp;gt;&amp;gt; 2) &amp;amp; 1) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;((ch &amp;gt;&amp;gt; 1) &amp;amp; 1) |&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;((ch &amp;gt;&amp;gt; 0) &amp;amp; 1) ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tx_data[1] = (value &amp;gt;&amp;gt; 8) &amp;amp; 0xFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tx_data[2] = (value &amp;gt;&amp;gt; 0) &amp;amp; 0xFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SSP_DATA_SETUP_Type ssp_data =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.tx_data = tx_data,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.tx_cnt = 3,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.rx_data = rx_data,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.rx_cnt = 3,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.length = 3,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.status = 0,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SPI_GPIO_PORT-&amp;gt;MASK = ~(1 &amp;lt;&amp;lt; SPI_SSEL_PIN);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GPIO_ClearValue(SPI_PORT, 1 &amp;lt;&amp;lt; SPI_SSEL_PIN);&amp;nbsp; // pull down&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SSP_ReadWrite(SPI_CH, &amp;amp;ssp_data, SSP_TRANSFER_POLLING);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while (!(SPI_CH-&amp;gt;SR &amp;amp; 0x01)); // 0x01 == TFE (Transmit FIFO Empty)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GPIO_SetValue(SPI_PORT, 1 &amp;lt;&amp;lt; SPI_SSEL_PIN);&amp;nbsp; // pull up&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516199#M1543</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516200#M1544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Lien.Nguyen on Thu Nov 22 04:01:19 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;As I know, if CPHA=0, you must pull SSEL between each data word transfer. This is said in User manual (section 21.5.2.4 SPI format with CPOL = 1,CPHA = 0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lien&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516200#M1544</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516201#M1545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TKoe on Thu Nov 22 04:28:17 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I must admit, I am not sure how to do this. Also this is the first time I'm using a SPI on an ARM processor. The user manual states that SSEL is an output pin when in master mode, furthermore it is automatically configured through pinsel, yet I am supposed to pulse that high?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516201#M1545</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516202#M1546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Lien.Nguyen on Thu Nov 22 20:38:13 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you try setting CPOL=0,CPHA=1?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516202#M1546</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516203#M1547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TKoe on Fri Nov 23 01:32:23 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That has exactly the same behaviour.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wanted to make another shot from the scope, but found it to be pretty useless as the signals look the same, except that the SCK's idle state is LOW.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516203#M1547</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516204#M1548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TKoe on Mon Nov 26 01:06:50 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Well here's a shot from my scope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Channel 1 is the DAC's output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Channel 3 is a signal that's used for synchronization of the DAC's output. Must be pulled high while transmitting new values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Channel 2 is the SPI's &amp;lt;del&amp;gt;MOSI&amp;lt;/del&amp;gt; SCK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can see me sending the values to the DAC. The three bytes are quite far apart from each other.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Fixed one of the signals, oops!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516204#M1548</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516205#M1549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Lien.Nguyen on Mon Nov 26 21:21:54 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry about misleading you. I checked and thought that the SPI bit clock is the problem. If you would like to set it as 30Mhz, you must optimize the code of sending &amp;amp; receiving as fast as possible (the system clock is just 120Mhz). You have fixed the data wordwidth and the number of byte sent, so I think you should write hard code to send three bytes one after one. Don't use SSP_ReadWrite function in this case. :).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lien&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516205#M1549</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1788 - SPI performs unexpectedly</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516206#M1550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TKoe on Thu Nov 29 01:44:07 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, that really helped. Now the time between two bytes is about 250 ns.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I replaced the library call with three lines actual code - didn't actually expect it to slim down that much for my application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;void setdac(t_dac_channel ch, uint16_t value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO0-&amp;gt;MASK = ~(1 &amp;lt;&amp;lt; SPI_SSEL_PIN);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_ClearValue(SPI_PORT, 1 &amp;lt;&amp;lt; SPI_SSEL_PIN);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (cnt &amp;lt; 3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (SPI_CH-&amp;gt;SR &amp;amp; SSP_SR_TNF) // (Transmitter Not Full)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI_CH-&amp;gt;DR = tx_data[cnt++] &amp;amp; 0xFFFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!(SPI_CH-&amp;gt;SR &amp;amp; 0x01)); // 0x01 == TFE (Transmit FIFO Empty)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_SetValue(SPI_PORT, 1 &amp;lt;&amp;lt; SPI_SSEL_PIN);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:26:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1788-SPI-performs-unexpectedly/m-p/516206#M1550</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:26:25Z</dc:date>
    </item>
  </channel>
</rss>

