<?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: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313569#M13643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the initialisation of the SPI try adding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(volatile unsigned char)SPI0_S;&lt;/P&gt;&lt;P&gt;(volatile unsigned char)SPI0_D;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that the flag should behave as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jun 2014 14:56:13 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2014-06-03T14:56:13Z</dc:date>
    <item>
      <title>Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313568#M13642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having a problem getting SPI0, on PORTC, to work on a MKL25Z128VFT4 part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SPRF data ready flag is never getting set, causing my SPI read/write routine to lock up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm tiring to use the simplest code possible, no DMA, Interrupts or frameworks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that the SPRF data bit is never getting set in the status register.&lt;BR /&gt;This makes me fell I've missed something in clock initialization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no external crystals, I want to run on the internal clocks (cost issue).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried code produced by Code Warrior and also done no clock&lt;BR /&gt;initialization at all, just going with the defaults out of reset, and get&lt;BR /&gt;the same results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPI0 is clocked by the Bus Clock.&amp;nbsp; I do not see, or am constantly&lt;BR /&gt;overlooking, in the data sheet anything that indicates I need to&lt;BR /&gt;specifically enable the bus clock after a hardware reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no debugger running that would corrupt the status registers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code below, what am I missing?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void spi0_init( void );&lt;BR /&gt;static void spi0_init( void )&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Enable PORTC clock */&lt;BR /&gt;&amp;nbsp; SIM_SCGC4 |= SIM_SCGC4_SPI0_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Enable SPI0 clock&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if 0 /* Slave Select control is not shown in this posting */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTC_PCR4 = PORT_PCR_MUX( 2U );&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set PTC4 Pin Mux Control Alternative 2 [SPI0_PCS0] */&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTC_PCR5 = PORT_PCR_MUX( 2U );&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set PTC5 Pin Mux Control Alternative 2 [SPI0_SCK]&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTC_PCR6 = PORT_PCR_MUX( 2U );&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set PTC6 Pin Mux Control Alternative 2 [SPI0_MOSI] */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORTC_PCR7 = PORT_PCR_MUX( 2U );&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set PTC7 Pin Mux Control Alternative 2 [SPIO_MISO] */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* SPIE=0, SPE=0, SPTIE=0, MSTR=1, CPOL=0, CPHA=0, SSOE=0, LSBFE=0: */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI0_C1 = SPI_C1_MSTR_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set SPI0 to Master */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI0_BR = (SPI_BR_SPPR(0x07) | SPI_BR_SPR(0x08));&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set baud rate prescale divisor and baud rate divisor to the slowest frequency for testing */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* SPIE=0, SPE=1, SPTIE=0, MSTR=1, CPOL=0, CPHA=0, SSOE=0, LSBFE=0: */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI0_C1 |= SPI_C1_SPE_MASK;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Enable SPI0 */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static uint8_t spi0_tx_rx( uint8_t const spi_write_data_u8 );&lt;BR /&gt;static uint8_t spi0_tx_rx( uint8_t const spi_write_data_u8 )&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; while( 0U == (SPI0_S &amp;amp; SPI_S_SPTEF_MASK) )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait for SPI transmit empty flag to set */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOP();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI0_D = spi_write_data_u8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Write data to SPI */&lt;BR /&gt;&amp;nbsp; /* By toggling a pin it is known we *DO* get here */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while( 0U == (SPI0_S &amp;amp; SPI_S_SPRF_MASK) )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait for receive flag to set */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOP();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; /* By toggling a pin it is known we do *NOT* get here */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint8_t const spi_read_data_u8 = SPI0_D; /* Read the SPI data register, with SPRF set, above, this will clear SPRF */&lt;BR /&gt;&amp;nbsp; return( spi_read_data_u8 );&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 11:48:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313568#M13642</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-03T11:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313569#M13643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the initialisation of the SPI try adding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(volatile unsigned char)SPI0_S;&lt;/P&gt;&lt;P&gt;(volatile unsigned char)SPI0_D;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that the flag should behave as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 14:56:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313569#M13643</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-03T14:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313570#M13644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tired that, code locks up at the read of SPI0_D, ie. it never gets past that read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something else I've tried since posting is removing this line:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp; SIM_SCGC4 |= SIM_SCGC4_SPI0_MASK;&lt;/TD&gt;&lt;TD&gt;/* Enable SPI0 clock&amp;nbsp; */&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the clock removed the code never even reaches the read that you suggested to add.&lt;/P&gt;&lt;P&gt;With the clock off that is exactly what I would expect to happen.&lt;/P&gt;&lt;P&gt;To me that confirms that the SPI clock is indeed running.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 15:37:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313570#M13644</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-03T15:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313571#M13645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't notice anything else. Below is the complete initialisation of SPI1 that I have for the KL25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;POWER_UP(4, SIM_SCGC4_SPI1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_CONFIG_PERIPHERAL(D, 5, PD_5_SPI1_SCK); \&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_CONFIG_PERIPHERAL(D, 6, (PD_6_SPI1_MOSI | PORT_SRE_FAST | PORT_DSE_HIGH));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_CONFIG_PERIPHERAL(D, 7, (PD_7_SPI1_MISO | PORT_PS_UP_ENABLE));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_CONFIG_DRIVE_PORT_OUTPUT_VALUE(D, SPI_CS1_0, SPI_CS1_0, (PORT_SRE_FAST | PORT_DSE_HIGH));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SPI1_C1 = (SPI_C1_CPHA | SPI_C1_CPOL | SPI_C1_MSTR | SPI_C1_SPE);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SPI1_BR = (SPI_BR_SPPR_PRE_8 | SPI_BR_SPR_DIV_16);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(volatile unsigned char)SPI1_S;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(volatile unsigned char)SPI1_D;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After wriing a byte of data the end of reception is waited for using&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;while (!(SPI1_S &amp;amp; (SPI_S_SPRF))) {}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is known that the first read will hang if the SPIx_S, SPIx_D sequence is not performed, but afterwards there is no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is used to connect to SD cards in SPI mode (utFAT driver) as well as for SPI Flash devices (Atmel, ST and SST drivers) on all KL parts (including KL25) and essentially looks to be the same as your sequence. If you don't make progress you can download the uTasker project from &lt;A href="http://www.utasker.com/forum/index.php?topic=1721.0" title="http://www.utasker.com/forum/index.php?topic=1721.0"&gt;KINETIS Project Code&lt;/A&gt; and check for differences. It has configurations for the TWR_KL25Z48M and the FRDM-KL25Z boards and by replacing SPI1 defines for SPI0 you can also easily move the interface. It builds directly with GCC, CW, KDS, IAR, Keil, Rowley, Atollic or CooCox.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. The port clocking is automatically enabled in the _CONFIG_PERIPHERAL() macro (it is therefore not missing)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 21:30:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313571#M13645</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-03T21:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313572#M13646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;STRONG&gt;SPI1_C1 = (SPI_C1_CPHA | SPI_C1_CPOL | SPI_C1_MSTR | SPI_C1_SPE);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to see what would happen, I changed my code to use SPI1 and your initialization as well as trying PORTD in place of PORTC.&amp;nbsp; None of those changes made any difference&lt;STRONG&gt;.&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;gt; &lt;STRONG&gt;(volatile unsigned char)SPI1_D;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code still hangs at that line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;It is known that the first read will hang if the SPIx_S, SPIx_D sequence is not performed, but afterwards there is no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just looked at all the erratas I could find and do not find that documented in them???&amp;nbsp; The only mention of this I find is in your own messages, so I assume it is something you've run into personally?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;All this makes me feel the problem is upstream someplace in clock generation.&amp;nbsp; Where would there be a clock split between transmit and receive in SPI?&amp;nbsp; Being a synchronous protocol you would thing that could not happen?&amp;nbsp; Could you try your code without using an external crystal, just the internal sources?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll take a look at what uTasker is doing.&amp;nbsp; While it looks good, and your support to us all here has been better by far, than what has been forthcoming from Freescale, I can't use it in my project.&amp;nbsp;&amp;nbsp; My code needs to be MISRA compliant and amicable to Code Inspection Audits.&amp;nbsp; If I can't explain/document why something was done the way it was, I can't use it. :-(&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 17:48:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313572#M13646</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-04T17:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313573#M13647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This document may help you: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-100784"&gt;L-Series SPI GPIO CS/SS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martyn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 20:56:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313573#M13647</guid>
      <dc:creator>martynhunt</dc:creator>
      <dc:date>2014-06-04T20:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313574#M13648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sadly no, it was of no help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It only reinforces my frustration by saying:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"When the SPRF bit is set,"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No one is telling what causes it never be set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 12:28:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313574#M13648</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-05T12:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313575#M13649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;&amp;gt; (volatile unsigned char)SPI0_D;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I installed a Hard Fault routine and found that my lockup was actually jumping to the unrecoverable hard fault vector.&lt;/P&gt;&lt;P&gt;What is that telling me?&amp;nbsp; The address of SPI0_D is bad in the header file or I need to turn something on/off someplace?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see that Greme Bragg ran into this too, his thread "SPI0_D read causes heardfault".&lt;/P&gt;&lt;P&gt;He received no replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 15:03:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313575#M13649</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-05T15:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313576#M13650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would it be possible for you to share the code that is calling the SPI functions you shared in your original post?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which version of CW are you using? Also, what system &amp;amp; bus clock frequencies are you running at?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 16:20:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313576#M13650</guid>
      <dc:creator>martynhunt</dc:creator>
      <dc:date>2014-06-05T16:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313577#M13651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Would it be possible for you to share the code that is calling the SPI functions you shared in your original post?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void tps65290_write( uint8_t const adr_u8, uint8_t const data_u8 );&lt;BR /&gt;static void tps65290_write( uint8_t const adr_u8, uint8_t const data_u8 )&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; PWR_CTRL_ASSERT();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; (void) spi0_tx_rx( adr_u8 );&lt;BR /&gt;&amp;nbsp; (void) spi0_tx_rx( TPS65290_WRITE );&lt;/P&gt;&lt;P&gt;&amp;nbsp; (void) spi0_tx_rx( data_u8 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PWR_CTRL_DEASSERT();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static uint8_t tps65290_read( uint8_t const adr_u8 );&lt;BR /&gt;static uint8_t tps65290_read( uint8_t const adr_u8 )&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; PWR_CTRL_ASSERT();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; (void) spi0_tx_rx(&amp;nbsp; adr_u8 );&lt;BR /&gt;&amp;nbsp; (void) spi0_tx_rx( TPS65290_READ );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint8_t const data_u8 = spi0_tx_rx( 0U );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; PWR_CTRL_DEASSERT();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; return( data_u8 );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Which version of CW are you using?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10.6.&amp;nbsp; Other than to generate code for comparison I'm not using it.&lt;/P&gt;&lt;P&gt;Doing a bare metal project using GCC 4.7.3, have also tried GCC 4.8.2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Also, what system &amp;amp; bus clock frequencies are you running at?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried both doing nothing at all and run with the CW generated code giving ~21 MHz from the FLL for the system clock, putting bus clock at FLL/2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm now wondering is why does writing to SPI0_D not cause a hard fault, when reading SPI0_D does cause a hard fault?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 17:21:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313577#M13651</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-05T17:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313578#M13652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To your question about the need for the sequence in the uTasker code:&lt;/P&gt;&lt;P&gt;- the first time the SPI was used in the KL project it hung waiting for the first SPI transfer to complete.&lt;/P&gt;&lt;P&gt;- working with a debugger displaying the SPI registers it was found that it wouldn't hang if the code was stepped but it would if left to run.&lt;/P&gt;&lt;P&gt;- in both cases it was only ever an issue for the very first character - following ones never had this problem.&lt;/P&gt;&lt;P&gt;- experimenting showed that the sequence of reading the status register and then reading the data register always allowed the first byte to be successfully transferred (i.e. its completion to be correctly detected).&lt;/P&gt;&lt;P&gt;- the 'workaroud' was tested on all other KL parts (from KL02..KL46) and found to have the same behaviour (i.e. to be a workaround for it otherwise hanging for the reason that the status flag would not otherwise react)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other forum thread there is a discussion about why there are waits in the Freescale generated KL SPI code - I understand that without the waits the code won't work but no one knows why (I never looked into that code and can't be sure whether it is the exact same issue). I never needed any waits (with the two byte read sequence workaround).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the state is that there are no erratas but there are supposedly 2 workarouds in practice for the non-errata. In your case you are seemingly also encountering a non-errata problem. I don't know whether it is a situation that could result in an errata being generated (erratas are not created with the chips but are developed after experience with them is collected) but I do know that non of the KL boards will get past sending the first byte if the sequence is not performed in the uTasker code - if it is performed then utFAT works with SD card and a file or parameter system works in SPI Flash. Therefore that is the reason why it is considered (by me) to be standard initialisation code becaus it works around an otherwise non-explained behaviour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The uTasker setup for the KL25 will be using the PLL (the FLL is only used with the devices without USB and with 32kHz crystals) so there may be a difference in that area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you post your binary (if it can start on a KL25 board with 8MHz or 32MHz crystal) I can load it to see whether I can see why there is an access problem. It will help if you tell me the code address where it take splace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 20:22:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313578#M13652</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-05T20:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313579#M13653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saw Graeme Bragg's post but since it was only an issue due to one compliler I put it down to either a compiler 'funny' or an optimisation issue, rather than a coding/SPI usage issue (although coding/optimisation issues may go hand-in-hand).&lt;/P&gt;&lt;P&gt;In such cases one needs to study what is happening in the disassemble view. In the uTasker project there are a few workarounds that are restricted to certain compilers (the CW7.2 version for Coldfire had some nasties that could stop the TCP/IP stack from operating correctly and could be seen to be incorrect translation when studied in disassembled code - usually a workaroud is very simple - although not necessarily logical).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 20:35:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313579#M13653</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-05T20:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313580#M13654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied and pasted your code in a new project in CodeWarrior 10.6. I am testing it on a FRDM-KL25 board in the default FEI mode. I run the code normally and it does not lock up. I wrioe in the infinite loop the spi0_tx_rx function and I let the program run for a time and was ok. I really think that is a problem with your compiler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this information can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. It would be nice!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 01:07:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313580#M13654</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2014-06-06T01:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313581#M13655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; I copied and pasted your code in a new project in CodeWarrior 10.6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yeah, I tried that early on.&amp;nbsp; When I went to download the code with the PE Mulitilink FX I was told my 300 byte program was to large and I needed a CodeWarrior license. I can load much large code if the project was produced from CW from the start.&amp;nbsp; Gave up on CW at that point.&amp;nbsp; If you start a project with CW it seems to work well, my colleagues and I have had zero success in pasting foreign code into CW and have it do anything but waste our time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; I really think that is a problem with your compiler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That got me digging as nothing else was making sense, and you are correct, it is a compiler issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These two version work:&lt;/P&gt;&lt;P&gt;gcc version 4.7.3 20121207 (FSL release r785) [ARM/embedded-4_7-branch revision 194305] Shipped with CW 10.6&lt;BR /&gt;gcc version 4.7.4 20130613 (release) [ARM/embedded-4_7-branch revision 200083]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This one is producing hardware bus fault on read of SPI0_D.&lt;BR /&gt;It does not produce an error on write of SPI0_D.&lt;/P&gt;&lt;P&gt;Doesn't seem to be an issue with any other register, which I do not understand?:&lt;/P&gt;&lt;P&gt;gcc version 4.8.3 20131129 (release) [ARM/embedded-4_8-branch revision 205641]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was using 4.8 because it has better support of Pedantic error message and suppression there of, as Freescale headers are not C99 compliant.&amp;nbsp; That issue shows up when you enable all of the GCC warning/error directives, as is policy here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The original problem of SPRF not being set seems to be what Mark describes above.&amp;nbsp; It needs to be in an errata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, and Mark, and everyone else for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 15:18:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313581#M13655</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-06T15:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313582#M13656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good to hear that you are past his problem and that you could prove it to be compiler dependent. As mentioned previously that is what I was expecting for the other thread.&lt;/P&gt;&lt;P&gt;It is a fact of life that embedded programmers need to always remain open to the possibilities of such effects even if it is difficult to show other people the code that you are convinced is basically correct but does "funnies" without them expaining to you how your coding style must be to blame or explaining how it must be some pre-emption effect of the operating system. In one forum I was trying to prove a GCC error and was told by someone that they didn't understand the code so it must be my own fault - i.e. if they didn't understand the code how could I expect the compiler to do it right...(!!) Then you have to send off complete projects with exact instructions of how to reproduce it and usually you never hear anything back - sometimes you do and it is often a recommendation to use a different version because this was solved some time ago and is Ok in that one.&lt;/P&gt;&lt;P&gt;Since I work with a number of different IDEs and compilers I estimate that I invest about one week a year working on proving such problems and working on workarounds.&lt;/P&gt;&lt;P&gt;Pure coincidence but a collegue and myself had to work around a Texas Instruments compiler issue today which cost 8 hours (4 each) before we could actually locate where it was actually coming from and rewrite a single line of code to do the same thing but avoiding the error.&lt;/P&gt;&lt;P&gt;There are a couple of "funnies" that have been discussed here too:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/315541"&gt;Problem started with CW10.4 (Kinetis)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/316663"&gt;Compiler/Optimisation error CW10.2 (Kinetis)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way I am not absolutely sure whether you could confirm the SPI start-up workaround or not (?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 19:13:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313582#M13656</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-06T19:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313583#M13657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've helped develop the AVR GCC/avr-libc compiler for years, so I'm well aware of the treatment when you report a bug upstream. :-(&lt;/P&gt;&lt;P&gt;Well aware of the standard 'FAQ' "your compiler is broken", "no you forgot to use volatile in your code", kind of crap that goes on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm tired of the bleeding edge, I've lost to much blood over the years. :-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your SPI fix did solve my original problem with SPFR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SPI issues where compounded by me switching between compiler versions.&amp;nbsp; I've got a product to ship so was not inclined to waste yet more time on this issue, and hope it is fixed in a future 4.8.4 or later release.&amp;nbsp; There are still some issues with volatile in the ARM GCC per the release notes and I wonder if could be related?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This link on memory barriers may fit into the SPI issue somehow:&lt;/P&gt;&lt;P&gt;&lt;A class="loading" href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/index.html" title="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/index.html"&gt;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've seen the SPI code set master, then baud, then enable SPI,&lt;/P&gt;&lt;P&gt;and I've seen SPI code set master with enabling SPI at the same time then set the baud.&lt;/P&gt;&lt;P&gt;Not sure which one is correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect there is some issue with getting the baud rate counter synced to some internal clock domain, is the real issue inside the part, which is why the dummy reads are required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully someone at Freescale will be putting this in a errata HINT HINT!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll check out the other 'funnies'.&amp;nbsp; Before my wife's suicide, see &lt;A href="http://www.kpaddock.com/"&gt;http://www.kpaddock.com&lt;/A&gt; and &lt;A href="http://wiki.kpaddock.com/"&gt;http://wiki.kpaddock.com&lt;/A&gt; that I'm trying to move to, I was a prolific blogger on software safety issues at &lt;A href="http://blog.softwaresafety.net/"&gt;http://blog.softwaresafety.net&lt;/A&gt; .&amp;nbsp; Hopefully I'll find a new 'normal' and get back to that.&amp;nbsp; I was always documenting 'funnies' there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 20:28:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313583#M13657</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-06T20:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313584#M13658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the feedback.&lt;/P&gt;&lt;P&gt;I checked your links and wish you strength.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 21:34:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313584#M13658</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-06-06T21:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313585#M13659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to say thank you for your efforts - I hadn't got as far as as debugging this properly due to other work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am also having issues with arm-none-eabi-gcc 4.8.3 whereas 4.6.2 works fine with Codewarrior 10.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I have mentioned in my thread, I am wondering if this is specific to the non-CMSIS Freescale headers so if I get a chance, I may try it this week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Graeme&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 09:09:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313585#M13659</guid>
      <dc:creator>heliosfa</dc:creator>
      <dc:date>2014-06-09T09:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313586#M13660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well, it looks like there are more issues than just with SPI0_D with arm-none-eabi-gcc 4.8.3 - reading LPTMR0_CNR also causes a hard fault with both 4.8.2 and 4.7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;As an observation, reading from SPI0_D works in the latest 4.7 toolchain from launch pad.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I am now going to go back to 4.6.2 on my linux build system...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 06:44:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313586#M13660</guid>
      <dc:creator>heliosfa</dc:creator>
      <dc:date>2014-06-16T06:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why SPRF is never being set on SPI0 read for MKL25Z128VFT4?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313587#M13661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yesterday I found issues with optimization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you have the optimization level set for? -O?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd been using a legacy Makefile from a AVR project that was using -Os (Optimize code for size).&lt;/P&gt;&lt;P&gt;Neither 4.7.4 nor 4.8.4 20140516 would produce working code.&amp;nbsp; "ldr r3,[sp, #4]" to get a function parameter that was not on the stack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using any other optimization level 0/1/2/3 produced working code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With 4.8.4, I went with -O2 and moved on...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 14:34:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-SPRF-is-never-being-set-on-SPI0-read-for-MKL25Z128VFT4/m-p/313587#M13661</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2014-06-19T14:34:44Z</dc:date>
    </item>
  </channel>
</rss>

