<?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: LPC1768: The SSP/SPI bus is, sometimes, discarding the first byte written in DATA register in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-The-SSP-SPI-bus-is-sometimes-discarding-the-first-byte/m-p/1810456#M55446</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I see that you configure the SSP module of LPC1768 as slave mode, as you know that the SSP has 8 level FIFO for both transmitter and receiver, I suggest you fill the 8 level transmitter FIFO in advance before you enable the SSP.&lt;/P&gt;
&lt;P&gt;Pls have a try&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2024 02:10:56 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2024-02-19T02:10:56Z</dc:date>
    <item>
      <title>LPC1768: The SSP/SPI bus is, sometimes, discarding the first byte written in DATA register</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-The-SSP-SPI-bus-is-sometimes-discarding-the-first-byte/m-p/1802957#M55362</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I am observing inconsistent behavior on the SPI bus implemented in the SSP peripheral on LPC1768.&lt;/P&gt;&lt;P&gt;Is there a restriction on keeping the SSP TX FIFO empty while data is being received by the RX FIFO and then start to send?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Issue:&lt;UL&gt;&lt;LI&gt;Data written to the register is sporadically discarded/lost in SPI and not sent by LPC1768 (observed with a logic analyzer).&lt;/LI&gt;&lt;LI&gt;The problem occurs in 15% of cases.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Implementation Details:&lt;UL&gt;&lt;LI&gt;LPC1768 operating as SPI slave (SSP peripheral).&lt;/LI&gt;&lt;LI&gt;Peripheral clock: 100MHz.&lt;/LI&gt;&lt;LI&gt;Bus clock: 1500kHz (SSP0CPSR.CPSDVSR = 0x42, SSP0CR0.src=0x00).&lt;/LI&gt;&lt;LI&gt;Read and write via IRQ Handler.&lt;/LI&gt;&lt;LI&gt;Data is consumed using extremely stable circular buffer.&lt;/LI&gt;&lt;LI&gt;No RX overrun events observed.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Precondition:&lt;UL&gt;&lt;LI&gt;The master device is constantly sending data to the bus.&lt;/LI&gt;&lt;LI&gt;LPC1768 firmware does not write to the DATA register (SSP0DR) when there is no data to send.&lt;/LI&gt;&lt;LI&gt;Status register (SSP0SR) indicates "TX FIFO empty" (SSP0SR.TFE == 0x01).&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Scenario where the problem occurs:&lt;UL&gt;&lt;LI&gt;When there is data to be sent, the&amp;nbsp;SSP TX interrupt is enabled (SSP0IMSC.TXIM = 0x01) and the handler writes the data sequentially to SSP0DR while there is space in the TX FIFO (SSP0SR.TNF == 0x01).&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;How the problem manifests:&lt;UL&gt;&lt;LI&gt;Using a logic analyzer, it is observed that, in 15% of cases, the first byte is not sent by the bus to the master. It gets lost.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;When the problem occurs, these are the register values before and after writing the first byte to DATA:&lt;UL&gt;&lt;LI&gt;Before writing the first byte to SSP0DR:&lt;UL&gt;&lt;LI&gt;a) SSP0MIS: 0x00000008 or 0x0000000C&lt;/LI&gt;&lt;LI&gt;b) SSP0SR: 0x00000003 or 0x00000013 or 0x00000017&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;After writing the first byte to SSP0DR:&lt;UL&gt;&lt;LI&gt;a) SSP0SR: 0x00000016 or 0x00000017&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="wpopov_0-1707253407518.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/262220i3233159DE1DA371C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="wpopov_0-1707253407518.png" alt="wpopov_0-1707253407518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards, Wagner Popov&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Feb 2024 21:05:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-The-SSP-SPI-bus-is-sometimes-discarding-the-first-byte/m-p/1802957#M55362</guid>
      <dc:creator>wpopov</dc:creator>
      <dc:date>2024-02-06T21:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768: The SSP/SPI bus is, sometimes, discarding the first byte written in DATA register</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-The-SSP-SPI-bus-is-sometimes-discarding-the-first-byte/m-p/1810456#M55446</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I see that you configure the SSP module of LPC1768 as slave mode, as you know that the SSP has 8 level FIFO for both transmitter and receiver, I suggest you fill the 8 level transmitter FIFO in advance before you enable the SSP.&lt;/P&gt;
&lt;P&gt;Pls have a try&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 02:10:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-The-SSP-SPI-bus-is-sometimes-discarding-the-first-byte/m-p/1810456#M55446</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2024-02-19T02:10:56Z</dc:date>
    </item>
  </channel>
</rss>

