<?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: SSP slave RNE bit isn't set but an overrun is received</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529258#M9783</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by purplexed on Wed Nov 25 01:08:46 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi nhidle,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unfortunately I haven't got a solution: at the time of my post we were evalutating a possible communication bus between two microcontrollers, harware had the possibility to choose between ssp and i2c on LPC1114.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After having spent a lot of time (too much) trying to solve this issue, we chose the i2c for this microcontroller.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Trying to give you an additional element to help you to examine your situation, I remember that bus rate didn't influence on our problem: it was verified at any speed for transmission whose packets were over 8 bytes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, I can't post any solution&amp;nbsp; :( &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope to read someone else experience, even if we have already bypassed this issues on this microcontroller&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:28:02 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:28:02Z</dc:date>
    <item>
      <title>SSP slave RNE bit isn't set but an overrun is received</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529256#M9781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by purplexed on Tue Jul 29 04:54:17 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi everybody.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm experiencing a problem with the ssp peripheral in lpc1114 33 pins.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using IAR ssp slave code example listed below (it's extracted the code referring to port 0, the only one involved). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my application the slave device attemps to receive an expected number of bytes with SSP_Receive() function listed below, but, if data received is over 8 bytes (...same as the ssp fifo buffer...mmmm...), the 9th one doesn't set RNE bit so that the ssp buffer isn't read and the remaining data trigger the overrun interrupt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Master device transmits at 1,25 MHz and the pheripheral clock is 48 MHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't understand what's happening. Someone has an idea?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Init function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
#define SSP_SLAVE 1
#define USE_CS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
#define LOOPBACK_MODE 0

void SSP_IOConfig( uint8_t portNum )
{
&amp;nbsp; 
LPC_SYSCON-&amp;gt;PRESETCTRL |= (0x1&amp;lt;&amp;lt;0);
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (0x1&amp;lt;&amp;lt;11);
LPC_SYSCON-&amp;gt;SSP0CLKDIV = 0x2;/* Divided by 2 */
LPC_IOCON-&amp;gt;PIO0_8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;= ~0x07;/*&amp;nbsp; SSP I/O config */
LPC_IOCON-&amp;gt;PIO0_8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |= 0x01;/* SSP MISO */
LPC_IOCON-&amp;gt;PIO0_9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;= ~0x07;
LPC_IOCON-&amp;gt;PIO0_9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |= 0x01;/* SSP MOSI */
#ifdef __JTAG_DISABLED
LPC_IOCON-&amp;gt;SCK_LOC = 0x00;
LPC_IOCON-&amp;gt;SWCLK_PIO0_10 &amp;amp;= ~0x07;
LPC_IOCON-&amp;gt;SWCLK_PIO0_10 |= 0x02;/* SSP CLK */
#else
#if 0
/* On HummingBird/Candiru 1(HB1/CD1), SSP CLK can be routed to different 
pins, other than JTAG TCK, it's either P2.11 func. 1 or P0.6 func. 2. */
LPC_IOCON-&amp;gt;SCK_LOC = 0x01;
LPC_IOCON-&amp;gt;PIO2_11 = 0x01;/* P2.11 function 1 is SSP clock, need to 
combined with IOCONSCKLOC register setting */
#else
LPC_IOCON-&amp;gt;SCK_LOC = 0x02;
LPC_IOCON-&amp;gt;PIO0_6 = 0x02;/* P0.6 function 2 is SSP clock, need to 
combined with IOCONSCKLOC register setting */
#endif
#endif/* endif __JTAG_DISABLED */&amp;nbsp; 

#if USE_CS
LPC_IOCON-&amp;gt;PIO0_2 &amp;amp;= ~0x07;
LPC_IOCON-&amp;gt;PIO0_2 |= 0x01;/* SSP SSEL */
#else
/* Enable AHB clock to the GPIO domain. */
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1&amp;lt;&amp;lt;6);

LPC_IOCON-&amp;gt;PIO0_2 &amp;amp;= ~0x07;/* SSP SSEL is a GPIO pin */
/* port0, bit 2 is set to GPIO output and high */
GPIOSetDir( PORT0, 2, 1 );
GPIOSetValue( PORT0, 2, 1 );
#endif
 
&amp;nbsp; return;
}

void SSP_Init( uint8_t portNum )
{
&amp;nbsp; int ii; 
&amp;nbsp; volatile uint8_t Dummy;

/* Set DSS data to 8-bit, Frame format SPI, CPOL = 0, CPHA = 0, and SCR is 15 */
LPC_SSP0-&amp;gt;CR0 = 0x0707;

/* SSPCPSR clock prescale register, master mode, minimum divisor is 0x02 */
LPC_SSP0-&amp;gt;CPSR = 0x2;

for ( ii = 0; ii &amp;lt; FIFOSIZE; ii++ )
{
&amp;nbsp; Dummy = LPC_SSP0-&amp;gt;DR;/* clear the RxFIFO */
}
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
/* Enable the SSP Interrupt */
NVIC_EnableIRQ(SSP0_IRQn);

/* Device select as master, SSP Enabled */
#if LOOPBACK_MODE
LPC_SSP0-&amp;gt;CR1 = SSPCR1_LBM | SSPCR1_SSE;
#else
#if SSP_SLAVE
/* Slave mode */
if ( LPC_SSP0-&amp;gt;CR1 &amp;amp; SSPCR1_SSE )
{
&amp;nbsp; /* The slave bit can't be set until SSE bit is zero. */
&amp;nbsp; LPC_SSP0-&amp;gt;CR1 &amp;amp;= ~SSPCR1_SSE;
}
LPC_SSP0-&amp;gt;CR1 = SSPCR1_MS;/* Enable slave bit first */
LPC_SSP0-&amp;gt;CR1 |= SSPCR1_SSE;/* Enable SSP */
#else
/* Master mode */
LPC_SSP0-&amp;gt;CR1 = SSPCR1_SSE;
#endif
#endif
/* Set SSPINMS registers to enable interrupts */
/* enable all error related interrupts */
LPC_SSP0-&amp;gt;IMSC = SSPIMSC_RORIM | SSPIMSC_RTIM;
 
&amp;nbsp; return;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interrupt handler:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void SSP0_IRQHandler(void) 
{
&amp;nbsp; volatile uint32_t regValue;

&amp;nbsp; regValue = LPC_SSP0-&amp;gt;MIS;
&amp;nbsp; if ( regValue &amp;amp; SSPMIS_RORMIS )/* Receive overrun interrupt */
&amp;nbsp; {
interruptOverRunStat0++;
LPC_SSP0-&amp;gt;ICR = SSPICR_RORIC;/* clear interrupt */
&amp;nbsp; }
&amp;nbsp; if ( regValue &amp;amp; SSPMIS_RTMIS )/* Receive timeout interrupt */
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
interruptRxTimeoutStat0++;
LPC_SSP0-&amp;gt;ICR = SSPICR_RTIC;/* clear interrupt */
&amp;nbsp; }

&amp;nbsp; /* please be aware that, in main and ISR, CurrentRxIndex and CurrentTxIndex
&amp;nbsp; are shared as global variables. It may create some race condition that main
&amp;nbsp; and ISR manipulate these variables at the same time. SSPSR_BSY checking (polling)
&amp;nbsp; in both main and ISR could prevent this kind of race condition */
&amp;nbsp; if ( regValue &amp;amp; SSPMIS_RXMIS )/* Rx at least half full */
&amp;nbsp; {
interruptRxStat0++;/* receive until it's empty */
&amp;nbsp; }
&amp;nbsp; return;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Receive function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void SSP_Receive( uint8_t portNum, uint8_t *buf, uint32_t Length )
{
&amp;nbsp; uint32_t i;
&amp;nbsp; 
&amp;nbsp; for ( i = 0; i &amp;lt; Length; i++ )
&amp;nbsp; {
/* As long as Receive FIFO is not empty, I can always receive. */
/* If it's a loopback test, clock is shared for both TX and RX,
no need to write dummy byte to get clock to get the data */
/* if it's a peer-to-peer communication, SSPDR needs to be written
before a read can take place. */

#if !LOOPBACK_MODE
#if SSP_SLAVE
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ( !(LPC_SSP0-&amp;gt;SR &amp;amp; SSPSR_RNE) );
#else
&amp;nbsp; LPC_SSP0-&amp;gt;DR = 0xFF;
&amp;nbsp; /* Wait until the Busy bit is cleared */
&amp;nbsp; while ( (LPC_SSP0-&amp;gt;SR &amp;amp; (SSPSR_BSY|SSPSR_RNE)) != SSPSR_RNE );
#endif
#else
&amp;nbsp; while ( !(LPC_SSP0-&amp;gt;SR &amp;amp; SSPSR_RNE) );
#endif
&amp;nbsp; *buf = LPC_SSP0-&amp;gt;DR;
&amp;nbsp; buf++;

&amp;nbsp; }
&amp;nbsp; return; 
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529256#M9781</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: SSP slave RNE bit isn't set but an overrun is received</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529257#M9782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nhindle on Tue Nov 24 11:52:58 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This post seems to be dead but I was curious if you found a solution?&amp;nbsp; Currently I am experiencing a similar issue.&amp;nbsp; With LPC1114/303 MCU SPI interface running at 3MHz writing multiple 256B pages to flash is triggering RORRIS, Receive Overrun Raw Interrupt.&amp;nbsp; Funny thing is when transmitting at other rates &amp;lt; or &amp;gt; this can be resolved, and if 256B pages are sent with greater delay between this also does not occur.&amp;nbsp; If you can recall I would appreciate your solution. Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529257#M9782</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: SSP slave RNE bit isn't set but an overrun is received</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529258#M9783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by purplexed on Wed Nov 25 01:08:46 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi nhidle,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unfortunately I haven't got a solution: at the time of my post we were evalutating a possible communication bus between two microcontrollers, harware had the possibility to choose between ssp and i2c on LPC1114.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After having spent a lot of time (too much) trying to solve this issue, we chose the i2c for this microcontroller.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Trying to give you an additional element to help you to examine your situation, I remember that bus rate didn't influence on our problem: it was verified at any speed for transmission whose packets were over 8 bytes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, I can't post any solution&amp;nbsp; :( &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope to read someone else experience, even if we have already bypassed this issues on this microcontroller&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529258#M9783</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: SSP slave RNE bit isn't set but an overrun is received</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529259#M9784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nhindle on Wed Nov 25 16:57:40 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I found a resolution for my issue, not sure if it would have helped in your scenario.&amp;nbsp; The issue was during the SSP SPI read/write call occasionally an interrupt would trigger and be handled but while resuming the SPI R/W it would fail as the Receive Overrun Raw Interrupt (RORRIS) would be triggered.&amp;nbsp; It does not matter if the Overrun interrupt is enabled/disabled&amp;nbsp; as the SSP library calls return error for read/write when the Raw interrupt is present (cannot be disabled). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The data rate dependence was more of a coincidence; the interrupt was from the UART interface operating at ~2.8kHz and errors were more present at 3MHz than any other data rate.&amp;nbsp; By enabling/disabling interrupts during sensitive read/write calls I was able to resolve this.&amp;nbsp; &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:28:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SSP-slave-RNE-bit-isn-t-set-but-an-overrun-is-received/m-p/529259#M9784</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:28:02Z</dc:date>
    </item>
  </channel>
</rss>

