<?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: uSDHC MMC Write: BWEN Never sets in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441359#M67819</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me also add that if I ignore BWEN and just start writing data to the DATA_BUF_ACC_PORT register, it gets clocked out to the eMMC device and is stored correctly.&amp;nbsp; I can read it back and it's there, basically everything works.&amp;nbsp; The only problem with this is when writing multiple blocks you don't have any way to know when the hardware FIFO is getting full.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried writing the FIFO at full CPU speed and at each write to DATA_BUF_ACC_PORT checking BWEN to see if it ever goes high, but it never does.&amp;nbsp; No transition, nothing.&amp;nbsp; Just always zero.&amp;nbsp; The FIFO clearly gets overrun though.&amp;nbsp; How is this even supposed to work?&amp;nbsp; It seems like this bit is just dead, and yet all the example code I've seen thus far uses it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Sep 2015 22:56:44 GMT</pubDate>
    <dc:creator>elijahbrown</dc:creator>
    <dc:date>2015-09-10T22:56:44Z</dc:date>
    <item>
      <title>uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441358#M67818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to write a bare metal driver for the iMX6 uSDHC peripheral.&amp;nbsp; It's wired up to an eMMC device.&amp;nbsp; I'm able to initialize the emmc device and read blocks successfully.&amp;nbsp; But when I try to do a write block command (CMD24 or CMD25), the BWEN bit in the PRES_STATE register never gets set so the driver is never able to proceed on with writing data to the DATA_BUF_ACC_PORT register.&amp;nbsp; &lt;BR /&gt;I am using the polled mode, no interrupts or DMA.&amp;nbsp; The read operation is doing the same thing except polling the BREN bit to determine when it can read data, and this method is working fine.&amp;nbsp; I've been through all the INT_STATUS_EN register settings, BWRSEN and BRRSEN are both set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the datasheet: "A change of this bit from 0 to 1 occurs when the buffer can hold valid data greater than the write watermark level and the Buffer Write Ready interrupt is generated and enabled."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure the buffer write ready interrupt is being enabled, and nothing has been written to the buffer register yet so why is the bit not setting?&amp;nbsp; I have the watermark level set at 0x40 (half the FIFO).&amp;nbsp; Can you see anything I'm missing?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 21:37:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441358#M67818</guid>
      <dc:creator>elijahbrown</dc:creator>
      <dc:date>2015-09-10T21:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441359#M67819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me also add that if I ignore BWEN and just start writing data to the DATA_BUF_ACC_PORT register, it gets clocked out to the eMMC device and is stored correctly.&amp;nbsp; I can read it back and it's there, basically everything works.&amp;nbsp; The only problem with this is when writing multiple blocks you don't have any way to know when the hardware FIFO is getting full.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried writing the FIFO at full CPU speed and at each write to DATA_BUF_ACC_PORT checking BWEN to see if it ever goes high, but it never does.&amp;nbsp; No transition, nothing.&amp;nbsp; Just always zero.&amp;nbsp; The FIFO clearly gets overrun though.&amp;nbsp; How is this even supposed to work?&amp;nbsp; It seems like this bit is just dead, and yet all the example code I've seen thus far uses it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 22:56:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441359#M67819</guid>
      <dc:creator>elijahbrown</dc:creator>
      <dc:date>2015-09-10T22:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441360#M67820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&amp;nbsp; Have You tried uSDHC example from the i.MX6 Platform SDK ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;(Chapter 35 [Configuring the uSDHC Driver] in “iMX6_Firmware_Guide.pdf”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;describes driver details. )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&lt;A class="jive-link-external-small" href="https://www.freescale.com/webapp/Download?colCode=i.MX6_PLATFORM_SDK&amp;amp;location=null&amp;amp;fpsp=1&amp;amp;WT_TYPE=Software%20Development%20Kits&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=tgz&amp;amp;WT_ASSET=Downloads&amp;amp;fileExt=.tgz&amp;amp;Parent_nodeId=1337637154535695831062&amp;amp;Parent_pageType=product" rel="nofollow"&gt;https://www.freescale.com/webapp/Download?colCode=i.MX6_PLATFORM_SDK&amp;amp;location=null&amp;amp;fpsp=1&amp;amp;WT_TYPE=Software%20Development%20Kits&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=tgz&amp;amp;WT_ASSET=Downloads&amp;amp;fileExt=.tgz&amp;amp;Parent_nodeId=1337637154535695831062&amp;amp;Parent_pageType=product&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Yuri&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 06:52:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441360#M67820</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2015-09-14T06:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441361#M67821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I have referenced that but the problem is in the function "host_data_write":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;/* Write data from src_ptr */&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;loop = length / (4 * wml);&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;for (idx = 0; idx &amp;lt; loop; idx++) {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;/* Wait until write available */&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;while (!(HW_USDHC_PRES_STATE(instance).B.BWEN)) {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;/* Write to FIFO watermark words */&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;for (itr = 0; itr &amp;lt; wml; itr++) {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;HW_USDHC_DATA_BUFF_ACC_PORT(instance).U = *src_ptr;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;src_ptr++;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You see it's waiting for BWEN to be set before it starts writing words into the FIFO.&amp;nbsp; This bit never sets and the code is just stuck there forever.&amp;nbsp; If I ignore the bit and just start writing, it works but you risk overflowing the FIFO then.&amp;nbsp; Any more ideas?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2015 18:16:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441361#M67821</guid>
      <dc:creator>elijahbrown</dc:creator>
      <dc:date>2015-09-18T18:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441362#M67822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/YuriMuhin_ng"&gt;YuriMuhin_ng&lt;/A&gt;​ can you help to continue with the follow up?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Dec 2015 17:33:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441362#M67822</guid>
      <dc:creator>karina_valencia</dc:creator>
      <dc:date>2015-12-03T17:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441363#M67823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&amp;nbsp; According to section 67.4.1 (Data Buffer) of the i.MX6 DQ Reference Manual :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;“CPU polling mode:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;* For a host read operation, when the number of words received in the buffer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;meets or exceeds the RD_WML watermark value, by polling the BRR bit, the&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;Host Driver can read the Buffer Data Port register to fetch the amount of words&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;set in the RD_WML register from the buffer. The write operation is similar.”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&amp;nbsp;&amp;nbsp; This means, as stated in section 67.4.1.1 (Write Operation Sequence) :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;“When the internal DMA is not used, (the DMAEN bit in the Transfer Type register is not&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;set when the command is sent), the uSDHC asserts a DMA request when the amount of&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;buffer space exceeds the value set in the WR_WML register, and is ready for receiving&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;new data. At the same time, the uSDHC sets the BWR bit. The buffer write ready&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;interrupt will be generated if it is enabled by software.”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;So, please use the BWR bit before FIFO filling. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&amp;nbsp;&amp;nbsp; Also, ”the uSDHC will not start data transmission until the number of words set in &lt;BR /&gt; the WR_WML register can be held in the buffer. If the buffer is empty and the Host System &lt;BR /&gt; does not write data in time, the uSDHC will stop the CLK to avoid the data buffer underrun &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;situation.”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;Yuri.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 04:39:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441363#M67823</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2015-12-09T04:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441364#M67824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you actually try this?&amp;nbsp; As I said in the original post, I try to do exactly this and the BWR bit never sets.&amp;nbsp; If you spin waiting for it to set, it'll spin forever.&amp;nbsp; That is the heart of the problem, the bit just never sets.&amp;nbsp; It *should* be set as there is room in the FIFO below the WML.&amp;nbsp; But it never sets.&amp;nbsp; Tried all sorts of weird stuff and it simply never sets.&amp;nbsp; Ignore it and write to the FIFO anyway and the data shows up on the eMMC device.&amp;nbsp; But then you have no way of knowing when the FIFO is full...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 23:43:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441364#M67824</guid>
      <dc:creator>elijahbrown</dc:creator>
      <dc:date>2015-12-09T23:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441365#M67825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Elijah, for your issue I think you hasn't set the SDHC correctly for non-DMA mode access, you can reference to attached code for PIO mode operation on SDHC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2015 05:32:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441365#M67825</guid>
      <dc:creator>qiang_li-mpu_se</dc:creator>
      <dc:date>2015-12-24T05:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: uSDHC MMC Write: BWEN Never sets</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441366#M67826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to follow up I did get it working, but I abandoned PIO mode and modified my driver to use DMA instead.&amp;nbsp; The only slight catch was flushing and invalidating the cache, as I have dcache and l2 cache turned on.&amp;nbsp; Both caches mush be invalidated when doing a data read, and before issuing the data write cmd the dcache must be flushed followed by the l2 cache.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 17:43:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/uSDHC-MMC-Write-BWEN-Never-sets/m-p/441366#M67826</guid>
      <dc:creator>elijahbrown</dc:creator>
      <dc:date>2016-01-14T17:43:23Z</dc:date>
    </item>
  </channel>
</rss>

