<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[HA01 1_3_1 SDK ECC Demo笔误]]></title><description><![CDATA[<h1>1. 问题描述</h1>
<ul>
<li>HA01的1_3_1的ECC Demo笔误，在 EFM_RecoveryErrorHandler 清除的是 UNRECOVERR 标志。</li>
<li>导致 RECOVERR 的中断标志位一直没有被清除，无限进入 EFM_RecoveryErrorHandler ，造成程序卡住。<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/d904bb3d-f461-4f51-b17c-bd5a8db8bf43.png" alt="fc596f9a-d05c-4ed1-922d-86e8afc58e1e-image.png" class=" img-fluid img-markdown" /></li>
</ul>
<h1>2. 背景</h1>
<ul>
<li>有客户在应用中使用参考1_3_1的ECC Demo，开启EFM_Recovery中断和添加中断处理代码。</li>
<li>当写flash掉电发生ECC 单bit错误时，由于客户并未在单bit错误中断中擦除错误sector，同时UNRECOVERR 标志未清除，最终就无限进中断导致程序卡死。</li>
</ul>
<h1>3. 详细描述</h1>
<ul>
<li>SDK对比：<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/6cefcae2-a683-48a3-a39b-4ef4865dc390.png" alt="62d84d34-1bac-4bf3-8aa3-3a0eb89dd13d-image.png" class=" img-fluid img-markdown" /></li>
<li>1_3_1流程解析：<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/d8e7c4af-79ca-43c4-8599-288dc3b041b1.png" alt="39c79274-6b56-4ba1-9650-d2d0e905eb04-image.png" class=" img-fluid img-markdown" /></li>
</ul>
<h1>4. 测试验证</h1>
<ul>
<li>使用EFM ECC错误注入的方式模拟flash掉电发生ECC 单bit错误，可复现无限进入单bit错误中断。<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/bb3feaf8-77ed-4dd8-8f16-32cd44935415.png" alt="e9b47a10-7b24-42b4-ad5e-c3f13ee19cb8-image.png" class=" img-fluid img-markdown" /></li>
</ul>
<h1>5. 解决方案</h1>
<ul>
<li>参考SDK 1_4_1 在EFM_RecoveryErrorHandler 里正确清除RecoveryError标志位；</li>
<li>不处理 RecoveryError ，硬件可以纠错，不开 RecoveryError 中断。</li>
<li>列入checklist，方便客户前期规避此问题。</li>
</ul>
<h1>6. 为什么1_3_1的ECC Demo测试没问题</h1>
<ul>
<li>原因是1_3_1版本的falsh驱动在 FLASH_LaunchCommandSequence 操作时都会清除所有错误标志</li>
<li>而且ECC例程的处理机制就是不管是单还是双bit ECC错误都会擦除对应的sector</li>
<li>所以一旦调用 FLASH_DRV_EraseSector 就会将 RecoveryError 标志清除，也就不会重复进入中断。<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/27013bf4-77b0-44bc-a1f3-abd4a7d14006.png" alt="d1e1eea0-c86d-4af4-886c-5ab17d51bdc4-image.png" class=" img-fluid img-markdown" /></li>
<li>1_4_1 的例程RecoveryError 中断里会及时清除标志位，但是 FLASH_LaunchCommandSequence 就不会清除全部的错误标志：<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/31fe42cc-58e5-4589-a2b3-98b15e63b9ca.png" alt="6aaf7c8f-3c76-4f29-866f-9bed766cf0d0-image.png" class=" img-fluid img-markdown" /></li>
</ul>
<h1>7. 结论</h1>
<ul>
<li>HA01 1_3_1 SDK 的 ECC Demo笔误：EFM_RecoveryErrorHandler 清错标志（清了 UNRECOVERR 而非 RECOVERR），导致中断反复触发、程序卡死；</li>
<li>解决方案是参照 1_4_1 SDK 在 EFM_RecoveryErrorHandler 中正确清除 RecoveryError 标志，或不处理 RecoveryError、直接关闭该中断。</li>
</ul>
<h1>8. 测试软件</h1>
<p dir="auto"><a href="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/671/f3721ee3-859f-4ae9-aafc-d8088b4f7614.zip" rel="nofollow ugc">Flash_ECC1bit_Injict_Demo.zip</a></p>
]]></description><link>https://forum.ytmicro.com/topic/2286/ha01-1_3_1-sdk-ecc-demo笔误</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 23:17:34 GMT</lastBuildDate><atom:link href="https://forum.ytmicro.com/topic/2286.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Oct 2026 03:22:11 GMT</pubDate><ttl>60</ttl></channel></rss>