<?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>MCUXpresso General中的主题 Re: FRDM-KL82Z - Writing less than 16 bytes to external flash with QSPI</title>
    <link>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771166#M491</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi josepgm,&lt;/P&gt;&lt;P&gt;you can write any number of data into NOR flash byte QSPI interface.&amp;nbsp;There is 3 point you must take care. for example, if you want to write a byte into flash:&lt;/P&gt;&lt;P&gt;1. In LUT, you must&amp;nbsp;set the data number to 1, looks like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [17] = QSPI_LUT_SEQ(QSPI_WRITE, QSPI_PAD_1, 0x1, 0, 0, 0),&lt;/P&gt;&lt;P&gt;2. Write the data number into IPCR register&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;QSPI_SetIPCommandSize(EXAMPLE_QSPI, 1);&lt;/P&gt;&lt;P&gt;3. A write transaction on the flash with data size of less than 32 bits will lead to the removal of four data entry from the TX buffer. The valid bits will be used and the rest of the bits will be discarded. So, you should write data 4 times even only 1 byte write.&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;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Nov 2017 07:47:15 GMT</pubDate>
    <dc:creator>jingpan</dc:creator>
    <dc:date>2017-11-20T07:47:15Z</dc:date>
    <item>
      <title>FRDM-KL82Z - Writing less than 16 bytes to external flash with QSPI</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771165#M490</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;I'm working on a project using a FRDM-KL82Z board, with the MKL82Z128 microcontroller. I use the SEGGER J-Link EDU programmer and MCUXpresso 10.0.2 IDE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to write data from the MCU to&amp;nbsp; the external flash, which is the MX25L12845G.&lt;/P&gt;&lt;P&gt;I have no experience working with neither QSPI nor flash, so I've taken the &lt;EM&gt;frdmkl82z_driver_examples_qspi_polling_transfer&lt;/EM&gt; example from the SDK and the datasheet as a reference. I think I more or less understand how to make it work, although I have some questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been able to write data with size between 16 and 64 bytes (limits included) and more or equal to 80 bytes. I know how to manage the jump to the next page and so on. In the flash datasheet &lt;A href="http://www.macronix.com/Lists/Datasheet/Attachments/6260/MX25L12845G,%203V,%20128Mb,%20v1.5.pdf"&gt;(MX25L12845G, Page 6&lt;/A&gt;) it says that it can be written in byte, word or page mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From my understanding, the way to write to Flash is writing data into the TxFIFO (which has 16 positions of 4 bytes each = 64 bytes). The example uses the &lt;EM&gt;QSPI_WriteBlocking&lt;/EM&gt; function, which asks for 16 or more bytes of data with the initial &lt;EM&gt;assert&lt;/EM&gt;. If I want to write more than 64 bytes, once the TxFIFO is full the &lt;EM&gt;QSPI_WriteBlocking&lt;/EM&gt; function waits until there's a free position in the FIFO and adds the next one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to modify the &lt;EM&gt;assert&lt;/EM&gt; in the &lt;EM&gt;QSPI_WriteBlocking&lt;/EM&gt;i function to see what happens if I try to write less than 16 bytes (12, 8 or 4 bytes) and the program writes the number or elements I tell him but it writes all 0s. If I follow the fsl functions I see that the QuadSPI TBDR (TX Buffer Data Register) gets the values I tell him, so it seems as something in a lower level. The IP commands doesn't seem to have any parameter that could solve this, except the &lt;EM&gt;QSPI_SetIPCommandSize&lt;/EM&gt;, which I give the number of bytes to write and seems to work for the range of values that I mentioned before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I don't know when the &lt;EM&gt;QSPI_SoftwareReset&lt;/EM&gt; function is needed to be used. The SDK example uses it every page write, but there's no info about why it is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how to do it? I'd be very grateful as I've been some days trying to figure it out but I haven't succeeded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Josep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2017 09:13:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771165#M490</guid>
      <dc:creator>josepgm</dc:creator>
      <dc:date>2017-11-14T09:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-KL82Z - Writing less than 16 bytes to external flash with QSPI</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771166#M491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi josepgm,&lt;/P&gt;&lt;P&gt;you can write any number of data into NOR flash byte QSPI interface.&amp;nbsp;There is 3 point you must take care. for example, if you want to write a byte into flash:&lt;/P&gt;&lt;P&gt;1. In LUT, you must&amp;nbsp;set the data number to 1, looks like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [17] = QSPI_LUT_SEQ(QSPI_WRITE, QSPI_PAD_1, 0x1, 0, 0, 0),&lt;/P&gt;&lt;P&gt;2. Write the data number into IPCR register&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;QSPI_SetIPCommandSize(EXAMPLE_QSPI, 1);&lt;/P&gt;&lt;P&gt;3. A write transaction on the flash with data size of less than 32 bits will lead to the removal of four data entry from the TX buffer. The valid bits will be used and the rest of the bits will be discarded. So, you should write data 4 times even only 1 byte write.&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;Jing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 07:47:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771166#M491</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2017-11-20T07:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: FRDM-KL82Z - Writing less than 16 bytes to external flash with QSPI</title>
      <link>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771167#M492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Thank you so much &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/jingpan"&gt;jingpan&lt;/A&gt;‌, the LUT setting is what I was missing, now it lets me write. For anyone doing the same as me, be careful with clearing the FIFO, you may need to do so depending on how you organise your writes!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Josep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 21:44:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-General/FRDM-KL82Z-Writing-less-than-16-bytes-to-external-flash-with/m-p/771167#M492</guid>
      <dc:creator>josepgm</dc:creator>
      <dc:date>2017-11-21T21:44:12Z</dc:date>
    </item>
  </channel>
</rss>

