Multi Source Translation Content

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multi Source Translation Content

Discussions

Sort by:
Souring RAM for i.MX 8M Plus and i.MX 95 Hello, I am sourcing RAM for a new project and am having difficulty finding parts with good availability due to the current memory shortage. Are there any specific RAM chips you would recommend for new designs based on current availability and ease of procurement? The project will use either the i.MX 8M Plus or the i.MX 95. Ideally, I'd like to use LPDDR4/4X across both platforms to simplify sourcing and potentially reuse the same memory component. However, I am also open to using different memory types for each platform if that would make sourcing easier. For example: -LPDDR4 for i.MX 8M Plus (not DDR4, as low-power is important for this specific application) -LPDDR4X or LPDDR5 for the i.MX 95 To clarify, I'm not primarily looking for recommendations on memory devices that are known to be compatible with these processors. Rather, I'm interested in specific part numbers that are currently readily available and suitable for new designs. Any recommendations or insights into which manufacturers or parts are easier to source would be greatly appreciated. Thank you! Re: Souring RAM for i.MX 8M Plus and i.MX 95 Hi @Radeoic  Sorry, I am not familiar with the current market situation regarding the availability of DRAM. you will need to contact related DRAM suppliers directly to make inquiries. B.R Re: Souring RAM for i.MX 8M Plus and i.MX 95 If you are a manufacturer based in China, this is very difficult; if you are based in another country, U.S. companies can assist you. Re: Souring RAM for i.MX 8M Plus and i.MX 95 You should be asking for the specific model of the RAM.
View full article
S32G3中KMS的可行性 能否通过 HSE Demo 应用程序中的自定义逻辑来实现 KMS 功能,还是必须使用HSE_FWTYPE = 9 / HSE_FWTYPE = 22 ? Re: Feasibility of KMS in S32G3 你好, @Pranathi06 感谢分享。 演示应用程序中提到的 KMS 服务旨在使用自定义 HSE 固件,因此 HSE_FWTYPE = 9(22)。由于它是高级软件中包含的功能,我建议您联系当地的 恩智浦代表(如果无法联系,请通过 support.nxp.com 提交工单)以了解详细信息。 BR 陈银  Re: Feasibility of KMS in S32G3 你好, @Pranathi06 感谢您的回复。 抱歉,我不确定您的KMS实现指的是哪种标准/规范,我可能无法提供明确的确认,给您带来的不便敬请谅解。 依我之见,您首先可以查阅最新的标准 HSE 固件 API 文档(其中包含标准 HSE 固件支持的所有 API/服务,例如密钥导入/导出/生成等,这些内容可在 HSE 固件包中找到),以明确 HSE 固件支持的所有密钥管理服务。然后,根据您的加密协议栈/自定义应用程序,分析您 KMS 中定义的所有功能是否能够基于当前 S32G3 标准 HSE 固件正确实现。 BR 陈银   Re: Feasibility of KMS in S32G3 能否在 HSE Demo 应用程序[标准]中通过自定义逻辑实现 KMS 功能?
View full article
LPC55S28 ISP_CMD_EN は ISP コマンドを無効にしません こんにちは、 私はCMPAとCFPA設定が付いたLPC55S28 MCUを持っています。以下のコマンドを使用して、Python経由でblhostからこれらの値を直接読み取って取得しました。つまり、これらは実際のMCUから直接来たものです。これはMCUのフルパワーサイクル後のことです。 CMPAデータはUSB経由で読み取られます。 uv run Python -m spsdk.apps.blhost -u 0x3972,0x3333 read-memory 0x0009E400 512 -f cmpa_dump.bin CMPAをyamlにパースし、 UV run Python -m spsdk.apps.pfr parse -f lpc55s28 -t cmpa -b cmpa_dump.bin -o parsed_cmpa.yaml そして、CFPAについても住所は異なるものの同様のことが行われる。私はアドレス0x9DE00からCFPAを読み取りました。これはおそらくスクラッチバージョンだと思います。しかし、スクラッチの場合、CMPA_PROG_IN_PROGRESS がゼロ以外の値を読み取るという点を除けば、ping と pong は一致しています。でも、0x00はピンポンとトンのためです。 以下に、添付されているファイルの概要を示します。詳細は全文ファイルを添付しています CMPA:ピン、DFLT NIDEN = USE_DAP、障害 DEGEN = USE_DAP、無効化 TAPEN = USE_DAP、無効化 ISP_CMD_EN = USE_DAP、無効化 FA_ME_CMD_EN = FIXED_STATE、有効 SEC_BOOT_EN = ENABLE_0 CFPA:PIN、DFLT NIDEN = USE_DAP、障害 DEGEN = USE_DAP、無効化 TAPEN = USE_DAP、無効化 ISP_CMD_EN = USE_DAP、無効化 FA_ME_CMD_EN = FIXED_STATE、有効 私の理解では、これらの設定ではblhostを使用してメモリを読み取ることはできないはずです。CMPA、CFPA、アプリケーションフラッシュ、アプリケーションRAMを読み取れ、DAP認証なしでblhost経由で実行ファイルを全てダンプできます。 質問: 1.ISP_CMD_ENが無効になっていると、内部メモリへの読み書きができないということですか?PFRかアプリケーションメモリのいずれかです。安全な.sbファイルを送信する機能はまだ必要ですブートローダーにファイルを転送する必要がある。 2. ISP_CMD_ENは、ブートローダー経由でUSBから.SBファイルをロードする機能を無効にしますか? 3. .SBファイルを使用したUSBブートローダーの機能を維持しつつ、ISPコマンドによるメモリへの読み書き機能を無効にするには、どのような設定が必要ですか? 4. なぜMCUはCMPAやCFPAで無効になっているのに、blhost ISPコマンドを許可しているのでしょうか? こちらのリンク先のフォーラム投稿を読みました。 https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/LPC55-Disable-ISP-and-SWD-to-utilize-code-protection/ta-p/1654157 しかし、設定ではISPが完全に無効になっており、ブートローダーも完全に無効になっています。ISP_CMD_ENが無効になっているにもかかわらず、なぜ私の設定でblhost経由でISPコマンドが許可されているのか、そのフォーラムの投稿には説明がないと思います。 Re: LPC55S28 ISP_CMD_EN not disabling ISP commands こんにちは、 @guitardenver 重要な点は、ISP_CMD_EN はすべての blhost コマンドに対するグローバルな有効/無効ビットではないということです。これは「Debug Mailbox Enter ISP Mode」コマンドでISPモードに入力できるかどうかを制御します。デバイスが別の許可されたブートパスを介してROM ISPに入ると、USB blhostコマンドはROMブートローダーによって個別に処理されます。 1. メモリの読み書き: ISP_CMD_EN を無効にしても、ReadMemory や WriteMemory は無効になりません。これらのコマンドは、保護されていないメモリにもアクセス可能です。 2. SB ファイルのダウンロード: ISP_CMD_EN は ROM ReceiveSBFile コマンドを直接無効にしません。したがって、これはUSB SBファイルの更新を制御するものとして扱うべきではありません。 3. 生のメモリアクセスをブロックしながらSB更新:LPC55S28リファレンス・マニュアルによると、ReadMemoryおよびWriteMemoryコマンドを無効にしつつ、USB ISPをSB更新のために利用可能に保つ設定は現在存在しません。 4. blhost がまだ機能する理由: この動作は、必ずしも CMPA/CFPA 設定が無視されていることを意味するものではありません。デバイスは既にROM ISPに入っているが、ISP_CMD_ENはISPへの別のパスを制御する。 BR ハリー Re: LPC55S28 ISP_CMD_EN not disabling ISP commands こんにちは、ハリーさん。 ISP_CMD_ENの役割を明確にしていただき、またROM ISPハンドラが一度起動されるとコマンドレベルのフィルタリング機能がないことを確認していただき、ありがとうございます。 当初の設計上の前提は、LPC55S28の認証済みROMブートローダーが、セカンダリのフラッシュブートローダーを必要とせずに、USB経由で(署名済みSB2経由)本番現場での更新インターフェースとして機能するというものでした。1コンテナを使わずに。しかし、あなたの返信からすると、USB ROM ISPインターフェースを公開することで、実質的にメモリのバックドアが広く開かれているようです。物理的なUSBアクセス権があれば、誰でも生の読み取りメモリ、書き込みメモリ、フラッシュ消去領域コマンドを発行できます。 Secure Bootは変更されたコードや署名されていないコードの実行を防ぎますが、攻撃者は現場で暗号化されていないフラッシュIPやプローブSRAMをダンプすることが可能です。 それを踏まえ、 NXPがお客様にこれを安全な商用製品にどのように展開することを期待しているのか、いくつか具体的な質問があります。 PRINCE + Open USB ISP: もしアプリケーション全体でPRINCEフラッシュ暗号化を有効にして静止時のIP保護をした場合、 NXPは現場でUSB ISPを有効にしておくことについてどのようなセキュリティ立場を取っていますか? 具体的には、 ROMブートローダー内で内部SRAMへの任意の読み書きアクセスは、鍵を漏らしたりブートロジックを回避したりする現実的な攻撃対象になるのでしょうか?もしそうでなければ、私が取るのはこの方法だと思います。 推奨されるフィールドアップデートアーキテクチャ:露出したUSBポートを介してROM ISPをアクティブにしたままにすることがセキュリティ上のアンチパターンとみなされる場合、 NXPが推奨するフィールドアップデートのアーキテクチャは何ですか? NXPは、ROM ISPを完全に無効化( DEFAULT_ISP_MODE = DISABLE)し、ROM IAP APIを使用してSBコンテナを消費するカスタムデュアルバンク/セカンダリブートローダーを実装することを推奨していますか? Re: LPC55S28 ISP_CMD_EN not disabling ISP commands こんにちは、 @guitardenver 追加のご質問ありがとうございます。AN12283 – LPC55Sxx セキュアブート、特にセクション5、5.6、5.7を参照することをお勧めします。 AN12283では、セキュアブート、ROM ISPのreceive-sb-fileコマンドによるSB2/SB2.1ファームウェアのアップデート、およびPRINCEフラッシュ暗号化の使用方法について説明しています。また、PRINCEキーはオンチップPUFからソフトウェアアクセスできない内部ハードウェアバスを通じて提供されるとも記載されています。 重要な点の1つは、実際のセキュアブートの設定を確認することです。AN12283によると、SEC_BOOT_EN = 00はプレーンイメージを意味し、01、10、11は署名付きイメージを意味します。以前のSPSDK出力でSEC_BOOT_EN = ENABLE_0と表示されていたので、まずはその生の値を確認することをお勧めします。 セキュアブート、SB2.1アップデート、およびPRINCE構成の詳細については、AN12283を参照してください。 LPC55Sxx セキュアブート BR ハリー
View full article
FS2400 INIT_CRC_NOK_I 頻繁な電源サイクル(電源オン/オフ)条件下で、FS2400のINIT_CRC_NOK_Iフラグが検出されました。この状況では、FS_I_XXXレジスタを読み取ったところ、その内容はINITフェーズ中に書き込んだデータと一致していました。さらに、故障エラー数は増加せず、0のままでした。これが誤報かどうか、またこの状況を放置してもよいのか、確認を手伝ってもらえますか? Re: FS2400 INIT_CRC_NOK_I こんにちは、 INIT_CRC_NOK_Iフラグは、FS2400の周期的CRCチェック機構が、5msごとにINITレジスタで再計算したCRCとFS_CRCレジスタに格納されている値との間に不一致を検出した場合に設定されます。これは真のセーフティ監視機能であり、その根本原因を理解しずに軽視すべきではありません。 FS_I_XXXレジスタを読み返して、あなたが書いた値と一致する結果が得られるという事実は、CRCの不一致を排除するものではありません。このシナリオで最も一般的な原因は、MCUがINITレジスタを正しく書き込むが、INITフェーズを閉じる前に正しいCRCをFS_CRCに計算・保存しないことです(すなわち、最初の正しいウォッチドッグ更新の前に)。以下の点をご確認ください。 1. CRC計算:8ビットCRCは、以下のレジスタビットフィールドの連結(この順序で)に対して計算する必要があります。 FS_I_OVUV_CFG1[15:0] FS_I_OVUV_CFG2[15:0] FS_I_ERRMON_LIMP0_CFG[15:0] FS_I_FSSM_CFG[15:4] FS_I_WD_CFG[15:7] 適用する多項式は、x⁸ + x⁴ + x³ + x² + 1 です(SPI CRC と同じです)。 2. CRC登録:MCUはINITフェーズが終了する前に計算されたCRCをFS_CRCに書き込みなければなりません(すなわち最初の正しいウォッチドッグ更新の前に)。CRCが書き込まれた後にINITレジスタが変更された場合、CRCを再計算して書き直す必要があります。 3. 障害エラーカウンタに関する補足説明:障害エラーカウントが0のままだったとのことですが、デバイスのデータシートによると、障害エラーカウンタは電源投入リセット(POR)後に0ではなく1から開始します。INIT_CRC_NOKはトリガーされるたびにこのカウンタを+1ずつ増加させます。この値をどのレジスタとフィールドで読み取っているのか確認してもらえますか?電源投入サイクルを経てもカウンタが1(PORリセット値)のままである場合、これは電源投入シーケンスの非常に早い段階でフラグが観測されていることを示唆しており、おそらくカウンタが蓄積される前に観測されていると考えられます。INITフェーズの完了からどのタイミングでフラグが観測されたのか、正確なタイミングについてご説明いただけると幸いです。 4. 電源サイクルに関する考慮事項: INIT フェーズは常に POR (完全な電源オフと電源オン) から再開されます。周期的なCRCチェックは、INITフェーズが終了した後の通常モードでのみ有効になります。INIT_CRC_NOK_IフラグがINIT終了直後に観測される場合、これは最初の5msチェック時点でFS_CRCレジスタの値が現在のINITレジスタの内容と一致していないことを強く示唆しています。 BRs、トーマス
View full article
S32G3におけるRCCU、FCCU、およびLockstep診断データフロー 親愛なるNXPへ、 私の理解では、RCCUはLockstepのミスマッチを検出し、FCCUにエラーを報告します。FCCUは故障マネジメントを担当し、Linuxカーネルログ(dmesg)を通じて診断情報を提供することがあります。しかし、BSPのドキュメントではこのプロセスが大まかに説明されているに過ぎません。 Linux BSP 48.0.0のS32G378Aに関するより具体的な実装ガイダンスを教えていただけますか? 利用可能な診断データ:RCCUおよびFCCUから収集可能なデータの種類には、エラーの状態、故障の発生源、エラータイプ、故障のコンテキストなどがありますか?ハードウェアで実際に利用可能な情報と、Linux dmesgを通じて報告できる情報は何でしょうか? エンドツーエンドのデータフロー:RCCUによるロックステップ不一致の検出から、FCCUの故障処理、Linuxカーネル報告までの正確な流れはどのようなものなのでしょうか?どのレジスタ、割り込み、ドライバ、またはソフトウェアコンポーネントが関与しているのでしょうか? ソースコードと実装:BSP 48.0.0でこれらの情報を収集・報告するために、どのソースファイル、デバイスドライバ、デバイスツリーエントリ、または設定ファイルを変更する必要があるのか?NXPは、完全なフローを示す既存のGitHubリポジトリ、リファレンス実装、またはサンプルコードを提供していますか? ロックステップの入出力:ロックステップ機構は、入力として実際に何を比較するのでしょうか?入力は冗長なA53実行パスによって内部的に生成されるのか、それとも入力データをソフトウェアで設定または読み込む必要があるのか?関連する構成はどこで行われ、不一致が発生した場合にソフトウェアが取得できる診断出力は何でしょうか? 関連するリファレンスマニュアルのセクション、ソースコード参照、具体的な実装ワークフローをご提供ください。現在のBSPドキュメントではこれらの詳細が十分に説明されていません。 Re: RCCU, FCCU, and Lockstep Diagnostic Data Flow on S32G3 お返事ありがとうございます。もう一つ質問させてください。 Linux BSP 48.0.0ユーザーマニュアルでは、デバイスツリーのプロパティ(例えば「nxp,ncf_fault_list」や「nxp,ncf_actions)」を用いてFCCUの設定を説明しています。 この設定を適用するためにどのソースファイルを修正すべきか、教えていただけますか?変更を保存した後、デバイスツリーを通じて有効になりますか?それともFCCUドライバも修正する必要がありますか? 可能であれば、S32G378A-EVB3の簡単な例を示してください。 よろしくお願いします、 トアン Re: RCCU, FCCU, and Lockstep Diagnostic Data Flow on S32G3 こんにちは、 @Toan 投稿ありがとうございます 1.FCCUは、デバイスで故障が検出された際に故障を収集するためのハードウェアインターフェースを提供しています。これはハードウェアの挙動であり、異なる故障番号は異なる故障を反映します。S32G3 RMに添付された故障マップファイルを参照してください。BSP48のLinux FCCUドライバは、FCCUで処理された非重大障害の選択リストを更新し、デバイスツリーを使ってサポートされるNCFアクションのいずれかを選択できます。反応セットがアラームの場合、アラーム情報は 対応する障害が発生した場合、カーネルのログに印刷されました。 2. RCCUが問題を検出すると、FCCUはそれを記録し、ユーザーが設定したアクションを実行します。例えば、アラームがアクションに設定されている場合、その情報はカーネルログに記載されており、Linux FCCUドライバ、DTS、FCCUアラーム割り込みハンドラが関与します。 3. 対応する情報はBSP48 UM第6章から入手可能。 4. ロックステップモードでは、1つのクラスタがメインクラスタ、2つ目のクラスタがチェッカークラスタとみなされます。ソフトウェアの観点からは、2つのクラスタはロックステップモードで単一のクラスタとして動作します。Cortex-A53 Cluster0はメインの実行クラスタであり、Cortex-A53 Cluster1はCortex-A53 Cluster0の実行後に続きます。複製されたリソースの同等な動作は、クラスタから出るすべての機能信号に対してコンパレータ(RCCU)によって監督され、残りのMCUに送られます。監督信号間の運用上の逸脱があれば、FCCUに不一致が通知されます。 S32G3 A53ロックステップモードでは、ソフトウェアはロックステップ比較のために入力データを提供または読み込む必要がありません。比較は通常のA53実行中にハードウェア内部で行われ、アプリケーションソフトウェアには透過的です。 ソフトウェアは主に比較データではなく、ロックステップの動作モードを設定します。ソフトウェアは故障に対応するアクションを設定できます。不一致が検出された場合、それはRCCU/FCCUのセーフティ故障メカニズムを通じて報告され、関連する対応が実行されます。 BR チェイン
View full article
S32G3上的RCCU、FCCU和锁步诊断数据流 尊敬的恩智浦: 据我了解,RCCU 会检测锁步不匹配并将错误报告给 FCCU,FCCU 会处理故障管理,并可能通过 Linux 内核日志 (dmesg) 提供诊断信息。然而,电路板支持包文档仅从宏观层面描述了这一过程。 能否提供针对 Linux 电路板支持包。 48.0.0 的 S32G378A 的更具体的实施指导? 可用的诊断数据:可以从 RCCU 和 FCCU 收集哪些类型的数据,例如错误状态、故障源、错误类型或故障上下文?硬件中实际有哪些信息可用,Linux dmesg 可以报告哪些信息? 端到端数据流:从 RCCU 检测到锁步不匹配,到 FCCU 故障处理,再到 Linux 内核报告,整个流程是怎样的?涉及哪些寄存器、中断、驱动程序或软件组件? 源代码和实现:在电路板支持包 48.0.0 中需要修改或启用哪些源文件、设备驱动程序、设备树条目或配置文件才能收集和报告此信息?NXP 是否提供现有的 GitHub 代码库、参考实现或示例代码来演示完整的流程? 锁步输入和输出:锁步机制的输入实际上比较的是什么?输入是由冗余的 A53 执行路径内部生成的,还是必须由软件配置或加载任何输入数据?相关配置在哪里执行?当出现不匹配情况时,软件可以检索到哪些诊断输出? 请提供相关的参考手册章节、源代码参考以及具体的实现流程,因为当前的电路板支持包文档对这些细节的解释不够充分。 Re: RCCU, FCCU, and Lockstep Diagnostic Data Flow on S32G3 感谢你的回复。我还想问最后一个问题。 Linux 电路板支持包。 48.0.0 用户手册描述了使用设备树属性(例如 `nxp,ncf_fault_list` 和 `nxp,ncf_actions`)配置 FCCU。 请问我们需要修改哪个源文件才能应用此配置?保存更改后,更改会通过设备树生效吗?还是我们还需要修改 FCCU 驱动程序? 如果可以,请提供 S32G378A-EVB3 的简单示例。 此致, 托安 Re: RCCU, FCCU, and Lockstep Diagnostic Data Flow on S32G3 你好, @Toan 谢谢你的帖子 1.FCCU 提供硬件接口来收集设备中检测到的故障信息,这是硬件行为,不同的故障编号反映不同的故障,您可以参考 S32G3 RM 中附加的故障映射文件。BSP48 中的 Linux FCCU 驱动程序允许更新 FCCU 中处理的非关键故障的选定列表,并使用设备树选择支持的 NCF 操作之一。如果响应集是警报,则警报信息为: 如果发生相应的故障,则将其打印在内核日志中。 2. 当 RCCU 检测到问题时,FCCU 将记录该问题,然后执行用户设置的操作,例如,如果将报警设置为操作,则可以在内核日志中找到相关信息,Linux FCCU 驱动程序、DTS、FCCU 报警中断处理程序将参与其中。 3. 相关信息可从 BSP48 UM 第 6 章中获得。 4.在锁步模式下,一个集群被视为主集群,另一个集群被视为校验集群。从软件角度来看,这两个集群在锁步模式下作为一个集群运行。Cortex-A53 Cluster0 是主执行集群,Cortex-A53 Cluster1 紧随其后执行。所有离开集群并发送到 MCU 其他部分的功能信号都由比较器 (RCCU) 进行监控,以确保复制资源的等效操作。任何被监控信号之间的操作偏差都会触发 FCCU 收到差异通知。 在 S32G3 A53 锁步模式下,软件不需要提供或加载锁步比较的输入数据。该比较由硬件在 A53 正常执行期间内部执行,对应用程序软件是透明的。 软件主要配置 Lockstep 操作模式,而不是对比数据。软件可以针对故障设置相应的操作。如果检测到不匹配,则会通过 RCCU/FCCU 功能安全故障机制报告,并执行相关操作。 BR 陈银
View full article
i.MX Security Features & Collateral Topic Link Comments Secure Boot  Secure Boot in AHAB enabled devices Applies to i.MX 8/8X/8XLite Family of Application Processors Extended to support i.MX 8ULP and i.MX 93 Family of Application Processors Secure boot - step-by-step guides for both HAB and AHAB enabled devices Secure Boot Automation -  Reference Design  Please switch to the latest BSP version for the updated guides. Security Reference Design - Yocto based Secure Boot automation Documentation at IMXLUG: Chapter "Security Reference Design" Secure Boot with i.MX 28 HAB Version 4 Applies to i.MX 28 Application Processor Secure boot in HABv4 enabled devices Applies to i.MX 6/7/8M Family of Application Processors Encrypted Boot  Encrypted boot App Note for HABv4 and CAAM enabled devices Applies to i.MX 6/7/8M Family of Application Processors Encrypted boot - step-by-step Guides for HAB enabled devices Encrypted boot - step-by-step Guides for AHAB enabled devices Link may not be updated with the latest BSP release. Please switch to the latest BSP or the required version. Security Training i.MX Security Training Various Security Training Workshops on older BSP releases.  NDA customers will need to request access from NXP. Secure Manufacturing Training Manufacturing Protection: Provision Sensitive Material in an Unsecure Environment Software Integrity and Data Confidentiality: Establishing Secure Boot and Chain of Trust on i.MX Processors This training explores the “Secure by Design” approach to software security for embedded systems using NXP i.MX processors - specifically, establishing secure boot and chain of trust  Securing Embedded Linux Devices: Pitfalls to Avoid This training session explores the proven best practices for designing and maintaining secure products, common security pitfalls & tips for hardening embedded Linux devices. Linux Kernel Security: Overview of Security Features and Hardening This training session explores how the Linux kernel's configuration can be strengthened to protect against security exploits. Essential Security Considerations for Edge Applications This training session introduces key features of embedded security, from secure boot and debug to lifecycle management. Code Signing Tool Latest Code Signing Tool Code Signing Tool (CST) package with complete source code and documentation. Using Code Signing Tool with Hardware Security Module Hardware Security Module backend exposed to extend the usage of CST with external HSM Using HSM mode for code signing in AHAB devices Using HSM mode for code signing in HAB devices  Offline HSM Code signing support for both HAB and AHAB based devices Secure Provisioning Tool (SPSDK) Latest SPSDK source code SPSDK source code Github repository Latest SPSDK documentation SPSDK readthedocs documentation covering Build/Installation, API, user guide and examples Supported MPU Devices - i.MX 8 ULP - i.MX 9 Family   Device specific examples : - i.MX 8ULP AHAB with U-BOOT - i.MX 95 AHAB with U-BOOT - i.MX 93 signed and encrypted AHAB image - i.MX 93 signed and encrypted AHAB image etc.. Examples such as: - secure boot/encrypted boot - secure debug - boot image build/deployment - Key creation/management EdgeLock Secure Enclave (ELE) Security Beyond the Edge | EdgeLock Secure Enclave  EdgeLock Secure EnclaveE API Reference Guide UG10186 EdgeLock Secure Enclave i.MX93 A1 User Guide UG10190 EdgeLock Secure Enclave i.MX95 B0 User Guide UG10404 V2X Secure Enclave i.MX95 B0 User Guide  The EdgeLock® Secure enclave is a preconfigured, self-managed and autonomous security subsystem that enables embedded developers to achieve their device security goals. User guides Available through - Secure Resources Secure Debug  Secure Debug on devices with JTAG controller Secure Debug on devices with JTAG controller and Authenticated Debug Module (ADM) Applies to i.MX 6/7/8M Family of Application Processors Applies to i.MX 8/8x Family of Application Processors   Secure Debug on ELE-AP based i.MX SoCs - New  AN14579 applies to i.MX 9 Family of Application Processors (ELE-AP) Extending the Root of Trust HABv4 RVT guidelines and recommendations  The HAB API allows the use of the HAB library to extend the root of trust and authenticate additional software images. This document describes system considerations when planning to make use of this API. HAB Persistent memory  HABv4 persistent memory address regions for various i.MX Application Processors HAB persistent memory is used by HAB to store logs. The base address and size are provided for each processor. OP-TEE i.MX Porting Guide - Configuring OP-TEE chapter Guide to OPTEE enablement on various i.MX devices can be requested for customers under NDA Getting Started with OP-TEE on i.MX Processors Webinar - Getting started with trusted execution environments (TEE) - OPTEE enablement on various i.MX devices  Secure  Updates Secure Over the Air Updates Source Code  ______________________________ Enabling SWUpdate on i.MX 6ULL, i.MX 8M Mini & i.MX 93 ______________________________  Secure Software Updates: Designing Ota Updates For Secure Embedded Linux Systems Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate ______________________________ SWUpdate is a Linux Update agent to provide an efficient and safe way to update an embedded Linux system. SWUpdate supports local and OTA updates, & multiple update strategies ___________________________ Webinar on Field updates of the software with Over-the-Air (OTA) Incremental updates, full OS updates. Signing of packages and update images, server authentication and other key considerations for securely deploying updates. Secure Manufacturing Manufacturing Protection App Note Manufacturing Protection Verification tool Secure Manufacturing Training Guidance to secure manufacturing in supported i.MX devices. Reference verification tool provided to authorize products with this feature enabled. Manufacturing Protection: Training on how to provision Sensitive Material in an Unsecure Environment Public Key Cryptography using CAAM Secure Key Strengthening Public Key Cryptography using CAAM Secure Key Source Code Leveraging the i.MX CAAM module to ensure the transfer of confidential data upon insecure channels using ECDSA secure keys Secure Storage i.MX Encrypted Storage Using CAAM Secure Keys Understanding SECO Secure Storage and Non-Volatile Memory Management  This document provides steps to run storage encryption at the block level using DM-Crypt taking advantage of the secure key feature. This document describes some of the key concepts related to the Security Controller secure storage and non-volatile memory management.  Securing Data Demo Application to Generate Red/Black Blobs Using CAAM and Encrypt/Decrypt Data Source Code This document provides instructions and steps on how to set up and run a demo application to generate both red and black key blobs and use them to encrypt and decrypt data. Enhanced OpenSSL using OP-TEE Enhanced OpenSSL on i.MX Processors  Source Code The purpose of this document is to describe how to add the support of accelerated OP-TEE OS with CAAM on top of OpenSSL.  On The Fly AES Decryption OTFAD App Note OTFAD Tool  OTFAD support in i.MX 7ULP Application Processor Tampering Application  Tampering Application on i.MX 7D SabreSD Board Source Code  The document describes the steps required for software configuration and physical setup for both passive and active tampering on i.MX 7D. Android™ Security User's Guide & User's Guide    Android Security User's Guide     Guide for customization work on security features supported by i.MX Android software. It provides an overview of the i.MX Android security features and it focuses on how to configure and use these security features. Android User's Guide      User Guide provides instructions for: • Downloading, patching, and building the software components that create the Android™ image. • Hardware/software configurations for programming the boot media and Building OTA update packages. i.MX Chip Lifecycle Transitioning the Chip Lifecycle to Field Return OEM This application note introduces the chip lifecycle concept. The document also describes how to move the chip lifecycle from the OEM Closed lifecycle to the Field Return OEM lifecycle with the SPSDK tool on EdgeLock Secure Enclave (Advanced Profile) (ELE-AP) based i.MX devices. i.MX Fuse Usage Fuse Usage on i.MX Devices  This application note covers fuse usage and various restrictions covering both  EdgeLock Secure Enclave (Advanced Profile) (ELE-AP) based i.MX devices and non-ELE based devices. i.MX ROMs Log Events i.MX ROMs Log Events This document describes the details of ROM log events for i.MX 6/7/8/9 series ROM.  Device Recovery  HABv4 closed device recovery using UUU Certain i.MX devices require the DCD pointer in IVT to be cleared before singing the recovery image. This document describes this procedure. EdgeLock 2GO  EdgeLock 2GO Services for MPU and MCU     EdgeLock 2GO Provisioning via Cloud Flow for MPUs This application note introduces various methods that the EdgeLock 2GO service can be used with MCU and MPU devices and the features available for each method. This document offers an outline of the EdgeLock 2GO platform and discusses the “Device provisioning via cloud” flow to connect the ELE based NXP devices to the EdgeLock 2GO cloud server.   Secure Elements Quick start guide for EdgeLock™ SE05x & i.MX 8M Quick start guide for EdgeLock™ SE050 & i.MX 6UltraLite Quick start guide for A71CH & i.MX 6UltraLite Ease ISA/IEC 62443 compliance with EdgeLock SE05x   Interfacing Secure Elements with the i.MX  Binding a host device to EdgeLock SE05x Binding MCUs with TrustZone® and Cryptographic Acceleration and Assurance Module (CAAM) to SE050x Secure Element Known Limitations & Guidelines Known limitations and guidelines document This page contains known limitations in various IPs with i.MX processors. i.MX Security Community  i.MX Security community page This is the parent page for various collateral related to security on i.MX Application Processors including public vulnerabilities Vulnerability Management Vigiles™ Software | NXP Vigiles is a Software Composition Analysis (SCA) tool that helps generate and analyze a Software Bill of Materials (SBOM) for publicly known cybersecurity vulnerabilities, particularly CVEs. Vigiles is optimized for embedded systems, and it provides a complete vulnerability lifecycle management tool.         Training: Best Practices for Triaging Common Vulnerabilities and Exposures (CVEs) in Embedded Systems | NXP Training: Introducing: Vigiles Training: Full Life-Cycle Security Maintenance of Embedded Linux BSPs Training: BSP Security Maintenance - Best Practices for Vulnerability Monitoring and Remediation i.MX Security Applications GitHub - i.MX Security Apps   GitHub for NXP Contains security applications like: - CAAM demo applications - Enhanced OpenSSL using OP-TEE - HSM SHE examples - Demo CAAM Blobs - Manufacturing protection verification tool Security Reference Manuals Link to Various i.MX Security Reference Manuals  Linux BSP Reference Manual Linux BSP and Reference Manuals   PQC Post-Quantum Cryptography  Post-Quantum Secure TLS 1.3 on Application MPUs | NXP Semiconductors Landing page with numerous Post-Quantum Cryptography resources and links to devices which support PQC This session delves into how post-quantum cryptography, hardware security modules (HSMs) and trusted platforms through the EdgeLock® Secure Enclave. Security Certification PSA Level 1: NXP PSA L1 Certified Products PSA Level 2: EdgeLock Secure Enclave  PSA Level 3: i.MX 93 EdgeLock Secure Enclave SESIP 1: i.MX 7ULP SESIP 2: EdgeLock Secure Enclave CAVP i.MX 8ULP AES i.MX 8ULP DRBG Please contact your NXP representative on the latest processor security certification status  CRA  & Security Compliance EU Cyber Resilience Act (CRA)  Ease CRA Compliance with i.MX 93  Ease ISA/IEC 62443-4-2 Compliance with i.MX 8ULP Ease ISA/IEC 62443-4-2 Compliance with i.MX 8XLite NXP is actively preparing for CRA implementation. This Web page gives an overview as part of this effort, NXP will provide clear statements outlining how our product families will comply with the applicable CRA classes. This document addresses OEMs who want to understand how i.MX 93 can facilitate the implementation of CRA requirements Describes how i.MX SoCs can be used to facilitate the implementation of ISA/IEC 62443-4-2 requirements. Security Blogs Securing Tomorrow: NXP’s Post-Quantum Cryptography Strategy U.S. Cyber Trust Mark: NXP Is Ready for the Paradigm Shift with EdgeLock® Assurance Program Securing Your Industrial Systems with IEC 62443 IoT Security Just Got Easier: EdgeLock 2GO Programming Partners Simplify Device Provisioning  This article explores how NXP’s portfolio enables seamless PQC adoption across new and existing products U.S. Cyber Trust Mark: Security Guidance for IoT Product Developers How NXP Supports Customers to Achieve 62443 Compliance EdgeLock 2GO service gives device OEMs a secure, simple and flexible way to provision and manage device credentials, over the entire lifecycle of the device. Security Whitepapers Security Primitives: Requirements in (I)IoT Systems  SECURING-INDUSTRIAL-IOT  Security Subsystems for System-on-Chip (SoC) Solutions   Functional Safety and Security: Essential and Complementary Disciplines for Modern Systems  The Emergence of Post-Quantum Cryptography  Post-Quantum Cryptography  A solution for 360 degree Industrial Internet Security/ABB-MSFT-NXP   
View full article
PQC合规性在发货后才发现为时已晚!从安全启动和固件更新的角度考虑量子攻击防护措施(日文博客) 继i.MX 94和i.MX 95之后,恩智浦半导体 (NXP) 发布了 MCX A5 系列,该系列产品在 ROM 中内置了安全引导加载程序,支持PQC(后量子加密)混合安全引导和安全固件更新。恩智浦半导体计划继续扩展其 PQC 兼容产品线。 恩智浦发布全新MCX A5 MCU,简化安全工业连接 | 恩智浦半导体 尽管量子计算机仍在开发中,而且使用量子计算机的具体攻击尚未开始,但现在采用内置 PQC 兼容安全引导加载程序的产品极其重要,特别是对于打算长期使用的设备,例如工业设备。 如果您打算稍后通过固件更新来解决该问题,那么您需要了解其中涉及的重大限制,以及在产品制造时需要采取哪些措施来确保符合 PQC 标准。 需要符合PQC规定的主要原因 以下是产品设计阶段就需要符合 PQC 标准的主要原因。 产品生命周期可能与量子计算机实际攻击的出现时间重叠 。工业设备、汽车设备、医疗设备等产品的使用寿命有时超过10年。如果这些产品在量子计算机真正普及之前就已经上市,那么市场届时就需要相应的应对措施。 “先获取后解密”意味着 现在获取的加密通信数据未来可以利用量子计算技术进行解密 。尤其对于需要长期保密的产品而言,攻击发生后再做出反应就为时已晚了。 资源需求可能非常庞大,而且以后很难解决。 根据具体算法的不同,PQC 算法可能比传统的 ECC/RSA 算法需要更高的资源(ROM、RAM、闪存、处理时间、功耗),这会增加后续实现的难度。如果您计划在未来支持 PQC,除了满足当前产品规格外,还需要从一开始就确保 PQC 所需的充足资源。 以上是一些常见的理由,但仅从以上内容来看,你可能会想:“如果处理的数据即使以后被解密也不会造成太大问题,那么现在就投入充足的资源进行设计,然后再通过固件更新添加 PQC 支持,岂不是更好吗?” 然而,实际上存在诸多限制。 由于固件更新,PQC 支持出现问题 后续PQC合规性的最大制约因素是: “第一条SBL(稍后详述)必须不可重写。” “固件更新镜像包含知识产权(IP)。” 这就是关键所在。 第一个 SBL(First SBL)与安全启动有关。 安全启动是一种重要的安全机制,它在启动固件之前通过签名验证来验证固件的完整性(固件未被损坏或篡改) 。 为此,需要一个安全引导加载程序 (SBL),它独立于被验证的固件而存在,在被验证的固件启动之前运行,并执行签名验证。 具体来说,系统启动后最先执行的SBL在此被称为第一SBL,并且该第一SBL必须是不可变的。至于原因,请参阅下文“第一SBL不得被覆盖”一节。 MCU 中的安全启动和安全(OTA)更新基础知识(日文博客) 换句话说,第一级系统认证机构(1st SBL)在产品出货时,如果固件验证算法仍采用ECC/RSA,而没有采用与PQC兼容的算法,那么之后再添加对PQC兼容算法的支持是不可能的。如果第一级系统认证机构的固件验证算法仍然是ECC/RSA,那么在量子计算机普及应用后,其签名存在被伪造的风险,恶意固件可能会被植入。 第二点是,即使产品本身处理的数据在之后被解密时不会造成重大问题,但产品的固件通常包含大量的知识产权(IP)。 如果固件更新镜像的加密算法不支持 PQC,则将来可能会因为固件更新镜像内容被解密而导致 IP 泄露的风险。 此外,如果固件更新映像的签名算法不支持 PQC,则存在固件更新映像的签名可能被伪造,从而加载恶意固件的风险。 基于以上所述,如果我们考虑未来对 PQC 的支持,那么可以合理地得出结论:至少在产品制造时,使用第一 SBL 的固件验证算法以及固件更新映像的签名和加密算法必须与 PQC 兼容。 NXP产品可以解决PQC合规性方面的挑战。 MCX A5 的启动 ROM 集成了 PQC 兼容的安全启动功能,使其可用作首个安全启动模块 (SBL)。此外,该启动 ROM 还支持 PQC 兼容的安全更新。与将 SBL 置于闪存相比,它还能减少所需的闪存容量。 将符合 PQC 标准的功能产品化需要验证密钥管理、签名基础设施、制造配置、OTA 更新、身份验证、性能评估和标准合规性,因此需要较长的准备时间。对于第一版 SBL 而言尤其如此,如前所述,第一版 SBL 无法更新,因此需要更加严格的验证。 截至撰稿时,MCX A5 尚未量产,目前正在进行认证,但其设计目标是获得 PSA 3 级和 SESIP 3 级第三方安全认证(NXP 已有多款产品获得 PSA/SESIP 认证)。认证完成后,我们将提供包括安全目标(一份定义评估目标、安全声明、要求、范围等的文件)在内的相关文档。 通过利用 MCX A5 的 PQC 兼容安全启动集成启动 ROM,以及 NXP 的工具集(例如MCUXpresso 安全配置工具和MCUXpresso SDK) ,我们可以减少 PQC 兼容安全启动和固件更新所需的实施和验证工作量。 选择SESIP 3级认证产品的关键要点 关于SESIP认证,需要注意的一点是,即使是获得SESIP 3级认证的产品,其认证所涵盖的功能范围也可能存在显著差异。因此,不仅要检查SESIP认证级别,还要仔细查看安全目标文档的内容,这一点至关重要。 认证产品的文档可从以下链接下载。 SESIP证书 - TrustCB 例如,在 NXP 的 SESIP Level 3 产品“MCX N94x / 54x / 23x SESIP 安全目标 Rev 1.1”中,图 3 显示认证范围不仅包括 SoC ROM(包括安全启动),还包括许多安全功能,例如EdgeLock ® 安全隔离区 (ELS S50) 。 虽然其他一些公司通过 SESIP 3 级认证的产品缺乏许多此类安全功能,但一些逻辑范围产品仅凭生命周期管理和内存保护功能就获得了 SESIP 3 级认证。   此外,NXP 的 SESIP 安全目标包括与 IEC 62443-4-2 等安全标准/法规的映射,可用于满足这些标准以及未来安全标准/法规中的类似要求。 截至撰写本文时,最新认证产品“i.MX RT700 SESIP 安全目标 Rev. 1.0”还包括与 CRA 的 EU 2024/2847 附件 I 基本网络安全要求的映射。 注:上述安全目标文档版本名称截至撰写本文时有效,但可能会有所更改。此外,SESIP 认证及其与安全标准/法规的映射并不能保证使用 NXP 产品的最终产品完全符合相关标准/法规。最终产品层面的集成以及必要的其他措施可能必不可少。 ========================= 我们目前无法回复此帖子“评论”部分留下的评论。 对于由此造成的不便,我们深表歉意,但在进行咨询时,请参考“ NXP 技术问题 - 如何联系我们(日语博客) ”。 (如果您已经是恩智浦的分销商或与恩智浦有合作关系,您可以直接咨询您的代表。) 继i.MX 94和i.MX 95之后,恩智浦半导体 (NXP) 发布了 MCX A5 系列,该系列产品在 ROM 中内置了安全引导加载程序,支持PQC(后量子加密)混合安全引导和安全固件更新。恩智浦半导体计划继续扩展其 PQC 兼容产品线。 恩智浦发布全新MCX A5 MCU,简化安全工业连接 | 恩智浦半导体 尽管量子计算机仍在开发中,而且使用量子计算机的具体攻击尚未开始,但现在采用内置 PQC 兼容安全引导加载程序的产品极其重要,特别是对于打算长期使用的设备,例如工业设备。 如果您打算稍后通过固件更新来解决该问题,那么您需要了解其中涉及的重大限制,以及在产品制造时需要采取哪些措施来确保符合 PQC 标准。 (阅读时间:10分钟) i.MX RT 处理器 i.MX 处理器 MCX 安全 日本博客
View full article
PQC対応は出荷後では遅い!セキュアブートとファームウェア・アップデートから考える耐量子対策 (日本語ブログ) i.MX 94およびi.MX 95に続き、MCXシリーズでも、PQC(Post-Quantum Cryptography:耐量子暗号)ハイブリッド対応のSecure BootとSecure Firmware UpdateをサポートするセキュアブートローダーをROMに内蔵したMCX A5ファミリが発表されました。NXPでは今後もPQC対応製品を拡充予定です。 NXP、セキュアな産業向けコネクティビティを簡素化する 新しいMCX A5 MCUを発表 | NXP Semiconductors 現時点では量子コンピューターは発展途上であり量子コンピューターによる具体的な攻撃がまだ始まっていなくても、PQC対応セキュアブートローダー内蔵製品を今から採用することは、特に産業機器など長期利用が想定される機器においては非常に重要です。 特にファームウェアアップデートによる後日の対応を検討されている場合、そこに存在する大きな制約と、製品製造時点でPQC対応のために行っておくべき内容を理解する必要があります。 PQC対応が必要とされる主な理由 製品設計時からPQC対応が必要とされる主な理由を3つ挙げます。 製品寿命が量子計算機による実用的攻撃の到来時期をまたぐ可能性がある 産業機器、車載機器、医療機器などは10年以上使われることがあります。量子コンピューターが実用化される時点で既に出荷済みだと、後から市場での対策が必要となります。 現在取得された暗号文を将来復号される可能性がある 「Harvest Now, Decrypt Later」により、現在取得された暗号化通信データが、将来の量子計算能力によって解析される可能性があります。特に長期機密性が必要な製品では、攻撃開始後に対応するのでは遅すぎます。 リソース要求が大きく後から対応困難な場合がある PQCアルゴリズムは方式によっては従来のECC/RSAよりもリソース要求(ROM、RAM、Flash、処理時間、電力)が大きいため、後からの対応が困難となる場合があります。将来のPQC対応を考えるなら、現在の製品仕様に合わせるだけでなく、PQC用のリソースの余裕を最初から確保する必要があります。 以上がよく語られる理由ですが、上記だけでは「取り扱うデータ自体は後で解読されてもさほど問題ない場合、現時点ではリソースに余裕を持たせた設計を行い、後でファームウェアアップデートでPQC対応をすればよいのでは?」と思われるかもしれません。 しかし現実には重要な制約があります。 ファームウェア・アップデートによるPQC対応の問題 後でPQC対応するための最大の制約は、 「1st SBL(後述)は書換不可とする必要がある」 「ファームウェアアップデートイメージは知的財産(IP)を含む」 という点です。 1つ目の1st SBLについてはセキュアブートと関連します。 セキュアブートはファームウェアを起動する前に署名検証によりファームウェアの完全性(破壊、改ざんがないこと)を検証したうえで起動する、セキュリティにおいて欠かせない仕組みです。 これを行うためには検証されるファームウェアとは独立して存在、検証対象ファームウェアの実行開始前に実行され、署名検証を行うセキュアブートローダー(Secure Bootloader : SBL)が必要です。 特にシステム起動後に最初に実行されるSBLのことをここでは1st SBLと呼びますが、この1st SBLは書換不可とする必要があります。その理由は以下記事の「1st SBLは書き換えられてはならない」の章を参照ください。 MCUにおけるセキュアブート、セキュア(OTA)アップデートの基本 (日本語ブログ) つまり製品出荷時の1st SBLによるファームウェア検証アルゴリズムをECC/RSAとしてPQC対応アルゴリズムは無し、後でPQC対応アルゴリズムの対応を追加する、という対応は不可能ということになります。1st SBLによるファームウェア検証アルゴリズムがECC/RSAのままだと、量子コンピューター実用化後はその署名を偽造され、不正ファームウェアを起動されるリスクがあります。 2つ目の点は、製品で取り扱うデータ自体は後で解読されてもさほど問題ない場合でも、一般には製品のファームウェアには一般に多くの知的財産(IP)が含まれるという点です。 ファームウェアアップデートイメージの暗号化アルゴリズムがPQC対応していない場合、将来ファームウェア更新イメージの内容を復号されることによるIP漏洩のリスクがあります。 またファームウェアアップデートイメージの署名アルゴリズムにPQC対応していない場合、ファームウェア更新イメージの署名を偽造されて不正なファームウェアをロードされるリスクもあります。 以上より、将来のPQC対応を考えるのであれば、最低でも1st SBLによるファームウェア検証アルゴリズム、ファームウェアアップデートイメージの署名・暗号化アルゴリズムは製品製造時点でPQCに対応する必要があると考えられます。 PQC対応の課題に対するNXP製品による解決 MCX A5のBoot ROMには、PQC対応セキュアブートの機能が統合されており、これを1st SBLとして使用できます。さらにこのBoot ROMにはPQC対応セキュア・アップデートをサポートする機能も含まれています。SBLをFlash上に配置する場合と比べ、必要なFlash容量も削減できます。 PQC対応機能の製品化には鍵管理、署名基盤、製造時プロビジョニング、OTA更新、認証、性能評価、規格対応などを検証する必要があり、長い準備期間が必要です。特に前述のとおり更新が不可能な1st SBLについてはより厳しい検証が必要となります。 MCX A5は本記事執筆時点では量産開始前であり、認証取得に向けた準備中ですが、PSA Level 3およびSESIP Level 3第三者セキュリティ認証取得を目標に設計されています(NXPではすでに多数の製品でPSA/SESIP認証取得の実績があります)。認証取得後は、Security Target(評価対象、セキュリティ主張、要求事項、スコープなどを定義する文書)を含む文書が提供されます。 MCX A5のPQC対応セキュアブート機能統合Boot ROMと、それと組み合わせて使用するMCUXpressoセキュア・プロビジョニング・ツールやMCUXpresso SDKといったNXPのツール群を活用することでPQC対応セキュアブートとファームウェア・アップデートの実装・検証工数の削減に寄与します。 SESIP Level 3認証製品選定のポイント SESIP認証について注意すべき点として、同じSESIP Level 3認証取得製品であっても製品によって認証のスコープに含まれる機能の範囲が大きく異なる場合があります。そのためSESIP認証のレベルだけでなくSecurity Target文書の内容を確認することが重要です。 認証取得済み製品の文書は以下からダウンロード可能です。 SESIP Certificates - TrustCB 例えばNXPのSESIP Level 3製品のうち「MCX N94x / 54x / 23x SESIP Security Target Rev 1.1」には以下「Fig 3. Logical Architecture and Certification Scope」に、Secure Boot含むSoC ROMだけでなく、EdgeLock ® セキュア・エンクレーブ(ELS S50)含む多数のセキュリティ機能がCertification Scopeに含まれていることが記載されています。 他社のSESIP Level 3認証製品の中にはこういったセキュリティ機能の多くが搭載されていない製品に対し、logical scopeはライフサイクル管理とメモリ保護機能のみとしてSESIP Level 3認証を取得している製品もあります。   また、NXPのSESIP Security TargetにはIEC 62443-4-2といったセキュリティ規格/規制に対するマッピングが含まれており、それらへの対応や将来のセキュリティ規格/規制内の類似した要求への対応にも活用可能です。 本記事執筆時点で最新の認証取得製品である「i.MX RT700 SESIP Security Target Rev. 1.0」にはCRAのEU 2024/2847 Annex I Essential Cybersecurity Requirementsに対するマッピングも含まれています。 注意 : 上記のSecurity Targetの文書バージョン名は本記事執筆時点のものであり、改定される可能性があります。また、SESIP認証およびセキュリティ規格/規制へのマッピングはNXP製品を使用した最終製品全体の規格/規制への適合を保証するものではありません。最終製品側での統合と、要求に応じて追加対策が必要となります。 ========================= 本投稿の「Comment」欄にコメントをいただいても、現在返信に対応しておりません。 お手数をおかけしますが、お問い合わせの際には「NXPへの技術質問 - 問い合わせ方法 (日本語ブログ)」をご参照ください。 (既に弊社NXP代理店、もしくはNXPとお付き合いのある方は、直接担当者へご質問いただいてもかまいません。) i.MX 94およびi.MX 95に続き、MCXシリーズでも、PQC(Post-Quantum Cryptography:耐量子暗号)ハイブリッド対応のSecure BootとSecure Firmware UpdateをサポートするセキュアブートローダーをROMに内蔵したMCX A5ファミリが発表されました。NXPでは今後もPQC対応製品を拡充予定です。 NXP、セキュアな産業向けコネクティビティを簡素化する 新しいMCX A5 MCUを発表 | NXP Semiconductors 現時点では量子コンピューターは発展途上であり量子コンピューターによる具体的な攻撃がまだ始まっていなくても、PQC対応セキュアブートローダー内蔵製品を今から採用することは、特に産業機器など長期利用が想定される機器においては非常に重要です。 特にファームウェアアップデートによる後日の対応を検討されている場合、そこに存在する大きな制約と、製品製造時点でPQC対応のために行っておくべき内容を理解する必要があります。 (読了:10分) i.MX RT Processors i.MX Processors MCX Security 日本語ブログ
View full article
PQC compliance is too late after shipment! Quantum-proofing measures considered from the perspective of secure boot and firmware updates (Japanese blog) Following the i.MX 94 and i.MX 95 , NXP has announced the MCX A5 family, which features a secure boot loader built into ROM that supports PQC ( Post-Quantum Cryptography) hybrid Secure Boot and Secure Firmware Update. NXP plans to continue expanding its range of PQC-compatible products. NXP Announces New MCX A5 MCU to Simplify Secure Industrial Connectivity | NXP Semiconductors Even though quantum computers are still under development and concrete attacks using quantum computers have not yet begun, adopting products with built-in PQC-compatible secure bootloaders now is extremely important, especially for equipment intended for long-term use, such as industrial equipment. If you are considering addressing the issue later through a firmware update, in particular, you need to understand the significant limitations involved and what needs to be done at the time of product manufacturing to ensure PQC compliance. Main reasons why PQC compliance is required Here are three main reasons why PQC compliance is required from the product design stage. Product lifecycles may overlap with the arrival of practical attacks by quantum computers . Industrial equipment, automotive equipment, medical equipment, etc., are sometimes used for more than 10 years. If these products have already been shipped by the time quantum computers become practical, countermeasures will be needed in the market afterward. "Harvest Now, Decrypt Later" means that encrypted communication data obtained now could be decrypted in the future using future quantum computing capabilities. Especially for products requiring long-term confidentiality, responding after an attack has begun is too late. Resource requirements can be very large and difficult to address later. Depending on the specific algorithm, PQC algorithms may have higher resource requirements (ROM, RAM, Flash, processing time, power) than conventional ECC/RSA algorithms, making later implementation difficult. If you plan to support PQC in the future, you need to ensure sufficient resources for PQC from the outset, in addition to meeting current product specifications. The above are the commonly cited reasons, but based on the above alone, you might think, "If the data being handled doesn't pose much of a problem even if it's deciphered later, wouldn't it be better to design it with ample resources at the moment and then add PQC support later with a firmware update?" However, in reality, there are significant constraints. Issues with PQC support due to firmware update The biggest constraint for later PQC compliance is, "The 1st SBL (described later) must be made unrewritable." "Firmware update images contain intellectual property (IP)." That's the point. The first SBL (First SBL) is related to Secure Boot. Secure Boot is an essential security mechanism that verifies the integrity of the firmware (that it has not been damaged or tampered with) through signature verification before starting the firmware. To do this, a Secure Bootloader (SBL) is required, which exists independently of the firmware being verified, runs before the firmware being verified starts, and performs signature verification. In particular, the SBL that is executed first after system startup is referred to here as the 1st SBL, and this 1st SBL must be immutable. For the reason why, please refer to the section "The 1st SBL must not be overwritten" in the following article. The basics of secure boot and secure (OTA) updates in MCUs (Japanese blog) In other words, it is impossible to use ECC/RSA as the firmware verification algorithm by the 1st SBL at the time of product shipment, without a PQC-compatible algorithm, and then add support for a PQC-compatible algorithm later. If the firmware verification algorithm by the 1st SBL remains ECC/RSA, there is a risk that its signature will be forged and malicious firmware will be launched after quantum computers become practical. The second point is that even if the data handled by the product itself is not a major problem when it is later deciphered, the product's firmware generally contains a lot of intellectual property (IP). If the encryption algorithm of the firmware update image does not support PQC, there is a risk of IP leakage in the future due to the decryption of the contents of the firmware update image. Furthermore, if the firmware update image's signature algorithm does not support PQC, there is a risk that the firmware update image's signature could be forged and malicious firmware could be loaded. Based on the above, if we are considering future PQC support, it is reasonable to conclude that at a minimum, the firmware verification algorithm using the 1st SBL and the signing and encryption algorithms for the firmware update image must be PQC-compatible at the time of product manufacturing. NXP products can solve the challenges of PQC compliance. The MCX A5's Boot ROM integrates PQC-compatible secure boot functionality, allowing it to be used as the 1st SBL. Furthermore, this Boot ROM also includes support for PQC-compatible secure updates. Compared to placing the SBL on Flash, it also reduces the required Flash capacity. Productizing PQC-compliant functionality requires verification of key management, signature infrastructure, manufacturing provisioning, OTA updates, authentication, performance evaluation, and standards compliance, necessitating a long preparation period. This is especially true for the 1st SBL, which, as mentioned earlier, cannot be updated, requiring even more rigorous verification. As of the time of writing, the MCX A5 is not yet in mass production and is in the process of obtaining certification, but it is designed with the goal of obtaining PSA Level 3 and SESIP Level 3 third-party security certifications (NXP already has a track record of obtaining PSA/SESIP certifications for many products). After certification is obtained, documentation including the Security Target (a document that defines the evaluation target, security claims, requirements, scope, etc.) will be provided. By utilizing the MCX A5's PQC-compatible secure boot integrated Boot ROM, along with NXP's toolset such as the MCUXpresso secure provisioning tool and MCUXpresso SDK , we can reduce the implementation and verification effort required for PQC-compatible secure boot and firmware updates. Key points for selecting SESIP Level 3 certified products One important point to note regarding SESIP certification is that even among products with the same SESIP Level 3 certification, the scope of functionality included in the certification can vary significantly from product to product. Therefore, it is crucial to check not only the SESIP certification level but also the contents of the Security Target document. Documentation for certified products can be downloaded from the link below. SESIP Certificates - TrustCB For example, in NXP's SESIP Level 3 product, "MCX N94x / 54x / 23x SESIP Security Target Rev 1.1," Fig. 3 shows that the Certification Scope includes not only the SoC ROM, including Secure Boot, but also numerous security features, including the EdgeLock ® Secure Enclave (ELS S50) . While some other companies' SESIP Level 3 certified products lack many of these security features , some logical scope products have obtained SESIP Level 3 certification with only lifecycle management and memory protection features.   Furthermore, NXP's SESIP Security Target includes mappings to security standards/regulations such as IEC 62443-4-2, which can be used to address these standards and similar requirements in future security standards/regulations. As of the time of writing this article, the latest certified product, "i.MX RT700 SESIP Security Target Rev. 1.0," also includes mapping to the CRA's EU 2024/2847 Annex I Essential Cybersecurity Requirements. Note: The document version names for Security Target mentioned above are current as of the time of writing and are subject to change. Furthermore, SESIP certification and mapping to security standards/regulations do not guarantee compliance with standards/regulations for the entire final product using NXP products. Integration at the final product level and additional measures as required may be necessary. ========================= We are currently unable to respond to comments left in the "Comment" section of this post. We apologize for the inconvenience, but please refer to " Technical Questions to NXP - How to Contact Us (Japanese Blog) " when making an inquiry. (If you are already an NXP distributor or have a relationship with NXP, you may ask your representative directly.) Following the i.MX 94 and i.MX 95 , NXP has announced the MCX A5 family, which features a secure boot loader built into ROM that supports PQC ( Post-Quantum Cryptography) hybrid Secure Boot and Secure Firmware Update. NXP plans to continue expanding its range of PQC-compatible products. NXP Announces New MCX A5 MCU to Simplify Secure Industrial Connectivity | NXP Semiconductors Even though quantum computers are still under development and concrete attacks using quantum computers have not yet begun, adopting products with built-in PQC-compatible secure bootloaders now is extremely important, especially for equipment intended for long-term use, such as industrial equipment. If you are considering addressing the issue later through a firmware update, in particular, you need to understand the significant limitations involved and what needs to be done at the time of product manufacturing to ensure PQC compliance. (Reading time: 10 minutes) i.MX RT Processors i.MX Processors MCX Security Japanese Blog
View full article
[MCX A153] ADC模块基础知识及使用方法(日语博客) 本文介绍了MCX A153中安装的ADC(模数转换器)模块的基本用法。首先通过ADC的应用示例,总结了其主要功能、模块结构和使用注意事项,然后介绍了如何使用SDK示例代码进行设备初始化,以及如何使用DMA传输ADC转换结果。 本文旨在帮助您了解在应用中使用 MCX A153 ADC 所需的基本原理,使您能够实现从 ADC 转换的初始设置到利用 DMA 进行高效数据传输的一切操作。   目录 1. 应用中的常见用例 1.1 主要用途 1.2 使用示例 2. MCX A153 ADC模块的主要功能和框图 2.1 概述 2.2 主要特点 2.3 方框图 3. 注意事项和限制 4. ADC 示例代码(设备初始化) 4.1 示例代码概述 4.2 打开 SDK 示例项目 4.3 宏观定义 4.4 设备初始化 5. 使用MCX A153 DMA传输AD转换值 5.1 与ADC相关的代码 5.2 DMA相关代码 总结 1. 应用中的常见用例 ADC 将来自传感器、电位器等的模拟信号(连续变化的电压)转换为微控制器可用于计算的数字值(数值)。 1.1 主要用途 将电位器输入的模拟电压值转换为数字值。 电位器安装在伺服电机(例如无线电遥控车辆中使用的伺服电机)的轴上,通过输出的变化来检测电机的旋转角度。 将来自各种传感器的模拟信号转换为数字值。 它通过转换来自加速度计的模拟信号来检测物体的倾斜度。例如,这可以用于检测智能手机的方向。 环境温度是通过转换温度传感器的模拟信号来测量的。   1.2 使用示例(以下示例旨在说明一般概念,因此省略了细节。) 电位器应用示例:         2. 主要功能和框图   2.1 概述 MCX A153 配备了一个 16 位模数转换器 (ADC)。ADC 是一种将模拟电压转换为数字值的电路。   2.2 主要特点 配备一个逐次逼近型AD转换器单元。 支持 16 位或 12 位分辨率和单端输入(更高的分辨率可以更精细地表示输入电压)。 已安装频道数量(因套餐而异): 64 引脚 LQFP 封装:24 通道,48 引脚 LQFP 封装:16 通道,48 引脚 HVQFN 封装:18 通道,32 引脚 HVQFN 封装:9 通道 采样率(每秒数据转换次数) 16 位模式:最高 3.2 Msps,12 位模式:最高 4 Msps 可以设置采样时间。 可在微控制器的低功耗模式下运行。 支持四种触发源(软件或硬件触发)。 七个命令缓冲区可以扫描连续通道。 支持比较功能(自动比较较小、较大、在范围内、超出范围,保存为匹配项等) 配备八个用于存储转换结果数据的FIFO,具有水印和溢出检测功能。 支持中断、DMA 和轮询。 校准功能 内置温度传感器,带专用输入通道   2.3 方框图 MCX A153 参考手册(MCXAP64M96FS3RM) 图 165。ADC框图摘录   SDK示例代码使用示例(连接电位器)     3. MCX A153 ADC 模块 本节解释了在使用 MCX A153 的 ADC 之前需要考虑的重要事项和限制。 16 位模式下的速度降低 MCX A153 的 ADC 支持两种模式:16 位(ENOB16:16 位有效分辨率)和 12 位(ENOB12:12 位有效分辨率)。但是,16 位模式的采样率低于 12 位模式。 (摘自MCX A153 数据手册表 34) 校准执行时间 校准请求和执行必须在复位或上电期间进行。此外,必须先配置时钟源和频率才能执行校准。 转化率结果的平均值 ADC模块可以在保存转换结果之前,对同一通道的多个结果进行平均。当CMDHa[AVGS]位域设置为非零值时,硬件平均功能启用。该功能可用于任何转换模式,并减轻软件计算平均值的负担。 4. AD转换示例代码 4.1 示例代码概述 主序列执行时,将进行设备初始化。设备初始化首先设置时钟、配置外部接口,并选择要连接到接口的外设。之后,初始化外设(ADC、UART)并启用中断。初始化过程完成后,循环内会设置一个软件触发信号以启动ADC转换,并在控制台上显示ADC转换值和转换次数。 硬件方面,我们将使用MCX A153开发板“FRDM-MCXA153”。   4.2 在 VS Code 中打开 ADC 示例项目的步骤 4.2.1 准备 VS Code 和扩展程序 安装 VS Code。 在扩展视图(Ctrl+Shift+X)中搜索“MCUXpresso for VS Code”并安装。 MCUXpresso 图标将出现在左侧的活动栏中。点击该图标即可打开快速入门面板。   4.2.2 安装依赖工具 在快速启动面板中运行“打开 MCUXpresso 安装程序”。 请选择并安装以下工具。 Arm GNU 工具链 CMake / Ninja Python / 西方 Git LinkServer(MCU-Link 的调试探针) SDK相关工具 完成后,重启 VS Code。   4.2.3整合 SDK 存储库 在快速入门面板中单击“导入存储库”。 选择“远程”作为数据导入源。   指定目标文件夹。路径应简短,且不得包含日文字符或空格。 您可以通过勾选“我同意”并按下“导入”按钮来导入存储库。   4.2.4 导入样品 在“快速入门面板”中,单击“从存储库导入示例”。 设置方法如下:   您可以点击“导入”按钮导入项目。 项目 设置值 存储库 步骤 3 中导入的 SDK (frdm_mcxa153) 工具链 Arm GNU 工具链 木板 frdmmcxa153 (FRDM-MCXA153) 模板 driver_examples → lpadc → interrupt(lpadc_interrupt) 地点 项目保存位置 姓名 可选(默认值为 lpadc_interrupt) 4.3 宏观定义 这是 ADC 功能的宏定义代码(摘自 lpadc\interrupt\app.h)。 请调整输入通道、分辨率设置和参考电压源,以匹配您的实际电路设计和预期用途。 定义 //(lpadc\interrupt\app.hから抜粋) /******************************************************************************/ #define DEMO_LPADC_BASE ADC0 //ADCのinstance、ベースアドレス、MCX A153は1個 ADCしかない #define DEMO_LPADC_IRQn ADC0_IRQn #define DEMO_LPADC_IRQ_HANDLER_FUNC ADC0_IRQHandler #define DEMO_LPADC_USER_CHANNEL 0U //チャンネル番号 #define DEMO_LPADC_USER_CMDID 1U //コマンドID #define DEMO_LPADC_VREF_SOURCE kLPADC_ReferenceVoltageAlt3 //参考電圧ソース #define DEMO_LPADC_DO_OFFSET_CALIBRATION true //オフセットキャリブレーションの利用可否 #define DEMO_LPADC_USE_HIGH_RESOLUTION true //高分解能の利用可否 与ADC相关的变量 变量 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) volatile bool g_LpadcConversionCompletedFlag = false; volatile uint32_t g_LpadcInterruptCounter = 0U; lpadc_conv_result_t g_LpadcResultConfigStruct; #if (defined(DEMO_LPADC_USE_HIGH_RESOLUTION) && DEMO_LPADC_USE_HIGH_RESOLUTION) //高分解能 const uint32_t g_LpadcFullRange = 65536U; const uint32_t g_LpadcResultShift = 0U; #else //低分解能 const uint32_t g_LpadcFullRange = 4096U; const uint32_t g_LpadcResultShift = 3U; #endif /* DEMO_LPADC_USE_HIGH_RESOLUTION */ ADC 配置结构的默认值(详情请参见 fsl_lpadc.c),转换结果的平均值。 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) LPADC_GetDefaultConfig(&mLpadcConfigStruct); mLpadcConfigStruct.enableAnalogPreliminary = true; //ADCアナログ回路は事前に有効化され、起動遅延なしで変換を実行する準備 #if defined(DEMO_LPADC_VREF_SOURCE) mLpadcConfigStruct.referenceVoltageSource = DEMO_LPADC_VREF_SOURCE; //参考電圧ソース #endif /* DEMO_LPADC_VREF_SOURCE */ #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS mLpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage; //変換結果平均化設定、平均しない/2回の平均/4回の平均/8回の平均/16回の平均....1024回の平均化選択可能 #endif     4.4 设备初始化     时钟分频比初始化 CLOCK_SetClockDiv 函数处理 ADC 外设使用的时钟分频设置。 //(lpadc\interrupt\hardware_init.cから抜粋) /* Attach peripheral clock */ CLOCK_SetClockDiv(kCLOCK_DivADC0, 1u); div_name:选择枚举定义的分频器。 值:除法比率 *以下代码是从 fsl_clock.c 开始的驱动程序部分,不建议用户修改。 //(fsl_clock.cから抜粋) void CLOCK_SetClockDiv(clock_div_name_t div_name, uint32_t value) { volatile uint32_t *pDivCtrl = (volatile uint32_t *)(MRCC0_BASE + (uint32_t)div_name); assert(div_name <= kCLOCK_DivMax); /* Unlock clock configuration */ SYSCON->CLKUNLOCK &= ~SYSCON_CLKUNLOCK_UNLOCK_MASK; /* halt and reset clock dividers */ *pDivCtrl = 0x3UL << 29U; if (value == 0U) /*!< halt */ { *pDivCtrl |= (1UL << 30U); } else { *pDivCtrl = (value - 1U); } /* Freeze clock configuration */ SYSCON->CLKUNLOCK |= SYSCON_CLKUNLOCK_UNLOCK_MASK; }   时钟选择 CLOCK_AttachClk 选择 ADC 外设要使用的四个时钟源之一。 驱动程序通过将 `clock_attach_id_t` 结构中定义的值作为参数传递给 `void CLOCK_AttachClk(clock_attach_id_t connection)` 函数来配置连接。 //(fsl_clock.hから抜粋) kFRO12M_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 0U), /* Attach FRO12M to ADC0. */ kFRO_HF_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 1U), /* Attach FRO_HF to ADC0. */ kCLK_IN_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 3U), /* Attach CLK_IN to ADC0. */ kCLK_1M_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 5U), /* Attach CLK_1M to ADC0. */ kNONE_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 7U), /* Attach NONE to ADC0. */ //(lpadc\interrupt\hardware_init.cから抜粋) CLOCK_AttachClk(kFRO12M_to_ADC0); 以下函数是 SDK 提供的驱动程序部分的一部分,从 fsl_clock.c 开始,不建议用户修改它们。 //(fsl_clock.hから抜粋) void CLOCK_AttachClk(clock_attach_id_t connection) { const uint32_t reg_offset = CLK_ATTACH_REG_OFFSET(connection); const uint32_t clk_sel = CLK_ATTACH_CLK_SEL(connection); if (kNONE_to_NONE != connection) { CLOCK_SetClockSelect((clock_select_name_t)reg_offset, clk_sel); } } //(fsl_clock.hから抜粋) void CLOCK_SetClockSelect(clock_select_name_t sel_name, uint32_t value) { volatile uint32_t *pClkCtrl = (volatile uint32_t *)(MRCC0_BASE + (uint32_t)sel_name); assert(sel_name <= kCLOCK_SelMax); if (sel_name == kCLOCK_SelSCGSCS) { SCG0->RCCR = (SCG0->RCCR & ~(SCG_RCCR_SCS_MASK)) | SCG_RCCR_SCS(value); while ((SCG0->CSR & SCG_CSR_SCS_MASK) != SCG_CSR_SCS(value)) { } } else { /* Unlock clock configuration */ SYSCON->CLKUNLOCK &= ~SYSCON_CLKUNLOCK_UNLOCK_MASK; *pClkCtrl = value; /* Freeze clock configuration */ SYSCON->CLKUNLOCK |= SYSCON_CLKUNLOCK_UNLOCK_MASK; } } 关于电路板初始化功能 时钟将被初始化。   引脚初始化 调用 InitPins() 函数,并处理 pin_mux.c 文件。pin_mux.c 文件由 NXP 的 MCUXPresso 使用。可以使用集成到 IDE 中的引脚配置工具来覆盖此设置。 //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitPins(); BOARD_InitPins() 函数执行四个操作。 启用外围时钟 禁用外围设备复位 外部引脚对引脚和外设连接(MUX 配置)-> 结构体参数设置 在登记簿中写入 3   初始化启动时钟 MCX A153 支持中等驱动模式和标准驱动模式。这两种模式分别对应 1.0 V 和 1.1 V 的 VDD_CORE 电压,以及 48 MHz 或 96 MHz 的 rfo_hf 时钟频率。切换模式需要外部电源,并且需要配置与电压相关的寄存器,例如 LDO。 //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitBootClocks(); 时钟是通过与工作频率相对应的寄存器设置功能来设置的。 //(fsl_clock.cから抜粋) void BOARD_InitBootClocks(void) { BOARD_BootClockFRO96M(); }     初始化调试端口 //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitDebugConsole();   //(board.cから抜粋) void BOARD_InitDebugConsole(void) { /* attach 12 MHz clock to LPUART0 (debug console) */ CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u); CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH); RESET_PeripheralReset(BOARD_DEBUG_UART_RST); DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, BOARD_DEBUG_UART_CLK_FREQ); }   应用程序初始化 ADC 初始化在 LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct) 函数中处理。LPADC_Init() 函数位于 fsl_lpadc.c 的驱动程序部分。 DEMO_LPADC_BASE:0x400A_F000 -> ADC 的起始地址 定义结构表并配置ADC。 typedef struct {} lpadc_config_t 姓名 属性 说明 lpadc_config_t 类型 LPADC配置参数信息 启用休眠模式 布尔值 ADC转换期间的操作设置基于模式 转换平均模式 lpadc_conversion_average_mode_t 与自动校准相关的设置 启用模拟初步 布尔值 ADC启动前设置 上电延迟 uint32_t ADC电路的稳定时间 参考电压源 lpadc_reference_voltage_source_t 参考电压源 功率级别模式 lpadc_power_level_mode_t 电源配置选择 触发优先级策略 lpadc_trigger_priority_policy_t 如何处理高利润触发因素 启用会话暂停 布尔值 设置 AD 转换执行间隔。 对话暂停延迟 uint32_t 命令序列期间的暂停时间 先进先出水印 uint32_t FIFO 中数据点数量的阈值设置。 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct); //(fsl_lpadc.cから抜粋) void LPADC_Init(ADC_Type *base, const lpadc_config_t *config) { /* 省略 */ base->CTRL |= ADC_CTRL_CAL_AVGS(config->conversionAverageMode); /* 省略 */ }   关于ADC校准   在使用模数转换器 (ADC) 之前,需要进行校准以校正转换结果中包含的偏移误差和其他因素,从而提高模数转换的精度。 校准过程大致可分为以下两个阶段: 设置校准模式和条件。 执行校准并将校正值应用于ADC。   在默认示例中,ADC 校准在执行完 LPADC_Init() 之后、AD 转换开始之前进行。首先,使用 LPADC_SetOffsetCalibrationMode() 在相应的器件上设置偏移校准模式。然后,如果启用了 DEMO_LPADC_DO_OFFSET_CALIBRATION,则执行 LPADC_DoOffsetCalibration();否则,使用预先通过 LPADC_SetOffsetValue() 设置的偏移值。 此外,如果启用了相应的函数宏,则在延迟 1 µs 或更长时间后执行 LPADC_DoAutoCalibration() 函数。该函数用于校准增益误差和线性误差。仅当器件支持的功能宏启用时,才会编译相应的进程。 以下是LPADC校准模式的设置。 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) /* Request LPADC calibration. */ #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE LPADC_SetOffsetCalibrationMode(DEMO_LPADC_BASE, DEMO_LPADC_OFFSET_CALIBRATION_MODE); #endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE */     执行偏移校准 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFS) && \ FSL_FEATURE_LPADC_HAS_CTRL_CALOFS #if defined(DEMO_LPADC_DO_OFFSET_CALIBRATION) && \ DEMO_LPADC_DO_OFFSET_CALIBRATION L PADC_DoOffsetCalibration(DEMO_LPADC_BASE); //キャリブレーションを実行しない場合 #else /* Update OFSTRIM register manually. */   5. MCX A153 DMA 为什么ADC转换要使用DMA传输? 当仅通过软件处理ADC采集的数据时,CPU需要监控ADC转换的完成情况,读取转换结果并将其写入内存。对于单次ADC转换而言,这并非主要问题;但当以固定间隔连续采样或处理多个输入通道时,此过程会反复发生。因此,CPU的处理负载会增加,从而可能减少可用于其他应用程序处理的时间。 解决此问题的一种方法是使用 DMA(直接内存访问)传输 ADC 转换结果。使用 DMA,ADC 转换完成后,转换结果可以自动传输到内存。换句话说,由于从获取 ADC 转换结果到将其存储到内存的过程可以由硬件处理,因此可以减少 CPU 执行的数据传输处理量,从而降低软件的处理负载。 鉴于以上原因,ADC和DMA的组合配置常用于需要连续模数转换和高速数据采集的应用中。本文将首先介绍ADC的基本初始化方法,然后介绍如何使用MCX A153通过DMA将ADC转换结果传输到存储器。 使用DMA进行AD转换值传输概述 AD转换后的数据存储在ADC外设的缓冲区中。ADC无需每次都手动读取数据,而是可以通过DMA传输数据。例如,程序可以修改为连续执行五次AD转换,然后通过DMA将数据保存到RAM缓冲区,并在控制台上显示平均值、最小值和最大值。 使用DMA传输AD转换值的步骤 我们将修改ADC示例代码,添加DMA处理功能。 DMA 激活是通过来自 ADC 的 DMA 请求信号执行的。 使用 DMA,将 ADC FIFO 值(5 次转换)复制到 RAM,并向 CPU 发出中断通知。 CPU 在 DMA 传输完成后,在主循环中取平均值,并将最小值、最大值和平均值显示在控制台上。     防范措施 要添加 DMA 代码,您需要将 DMA 驱动程序头文件和源代码添加到您的项目中。最简单的方法是从 MCUXpresso IDE 创建一个示例 DMA 代码 (frdmmcxa153_edma3_memory_to_memory_transfer) 并复制它。只需从 drivers 目录复制以下文件即可。 fsl_edma_core.h fsl_edma_soc.c fsl_edma_soc.h fsl_edma.c fsl_edma.h   5.1 与ADC相关的代码修改和新增   代码修改步骤 ADC转换完成后发生的中断已被禁用。 添加了ADC配置。 设置为连续执行 5 次 AD 转换。 启用DMA请求 将先进先出 (FIFO) 水印设置为 4。 增加了处理功能,以获取 DMA 传输值的平均值、最小值和最大值,并将它们输出到控制台。     1. 当ADC转换完成后,禁用中断。 由于中断使能寄存器 (IE) 是通过 LPADC_EnableInterrupts() 函数和 kLPADC_FIFOWatermarkInterruptEnable 启用的,因此我们将注释掉这一行。 // LPADC_EnableInterrupts(DEMO_LPADC_BASE, kLPADC_FIFOWatermarkInterruptEnable);   2. 添加ADC配置 ADC 配置为循环 5 次(= 5 次 AD 转换)。 mLpadcCommandConfigStruct.loopCount = 4 //loopCount +1回の変換 启用DMA请求 //178行目 LPADC_EnableFIFOWatermarkDMA(DEMO_LPADC_BASE, 1); // 1でDMA Requestがイネーブル     3. 将先进先出 (FIFO) 中的水印级别数设置为 4。 // 33行目 /* ++ ADCのマクロ */ #define FIFO0WatermarkLEVEL (4) //108行目 mLpadcConfigStruct.FIFOWatermark = FIFO0WatermarkLEVEL;   4. 增加了处理,以获取 DMA 传输的值和控制台输出的平均值、最小值和最大值。 uint32_t adc_values[5] = {0}; PRINTF("Please press any key to get user channel's ADC value.\r\n"); while(1) { GETCHAR(); EXAMPLE_DMA_BASEADDR->CH[0].CH_CSR = DMA_CH_CSR_ERQ(1); EXAMPLE_DMA_BASEADDR->CH[0].TCD_DLAST_SGA = -0x14; LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U is trigger0 mask. */ while (!g_Transfer_Done) { /* DMA転送終了割り込み待ち */ } g_Transfer_Done = false; uint16_t min=adc_values[0]; uint16_t max=adc_values[0]; uint32_t sum=0; for(uint32_t i=0; i<5; i++) { if(max < (0x0000FFFF & adc_values[i])) max = adc_values[i]; if(min > (0x0000FFFF & adc_values[i])) min = adc_values[i]; sum += 0x0000FFFF & adc_values[i]; } PRINTF("ADC Min: %d, Max: %d, ave: %d\r\n", min, max, sum/5); for(size_t i=0; i<5; i++) { adc_values[i] = 0; } sum = 0; }   5.2 添加DMA相关代码   代码添加政策 包含头文件 添加了与DMA相关的宏。 DMA配置和初始化 DMA传输配置 DMA传输完成中断处理   1. 包含标题 // 10行目 #include "fsl_debug_console.h" #include "pin_mux.h" #include "clock_config.h" #include "board.h" #include "fsl_lpadc.h" /* ++ */ #include "fsl_edma.h" // DMAドライバヘッダファイルの追加 #include "fsl_clock.h" #include "fsl_reset.h"   2. 添加与 DMA 相关的宏。 // 32行目 #define EXAMPLE_DMA_BASEADDR DMA0 #define DEMO_DMA_CHANNEL_0 0U #define APP_DMA_IRQ DMA_CH0_IRQn #define APP_DMA_IRQ_HANDLER DMA_CH0_IRQHandler     3. DMA配置 // 197行目 edma_transfer_config_t transferConfig; edma_config_t userConfig; // 203行目 RESET_PeripheralReset(kDMA_RST_SHIFT_RSTn); /* Configure EDMA channel for one shot transfer */ EDMA_GetDefaultConfig(&userConfig); EDMA_Init(EXAMPLE_DMA_BASEADDR, &userConfig);     4. DMA传输配置 // 209行目 EDMA_PrepareTransfer(&transferConfig, (void *)0x400AF300, // eDMA transfer source address. sizeof(uint32_t), // eDMA transfer source address width(bytes) (void *)adc_values, // eDMA transfer destination address sizeof(&adc_values), // eDMA transfer destination address width(bytes) sizeof(adc_values), // eDMA transfer bytes per channel request sizeof(adc_values), // eDMA transfer bytes to be transferred kEDMA_PeripheralToMemory // eDMA transfer type ); EDMA_SetTransferConfig(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, &transferConfig, NULL); EDMA_SetChannelMux(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kDma0RequestMuxAdc0FifoRequest); EnableIRQ(APP_DMA_IRQ); EDMA_EnableChannelInterrupts(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kEDMA_MajorInterruptEnable); 在用软件触发启动软件 ADC 之前,添加 EDMA_TriggerChannelStart() 以在 DMA 通道 0 上触发中断。当 DMA 中断标志被清除时,DMA 触发的中断将被禁用,因此该处理是在 ADC 的软件触发之前添加的。 // 242行目 while(1) { GETCHAR(); EDMA_TriggerChannelStart(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0); EXAMPLE_DMA_BASEADDR->CH[0].TCD_DLAST_SGA = -0x14; LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U is trigger0 mask. */ while (!g_Transfer_Done) { /* DMA転送終了割り込み待ち */ } g_Transfer_Done = false;   5. DMA传输完成中断处理 void APP_DMA_IRQ_HANDLER(void) { if ((EDMA_GetChannelStatusFlags(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0) & kEDMA_InterruptFlag) != 0U) { EDMA_ClearChannelStatusFlags(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kEDMA_InterruptFlag); g_Transfer_Done = true; } } 概括: 本文介绍了MCX A153 ADC的基本功能和注意事项,以及如何使用VS Code SDK的ADC示例项目进行初始化和转换。阅读本文后半部分,您将看到一些配置示例和代码流程,这些内容在实际开发中非常有用,涵盖了从使用ADC示例进行初始化和转换,到使用DMA自动传输转换结果等各个环节。(建议您先运行ADC示例并确认其运行正常,然后再添加DMA,这样更容易排查问题。) =========================​ 我们目前无法 回复 此帖子“ 评论”部分留下的评论。 对于由此造成的不便,我们深表歉意,但在进行咨询时,请参考“ NXP技术问题-如何联系我们(日语博客) ”。 (如果您已经是 恩智浦的 分销商或 与 恩智浦 有合作关系 ,您可以直接咨询您的代表。 ) 本文全面讲解了MCX A153中ADC(模数转换器)的基础知识,包括如何使用MCUXpresso SDK进行初始化,以及如何使用DMA自动传输转换结果。如果您是第一次使用ADC或DMA,建议您先阅读第1章和第2章,了解整体概念,然后再阅读第4章的示例代码和第5章的DMA设置,以便更好地理解。 ADC:一种将模拟信号(例如来自传感器的信号)转换为微控制器可以处理的数字值的功能。 DMA:一种无需经过 CPU 即可在外围设备和内存之间传输数据的功能。 SDK:包含软件开发所需的驱动程序和示例代码的开发工具包。 (阅读时间:30分钟) 通用微控制器 介绍 MCUXpresso IDE MCUXpresso SDK 日本博客
View full article
[MCX A153] Basics and Usage of the ADC Module (Japanese Blog) This article explains the basic usage of the ADC (Analog-to-Digital Converter) module installed in the MCX A153 . Starting with application examples using the ADC, it summarizes the main functions, block structure, and points to note when using it, and then introduces device initialization using SDK sample code and how to transfer ADC conversion results using DMA. This article aims to help you understand the fundamentals required when using the MCX A153 ADC in your applications, enabling you to implement everything from initial setup for ADC conversion to efficient data transfer utilizing DMA.   table of contents 1. Common use cases in applications 1.1 Main Uses 1.2 Usage example 2. Main functions and block diagram of the MCX A153 ADC module 2.1 Overview 2.2 Main Features 2.3 Block Diagram 3. Points to note and restrictions 4. ADC Sample Code (Device Initialization) 4.1 Overview of Sample Code 4.2 Opening the SDK Sample Project 4.3 Macro Definitions 4.4 Device Initialization 5. Transfer of AD conversion values using MCX A153 DMA 5.1 Code related to ADC 5.2 DMA-related code summary 1. Common use cases in applications An ADC converts analog signals (continuously changing voltages) input from sensors, potentiometers, etc., into digital values (numerical values) that a microcontroller can use for calculations. 1.1 Main Uses Converts the analog voltage value input from the potentiometer to a digital value. A potentiometer is attached to the shaft of a servo motor, such as those used in radio-controlled vehicles, to detect the angle of rotation of the motor from the change in output. Convert analog signals from various sensors into digital values. It detects the tilt of an object by converting analog signals from an accelerometer. This can be applied to detecting the orientation of a smartphone, for example. The ambient temperature is measured by converting the analog signal from the temperature sensor.   1.2 Usage Examples (These are examples illustrating the general concept, so details are omitted.) Examples of potentiometer usage:         2. Main Functions and Block Diagram   2.1 Overview The MCX A153 is equipped with a 16-bit analog-to-digital converter (ADC). An ADC is a circuit that converts analog voltages into digital values.   2.2 Main Features Equipped with one successive approximation AD converter unit. Supports 16-bit or 12-bit resolution and single-ended input (higher resolution allows for finer representation of input voltage). Number of channels installed (varies depending on the package): 64-pin LQFP: 24 channels, 48-pin LQFP: 16 channels, 48-pin HVQFN: 18 channels, 32-pin HVQFN: 9 channels Sampling rate (how many times per second the data can be converted) 16-bit mode: up to 3.2 Msps, 12-bit mode: up to 4 Msps Sample time can be set. Can operate in low-power mode of the microcontroller. Supports four trigger sources (software or hardware triggers). Seven command buffers enable scanning of consecutive channels. Supports compare function (automatically compares smaller, larger, within range, outside range, save as match, etc.) Equipped with eight FIFOs for conversion result data, featuring watermark and overflow detection functions. Supports interrupts, DMA, and polling. Calibration function Built-in temperature sensor with dedicated input channel   2.3 Block Diagram MCX A153 Reference Manual (MCXAP64M96FS3RM) Figure 165. Excerpt from ADC block diagram   Example of using SDK sample code (connecting a potentiometer)     3. MCX A153 ADC Module This section explains important points and limitations to consider before using the MCX A153's ADC. Speed reduction in 16-bit mode The MCX A153's ADC supports two modes: 16-bit (ENOB16: 16-bit effective resolution) and 12-bit (ENOB12: 12-bit effective resolution). However, the 16-bit mode has a lower sampling rate than the 12-bit mode. (Excerpt from MCX A153 DataSheet Table.34) Timing of calibration execution Calibration requests and execution must be performed during reset or power-on. Furthermore, the clock source and frequency must be configured before calibration can be performed. Averaging of conversion results The ADC module can average multiple results for the same channel before saving the conversion result. The hardware averaging function is enabled when the CMDHa[AVGS] bit field is set to a non-zero value. It can be used in any conversion mode and reduces the burden of calculating the average in software. 4. Sample code for AD conversion 4.1 Overview of Sample Code When the main sequence is executed, device initialization is performed. Device initialization begins with setting the clock, configuring the external terminals, and selecting the peripherals to connect to the terminals. After that, the peripherals (ADC, UART) are initialized and interrupts are enabled. After the initialization process, a software trigger is set within the loop to start ADC conversion, and the AD conversion value and the number of conversions are displayed on the console. For hardware, we will use the MCX A153 development board "FRDM-MCXA153".   4.2 Steps to open the ADC sample project in VS Code 4.2.1 Preparing VS Code and Extensions Install VS Code. Search for "MCUXpresso for VS Code" in the Extensions view (Ctrl+Shift+X) and install it. The MCUXpresso icon will appear in the activity bar on the left. Click it to open the QUICKSTART PANEL.   4.2.2 Installing Dependent Tools Run "Open MCUXpresso Installer" in the QUICKSTART PANEL. Select and install the following tool. Arm GNU Toolchain CMake / Ninja Python / West Git LinkServer (Debug probe for MCU-Link) SDK-related tools After completion, restart VS Code.   4.2.3Incorporating the SDK repository Click "Import Repository" in the QUICKSTART PANEL. Select "Remote" as the source for importing data.   Specify the destination folder. The path should be short and should not contain Japanese characters or spaces. You can import the repository by checking "I agree" and pressing the Import button.   4.2.4 Importing Samples In the QUICKSTART PANEL, click "Import Example from Repository". Set it as follows:   You can import the project by clicking the Import button. item Set value Repository The SDK (frdm_mcxa153) imported in step 3 Toolchain Arm GNU Toolchain Board frdmmcxa153 (FRDM-MCXA153) Template driver_examples → lpadc → interrupt(lpadc_interrupt) Location Project save location Name Optional (default is lpadc_interrupt) 4.3 Macro Definitions This is the macro definition code for the ADC's functions (excerpted from lpadc\interrupt\app.h). Please adjust the input channels, resolution settings, and reference voltage sources to match your actual circuit design and intended use. Definitions //(lpadc\interrupt\app.hから抜粋) /******************************************************************************/ #define DEMO_LPADC_BASE ADC0 //ADCのinstance、ベースアドレス、MCX A153は1個 ADCしかない #define DEMO_LPADC_IRQn ADC0_IRQn #define DEMO_LPADC_IRQ_HANDLER_FUNC ADC0_IRQHandler #define DEMO_LPADC_USER_CHANNEL 0U //チャンネル番号 #define DEMO_LPADC_USER_CMDID 1U //コマンドID #define DEMO_LPADC_VREF_SOURCE kLPADC_ReferenceVoltageAlt3 //参考電圧ソース #define DEMO_LPADC_DO_OFFSET_CALIBRATION true //オフセットキャリブレーションの利用可否 #define DEMO_LPADC_USE_HIGH_RESOLUTION true //高分解能の利用可否 Variables related to ADC Variables //(lpadc\interrupt\lpadc_interrupt.cから抜粋) volatile bool g_LpadcConversionCompletedFlag = false; volatile uint32_t g_LpadcInterruptCounter = 0U; lpadc_conv_result_t g_LpadcResultConfigStruct; #if (defined(DEMO_LPADC_USE_HIGH_RESOLUTION) && DEMO_LPADC_USE_HIGH_RESOLUTION) //高分解能 const uint32_t g_LpadcFullRange = 65536U; const uint32_t g_LpadcResultShift = 0U; #else //低分解能 const uint32_t g_LpadcFullRange = 4096U; const uint32_t g_LpadcResultShift = 3U; #endif /* DEMO_LPADC_USE_HIGH_RESOLUTION */ Defaulting of the ADC configuration structure (details can be found in fsl_lpadc.c), averaging of conversion results. //(lpadc\interrupt\lpadc_interrupt.cから抜粋) LPADC_GetDefaultConfig(&mLpadcConfigStruct); mLpadcConfigStruct.enableAnalogPreliminary = true; //ADCアナログ回路は事前に有効化され、起動遅延なしで変換を実行する準備 #if defined(DEMO_LPADC_VREF_SOURCE) mLpadcConfigStruct.referenceVoltageSource = DEMO_LPADC_VREF_SOURCE; //参考電圧ソース #endif /* DEMO_LPADC_VREF_SOURCE */ #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS mLpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage; //変換結果平均化設定、平均しない/2回の平均/4回の平均/8回の平均/16回の平均....1024回の平均化選択可能 #endif     4.4 Device Initialization     Initialization of clock division ratio The CLOCK_SetClockDiv function handles the clock division settings used by the ADC peripheral. //(lpadc\interrupt\hardware_init.cから抜粋) /* Attach peripheral clock */ CLOCK_SetClockDiv(kCLOCK_DivADC0, 1u); div_name: Select a frequency divider defined by the enumeration. value: division ratio *The following code is the driver section starting with fsl_clock.c, and user modification is not recommended. //(fsl_clock.cから抜粋) void CLOCK_SetClockDiv(clock_div_name_t div_name, uint32_t value) { volatile uint32_t *pDivCtrl = (volatile uint32_t *)(MRCC0_BASE + (uint32_t)div_name); assert(div_name <= kCLOCK_DivMax); /* Unlock clock configuration */ SYSCON->CLKUNLOCK &= ~SYSCON_CLKUNLOCK_UNLOCK_MASK; /* halt and reset clock dividers */ *pDivCtrl = 0x3UL << 29U; if (value == 0U) /*!< halt */ { *pDivCtrl |= (1UL << 30U); } else { *pDivCtrl = (value - 1U); } /* Freeze clock configuration */ SYSCON->CLKUNLOCK |= SYSCON_CLKUNLOCK_UNLOCK_MASK; }   Clock selection CLOCK_AttachClk selects one of four clock sources to be used by the ADC peripheral. The driver configures the connection by passing a value defined in the `clock_attach_id_t` structure as an argument to the `void CLOCK_AttachClk(clock_attach_id_t connection)` function. //(fsl_clock.hから抜粋) kFRO12M_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 0U), /* Attach FRO12M to ADC0. */ kFRO_HF_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 1U), /* Attach FRO_HF to ADC0. */ kCLK_IN_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 3U), /* Attach CLK_IN to ADC0. */ kCLK_1M_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 5U), /* Attach CLK_1M to ADC0. */ kNONE_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 7U), /* Attach NONE to ADC0. */ //(lpadc\interrupt\hardware_init.cから抜粋) CLOCK_AttachClk(kFRO12M_to_ADC0); The following functions are part of the driver section provided by the SDK, starting with fsl_clock.c, and it is not recommended that users modify them. //(fsl_clock.hから抜粋) void CLOCK_AttachClk(clock_attach_id_t connection) { const uint32_t reg_offset = CLK_ATTACH_REG_OFFSET(connection); const uint32_t clk_sel = CLK_ATTACH_CLK_SEL(connection); if (kNONE_to_NONE != connection) { CLOCK_SetClockSelect((clock_select_name_t)reg_offset, clk_sel); } } //(fsl_clock.hから抜粋) void CLOCK_SetClockSelect(clock_select_name_t sel_name, uint32_t value) { volatile uint32_t *pClkCtrl = (volatile uint32_t *)(MRCC0_BASE + (uint32_t)sel_name); assert(sel_name <= kCLOCK_SelMax); if (sel_name == kCLOCK_SelSCGSCS) { SCG0->RCCR = (SCG0->RCCR & ~(SCG_RCCR_SCS_MASK)) | SCG_RCCR_SCS(value); while ((SCG0->CSR & SCG_CSR_SCS_MASK) != SCG_CSR_SCS(value)) { } } else { /* Unlock clock configuration */ SYSCON->CLKUNLOCK &= ~SYSCON_CLKUNLOCK_UNLOCK_MASK; *pClkCtrl = value; /* Freeze clock configuration */ SYSCON->CLKUNLOCK |= SYSCON_CLKUNLOCK_UNLOCK_MASK; } } Regarding the board initialization function The clock will be initialized.   Pin initialization The InitPins() function is called, and the pin_mux.c file is processed. The pin_mux.c file is used by NXP's MCUXPressoThis can be overridden using the Pin Config tool integrated into the IDE. //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitPins(); The BOARD_InitPins() function performs four operations. Enable peripheral clock Disable peripheral reset External pin-to-pin and peripheral connection (MUX configuration) -> Parameter setting for the structure Write 3 to the register   Initializing the boot clock The MCX A153 supports Mid Drive Mode and Standard Drive Mode. These modes operate with VDD_CORE voltage levels of 1.0 V and 1.1 V, respectively, and with an rfo_hf clock of 48 MHz or 96 MHz. Switching modes requires external power supply and configuration of voltage-related registers such as the LDO. //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitBootClocks(); The clock is set using a register setting function that corresponds to the operating frequency. //(fsl_clock.cから抜粋) void BOARD_InitBootClocks(void) { BOARD_BootClockFRO96M(); }     Initializing the debug port //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitDebugConsole();   //(board.cから抜粋) void BOARD_InitDebugConsole(void) { /* attach 12 MHz clock to LPUART0 (debug console) */ CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u); CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH); RESET_PeripheralReset(BOARD_DEBUG_UART_RST); DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, BOARD_DEBUG_UART_CLK_FREQ); }   Application initialization ADC initialization is handled within the LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct); function. The LPADC_Init() function is a function in the driver section of fsl_lpadc.c. DEMO_LPADC_BASE: 0x400A_F000 -> Starting address of the ADC Define the structure table and configure the ADC. typedef struct {} lpadc_config_t name attribute explanation lpadc_config_t type LPADC Configuration Parameter Information enableInDozeMode bool Operation settings based on mode during ADC conversion conversionAverageMode lpadc_conversion_average_mode_t Settings related to Auto Calibration enableAnalogPreliminary bool ADC pre-startup settings PowerUpDelay uint32_t Stabilization time of ADC circuit referenceVoltageSource lpadc_reference_voltage_source_t Source of reference voltage powerLevelMode lpadc_power_level_mode_t Power supply configuration selection triggerPriorityPolicy lpadc_trigger_priority_policy_t How to process high-profitability triggers EnableConvPause bool Setting the AD conversion execution interval. convPauseDelay uint32_t Pause time during command sequence FIFOWatermark uint32_t Threshold setting for the number of data points in FIFO //(lpadc\interrupt\lpadc_interrupt.cから抜粋) LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct); //(fsl_lpadc.cから抜粋) void LPADC_Init(ADC_Type *base, const lpadc_config_t *config) { /* 省略 */ base->CTRL |= ADC_CTRL_CAL_AVGS(config->conversionAverageMode); /* 省略 */ }   About ADC calibration   Before using an ADC, calibration is performed to correct for offset errors and other factors included in the conversion result, thereby improving the accuracy of the AD conversion. The calibration process can be broadly divided into the following two stages: Set the calibration mode and conditions. Perform calibration and apply the correction values to the ADC.   In the default sample, ADC calibration is performed after LPADC_Init() is executed and before AD conversion begins. First, the offset calibration mode is set with LPADC_SetOffsetCalibrationMode() on the corresponding device. Then, if DEMO_LPADC_DO_OFFSET_CALIBRATION is enabled, LPADC_DoOffsetCalibration() is executed; otherwise, the offset value set in advance with LPADC_SetOffsetValue() is used. Furthermore, if the corresponding function macro is enabled, LPADC_DoAutoCalibration() is executed after a delay of 1 µs or more. This performs calibration of gain errors and linearity errors. Each process is compiled only if the function macro supported by the device is enabled. The following are the settings for the LPADC calibration mode. //(lpadc\interrupt\lpadc_interrupt.cから抜粋) /* Request LPADC calibration. */ #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE LPADC_SetOffsetCalibrationMode(DEMO_LPADC_BASE, DEMO_LPADC_OFFSET_CALIBRATION_MODE); #endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE */     Performing offset calibration //(lpadc\interrupt\lpadc_interrupt.cから抜粋) #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFS) && \ FSL_FEATURE_LPADC_HAS_CTRL_CALOFS #if defined(DEMO_LPADC_DO_OFFSET_CALIBRATION) && \ DEMO_LPADC_DO_OFFSET_CALIBRATION L PADC_DoOffsetCalibration(DEMO_LPADC_BASE); //キャリブレーションを実行しない場合 #else /* Update OFSTRIM register manually. */   5. MCX A153 DMA Why use DMA transfer for ADC conversion? When processing data acquired by an ADC solely in software, the CPU needs to monitor the completion of the ADC conversion, read the conversion results, and write them to memory. This is not a major problem for a single AD conversion, but when sampling continuously at regular intervals or when handling multiple input channels, this process occurs repeatedly. As a result, the CPU processing load increases, potentially reducing the time available for other application processing. One way to solve this problem is to transfer the ADC conversion results using DMA (Direct Memory Access). Using DMA, the ADC conversion results can be automatically transferred to memory as soon as the ADC conversion is complete. In other words, since the process from acquiring the ADC conversion results to storing them in memory can be handled by hardware, the amount of data transfer processing performed by the CPU can be reduced, and the processing load on the software can be lowered. For these reasons, configurations combining ADC and DMA are often used in applications requiring continuous AD conversion and high-speed data acquisition. This article will first explain the basic initialization method of the ADC, and then introduce how to transfer the ADC conversion result to memory using DMA with the MCX A153. Overview of AD conversion value transfer using DMA The data after AD conversion is stored in a buffer within the ADC peripheral. Instead of reading the data manually each time, the ADC may trigger DMA to transfer the data. For example, the program will be modified to perform AD conversion five times consecutively, then save the data to a RAM buffer via DMA, and display the average, minimum, and maximum values on the console. Procedure for transferring AD conversion values using DMA We will modify the ADC sample code to add DMA processing. DMA activation is performed using a DMA Request signal from the ADC. Using DMA, the ADC FIFO values (for 5 conversions) are copied to RAM, and an interrupt is notified to the CPU. The CPU takes the average value within the main loop after the DMA transfer is complete and displays the min, max, and ave values to the console.     Precautions To add DMA code, you need to add the DMA driver header file and source code to your project. The easiest way to do this is to create a sample DMA code (frdmmcxa153_edma3_memory_to_memory_transfer) from the MCUXpresso IDE and copy it. Simply copy the following files from the drivers directory. fsl_edma_core.h fsl_edma_soc.c fsl_edma_soc.h fsl_edma.c fsl_edma.h   5.1 Code modifications and additions related to ADC   Code modification steps The interrupt that occurs when ADC conversion is complete has been disabled. Added ADC configuration. Setting to perform AD conversion 5 times consecutively. Enable DMA requests Set the FIFO watermark to 4. Added processing to obtain the average, minimum, and maximum values of the values transferred by DMA, and to output them to the console.     1. Disable interrupts when ADC conversion is complete. Since the Interrupt Enable Register (IE) is enabled using the LPADC_EnableInterrupts() function and kLPADC_FIFOWatermarkInterruptEnable, we will comment out this line. // LPADC_EnableInterrupts(DEMO_LPADC_BASE, kLPADC_FIFOWatermarkInterruptEnable);   2. Add ADC configuration The ADC is configured to loop 5 times (= 5 AD conversions). mLpadcCommandConfigStruct.loopCount = 4 //loopCount +1回の変換 Enable DMA requests //178行目 LPADC_EnableFIFOWatermarkDMA(DEMO_LPADC_BASE, 1); // 1でDMA Requestがイネーブル     3. Set the number of Watermark levels in the FIFO to 4. // 33行目 /* ++ ADCのマクロ */ #define FIFO0WatermarkLEVEL (4) //108行目 mLpadcConfigStruct.FIFOWatermark = FIFO0WatermarkLEVEL;   4. Added processing to obtain the average, minimum, and maximum values of the values transferred by DMA, and console output. uint32_t adc_values[5] = {0}; PRINTF("Please press any key to get user channel's ADC value.\r\n"); while(1) { GETCHAR(); EXAMPLE_DMA_BASEADDR->CH[0].CH_CSR = DMA_CH_CSR_ERQ(1); EXAMPLE_DMA_BASEADDR->CH[0].TCD_DLAST_SGA = -0x14; LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U is trigger0 mask. */ while (!g_Transfer_Done) { /* DMA転送終了割り込み待ち */ } g_Transfer_Done = false; uint16_t min=adc_values[0]; uint16_t max=adc_values[0]; uint32_t sum=0; for(uint32_t i=0; i<5; i++) { if(max < (0x0000FFFF & adc_values[i])) max = adc_values[i]; if(min > (0x0000FFFF & adc_values[i])) min = adc_values[i]; sum += 0x0000FFFF & adc_values[i]; } PRINTF("ADC Min: %d, Max: %d, ave: %d\r\n", min, max, sum/5); for(size_t i=0; i<5; i++) { adc_values[i] = 0; } sum = 0; }   5.2 Adding DMA-related code   Code Addition Policy Include header files Added DMA-related macros. DMA configuration and initialization DMA transfer configuration DMA transfer completion interrupt handling   1. Include headers // 10行目 #include "fsl_debug_console.h" #include "pin_mux.h" #include "clock_config.h" #include "board.h" #include "fsl_lpadc.h" /* ++ */ #include "fsl_edma.h" // DMAドライバヘッダファイルの追加 #include "fsl_clock.h" #include "fsl_reset.h"   2. Add DMA-related macros. // 32行目 #define EXAMPLE_DMA_BASEADDR DMA0 #define DEMO_DMA_CHANNEL_0 0U #define APP_DMA_IRQ DMA_CH0_IRQn #define APP_DMA_IRQ_HANDLER DMA_CH0_IRQHandler     3. DMA Configuration // 197行目 edma_transfer_config_t transferConfig; edma_config_t userConfig; // 203行目 RESET_PeripheralReset(kDMA_RST_SHIFT_RSTn); /* Configure EDMA channel for one shot transfer */ EDMA_GetDefaultConfig(&userConfig); EDMA_Init(EXAMPLE_DMA_BASEADDR, &userConfig);     4. DMA transfer configuration // 209行目 EDMA_PrepareTransfer(&transferConfig, (void *)0x400AF300, // eDMA transfer source address. sizeof(uint32_t), // eDMA transfer source address width(bytes) (void *)adc_values, // eDMA transfer destination address sizeof(&adc_values), // eDMA transfer destination address width(bytes) sizeof(adc_values), // eDMA transfer bytes per channel request sizeof(adc_values), // eDMA transfer bytes to be transferred kEDMA_PeripheralToMemory // eDMA transfer type ); EDMA_SetTransferConfig(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, &transferConfig, NULL); EDMA_SetChannelMux(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kDma0RequestMuxAdc0FifoRequest); EnableIRQ(APP_DMA_IRQ); EDMA_EnableChannelInterrupts(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kEDMA_MajorInterruptEnable); Before starting the software ADC with a software trigger, add EDMA_TriggerChannelStart() to trigger an interrupt on DMA channel 0. When the DMA interrupt flag is cleared, DMA-triggered interrupts are disabled, so this processing is added before the ADC's software trigger. // 242行目 while(1) { GETCHAR(); EDMA_TriggerChannelStart(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0); EXAMPLE_DMA_BASEADDR->CH[0].TCD_DLAST_SGA = -0x14; LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U is trigger0 mask. */ while (!g_Transfer_Done) { /* DMA転送終了割り込み待ち */ } g_Transfer_Done = false;   5. DMA transfer completion interrupt handling void APP_DMA_IRQ_HANDLER(void) { if ((EDMA_GetChannelStatusFlags(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0) & kEDMA_InterruptFlag) != 0U) { EDMA_ClearChannelStatusFlags(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kEDMA_InterruptFlag); g_Transfer_Done = true; } } summary: This article explained the basic functions and points to note about the MCX A153 ADC, as well as the initialization and conversion process using the VS Code SDK's ADC sample project . Following the latter part of this article, you should be able to see configuration examples and code flows that will be useful in actual development, from initialization and conversion using the ADC sample to automatic transfer of conversion results using DMA. (It's easier to isolate problems if you first run the ADC sample and confirm its operation before adding DMA.) =========================​ We are currently unable to respond to comments left in the " Comment " section of this post . We apologize for the inconvenience, but please refer to " Technical Questions to NXP - How to Contact Us( Japanese Blog) " when making inquiries. (If you are already an NXP distributor or have a relationship with NXP, you may ask your representative directly.) This article explains everything from the basics of the ADC (analog-to-digital converter) in the MCX A153 , to initialization using the MCUXpresso SDK, and even automatic transfer of conversion results using DMA. If you are using ADC or DMA for the first time, it is recommended to first review the overall picture in Chapters 1 and 2, and then proceed to the sample code in Chapter 4 and the DMA settings in Chapter 5 for easier understanding. ADC: A function that converts analog signals, such as those from sensors, into digital values that can be handled by a microcontroller. DMA: A function that transfers data between peripherals and memory without going through the CPU. SDK: A development kit containing drivers and sample code necessary for software development. (Reading time: 30 minutes) General Purpose Microcontrollers Introduction MCUXpresso IDE MCUXpresso SDK Japanese Blog
View full article
[MCX A153] ADCモジュールの基本と使い方 (日本語ブログ)    この記事はMCX A153に搭載されたADC(Analog-to-Digital Converter)モジュールの基本的な使い方を説明します。ADCを利用したアプリケーション例から始め、主な機能、ブロック構成、使用時の注意点を整理したうえで、SDKサンプルコードを使ったデバイス初期化と、DMAによるADC変換結果の転送方法を紹介します。 この記事を読むことで、MCX A153のADCをアプリケーションで使用する際に必要となる基本事項を理解し、ADC変換を行うための初期設定から、DMAを活用した効率的なデータ転送までを実装できるようになることを目指します。   目次 1. アプリケーション上のよくある使用例        1.1 主な用途        1.2 使用例 2. MCX A153 ADCモジュールの主な機能とブロック図               2.1 概要               2.2 主な機能               2.3 ブロック図 3. 注意点、制限事項 4. ADCサンプルコード(デバイスの初期化)             4.1 サンプルコードの概要             4.2 SDKサンプルプロジェクトを開くまで             4.3 マクロ定義             4.4 デバイスの初期化 5. MCX A153 DMAを用いたAD変換値の転送           5.1 ADCに関するコード           5.2 DMAに関するコード まとめ 1. アプリケーション上のよくある使用例 ADCは、センサやポテンショメータなどから入力されたアナログ信号(連続的に変化する電圧)を、マイコンが計算に使えるデジタル値(数値)へ変換します。 1.1 主な用途 ポテンショメータから入力されたアナログの電圧値をデジタル値に変換 ポテンショメータをラジコンなどのサーボモータの軸に取り付けて、出力の変化からモータが回転した角度を検出する。 各種センサからのアナログ信号をデジタル値に変換 加速度センサからのアナログ信号を変換して物体の傾きを検出する。スマホの縦横の向きの検知などに応用できる。 温度センサからのアナログ信号を変換して周囲温度を測定する。   1.2 使用例 (概要を説明している例なので詳細は割愛しています) ポテンショメータの使用例:         2. 主な機能とブロック図   2.1 概要   MCX A153には、16ビットのADコンバータ(ADC)が搭載されています。ADコンバータは、アナログ電圧をデジタル値に変換する回路です。   2.2 主な機能 逐次比較型ADコンバータを1ユニット搭載 16ビットまたは12ビットの分解能で、シングルエンド入力に対応(分解能が高いほど、入力電圧を細かく表現できます) 搭載チャネル数 (パッケージにより異なる): 64ピンLQFP:24ch、48ピンLQFP:16ch、48ピンHVQFN:18ch、32ピンHVQFN:9ch サンプリング速度 (1秒間に何回変換できるか) 16ビットモード:最大3.2Msps、12ビットモード:最大4Msps サンプル時間が設定可能 マイコンの低電力モードで動作可能 4つのトリガーソースに対応 (ソフトウェアまたはハードウェアトリガーに対応) 7つのコマンドバッファにより連続したチャネルのスキャンが可能 コンペア機能をサポート (より小さい、より大きい、範囲内、範囲外、一致で保存、などを自動比較) ウォーターマークとオーバーフロー検出機能を持つ8つ変換結果データFIFOを搭載 割り込み、DMA、ポーリングに対応 キャリブレーション機能 専用入力チャネルを持つ温度センサを内蔵   2.3 ブロック図 MCX A153リファレンスマニュアル(MCXAP64M96FS3RM) Figure 165. ADC block diagramから抜粋   SDKサンプルコードの使用例 (ポテンショメータを接続)     3. MCX A153 ADCモジュール <注意点、制限事項> ここでは、MCX A153のADCを使う前に確認しておきたい注意点と制限事項を説明します。 16bitモードの速度低下 MCX A153のADCは、16ビット(ENOB16:実効分解能16ビット)と12ビット(ENOB12:実効分解能12ビット)の2つのモードに対応しています。ただし、16ビットモードは12ビットモードよりも、サンプリング速度が低下します。 (MCX A153 DataSheet Table.34から抜粋) キャリブレーションの実行タイミング キャリブレーションへのリクエスト&実行は、リセットまたは電源投入時に行わなければなりません。そして、キャリブレーション実行する前に、クロックソースと周波数をコンフィグする必要があります。 変換結果の平均化 ADCモジュールは、変換結果を保存する前に、同じチャネルの複数の結果を平均化できます。ハードウェア平均機能は、CMDHa[AVGS]ビットフィールドを0以外に設定すると有効になります。どの変換モードでも使用でき、ソフトウェアで平均値を計算する負担を減らせます。 4. AD変換のサンプルコード 4.1 サンプルコードの概要 mainシーケンスが実行されると、デバイスの初期化が実行されます。 デバイスの初期化は、クロックの設定に始まり、外部端子の構成と端子に接続するペリフェ ラルの選択をします。その後、ペリフェラル(ADC、UART)の初期化と、割り込みを有効に します。 初期化処理後、ループ処理内でADC変換開始のソフトウェアトリガをかけて、コンソールに AD変換の値と変換回数を表示します。 ハードウェアとしては、MCX A153の開発ボード「FRDM-MCXA153」を使用します。   4.2 VS codeでADCのサンプルプロジェクトを開くまでの手順 4.2.1 VS Codeと拡張機能の準備 VS Codeをインストールします。 拡張機能ビュー(Ctrl+Shift+X)で 「MCUXpresso for VS Code」 を検索してインストールします。 左のアクティビティバーにMCUXpressoアイコンが出ます。それをクリックして QUICKSTART PANEL を開きます。   4.2.2 依存ツールのインストール QUICKSTART PANELで 「Open MCUXpresso Installer」 を実行します。 次のツールを選んでインストールします。 Arm GNU Toolchain CMake / Ninja Python / West Git LinkServer(MCU-Link用デバッグプローブ) SDK 関連ツール 完了後、VS Codeを再起動します。   4.2.3 SDKリポジトリの取り込み QUICKSTART PANELで 「Import Repository」 をクリックします。 取り込み元として、リモートを選びます   保存先フォルダを指定します。パスは短く、日本語やスペースを含まないものにします  "I agree"をチェックして、Importボタンを押すことでレポジトリをインポートできます。   4.2.4 サンプルのインポート QUICKSTART PANELで 「Import Example from Repository」 をクリックします。 次のように設定します。   Importボタンを押すことで、プロジェクトをimportできます。 項目 設定値 Repository 手順3で取り込んだSDK(frdm_mcxa153) Toolchain Arm GNU Toolchain Board frdmmcxa153(FRDM-MCXA153) Template driver_examples → lpadc → interrupt(lpadc_interrupt) Location プロジェクト保存先 Name 任意(既定はlpadc_interrupt) 4.3 マクロ定義 ADCの機能に関するマクロ定義のコードです(lpadc\interrupt\app.hから抜粋)。 実際の回路設計と使用目的に合わせて、入力チャンネル、分解能設定、参考電圧ソースを修正してください。 Definitions //(lpadc\interrupt\app.hから抜粋) /******************************************************************************/ #define DEMO_LPADC_BASE ADC0 //ADCのinstance、ベースアドレス、MCX A153は1個 ADCしかない #define DEMO_LPADC_IRQn ADC0_IRQn #define DEMO_LPADC_IRQ_HANDLER_FUNC ADC0_IRQHandler #define DEMO_LPADC_USER_CHANNEL 0U //チャンネル番号 #define DEMO_LPADC_USER_CMDID 1U //コマンドID #define DEMO_LPADC_VREF_SOURCE kLPADC_ReferenceVoltageAlt3 //参考電圧ソース #define DEMO_LPADC_DO_OFFSET_CALIBRATION true //オフセットキャリブレーションの利用可否 #define DEMO_LPADC_USE_HIGH_RESOLUTION true //高分解能の利用可否 ADCに関する変数 Variables //(lpadc\interrupt\lpadc_interrupt.cから抜粋) volatile bool g_LpadcConversionCompletedFlag = false; volatile uint32_t g_LpadcInterruptCounter = 0U; lpadc_conv_result_t g_LpadcResultConfigStruct; #if (defined(DEMO_LPADC_USE_HIGH_RESOLUTION) && DEMO_LPADC_USE_HIGH_RESOLUTION) //高分解能 const uint32_t g_LpadcFullRange = 65536U; const uint32_t g_LpadcResultShift = 0U; #else //低分解能 const uint32_t g_LpadcFullRange = 4096U; const uint32_t g_LpadcResultShift = 3U; #endif /* DEMO_LPADC_USE_HIGH_RESOLUTION */ ADCに関する設定の構造体のデフォルト化(詳細はfsl_lpadc.cにある)、変換結果の平均化設定 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) LPADC_GetDefaultConfig(&mLpadcConfigStruct); mLpadcConfigStruct.enableAnalogPreliminary = true; //ADCアナログ回路は事前に有効化され、起動遅延なしで変換を実行する準備 #if defined(DEMO_LPADC_VREF_SOURCE) mLpadcConfigStruct.referenceVoltageSource = DEMO_LPADC_VREF_SOURCE; //参考電圧ソース #endif /* DEMO_LPADC_VREF_SOURCE */ #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS mLpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage; //変換結果平均化設定、平均しない/2回の平均/4回の平均/8回の平均/16回の平均....1024回の平均化選択可能 #endif     4.4 デバイスの初期化     クロック分周比の初期化 CLOCK_SetClockDiv関数では、ADCペリフェラルで使用するクロック分周設定を処理します。 //(lpadc\interrupt\hardware_init.cから抜粋) /* Attach peripheral clock */ CLOCK_SetClockDiv(kCLOCK_DivADC0, 1u); div_name: 列挙体で定義された分周器を選択 value: 分周比 ※以下のコードは、fsl_clock.cで始まるドライバ部となり、ユーザによる変更はオススメしません。 //(fsl_clock.cから抜粋) void CLOCK_SetClockDiv(clock_div_name_t div_name, uint32_t value) { volatile uint32_t *pDivCtrl = (volatile uint32_t *)(MRCC0_BASE + (uint32_t)div_name); assert(div_name <= kCLOCK_DivMax); /* Unlock clock configuration */ SYSCON->CLKUNLOCK &= ~SYSCON_CLKUNLOCK_UNLOCK_MASK; /* halt and reset clock dividers */ *pDivCtrl = 0x3UL << 29U; if (value == 0U) /*!< halt */ { *pDivCtrl |= (1UL << 30U); } else { *pDivCtrl = (value - 1U); } /* Freeze clock configuration */ SYSCON->CLKUNLOCK |= SYSCON_CLKUNLOCK_UNLOCK_MASK; }   クロック選択 CLOCK_AttachClkでは、ADCペリフェラルで用いるクロックソースを4つから選択します。 void CLOCK_AttachClk(clock_attach_id_t connection)関数の引数に 構造体clock_attach_id_tで定義された値を入れることで、ドライバにより設定が行われます。 //(fsl_clock.hから抜粋) kFRO12M_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 0U), /* Attach FRO12M to ADC0. */ kFRO_HF_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 1U), /* Attach FRO_HF to ADC0. */ kCLK_IN_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 3U), /* Attach CLK_IN to ADC0. */ kCLK_1M_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 5U), /* Attach CLK_1M to ADC0. */ kNONE_to_ADC0 = CLK_ATTACH_MUX(kCLOCK_SelADC0, 7U), /* Attach NONE to ADC0. */ //(lpadc\interrupt\hardware_init.cから抜粋) CLOCK_AttachClk(kFRO12M_to_ADC0); 以下の関数は、fsl_clock.cで始まるSDKで提供されているドライバ部の関数になり、ユーザーにより変更することはオススメしません。 //(fsl_clock.hから抜粋) void CLOCK_AttachClk(clock_attach_id_t connection) { const uint32_t reg_offset = CLK_ATTACH_REG_OFFSET(connection); const uint32_t clk_sel = CLK_ATTACH_CLK_SEL(connection); if (kNONE_to_NONE != connection) { CLOCK_SetClockSelect((clock_select_name_t)reg_offset, clk_sel); } } //(fsl_clock.hから抜粋) void CLOCK_SetClockSelect(clock_select_name_t sel_name, uint32_t value) { volatile uint32_t *pClkCtrl = (volatile uint32_t *)(MRCC0_BASE + (uint32_t)sel_name); assert(sel_name <= kCLOCK_SelMax); if (sel_name == kCLOCK_SelSCGSCS) { SCG0->RCCR = (SCG0->RCCR & ~(SCG_RCCR_SCS_MASK)) | SCG_RCCR_SCS(value); while ((SCG0->CSR & SCG_CSR_SCS_MASK) != SCG_CSR_SCS(value)) { } } else { /* Unlock clock configuration */ SYSCON->CLKUNLOCK &= ~SYSCON_CLKUNLOCK_UNLOCK_MASK; *pClkCtrl = value; /* Freeze clock configuration */ SYSCON->CLKUNLOCK |= SYSCON_CLKUNLOCK_UNLOCK_MASK; } } ボードの初期化関数について クロックの初期化を行います。   ピンの初期化 InitPins()を読み出し、pin_mux.cファイルの処理を行います。 pin_mux.cファイルは、NXPのMCUXPresso IDEに統合されているPin Configツールを用いて上書き可能です。 //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitPins(); BOARD_InitPins()関数では、4つの処理を行います。 ペリフェラルのクロックの有効化 ペリフェラルのリセット解除 外部ピンとピンとペリフェラルの接続(MUXの設定)構成 -> 構造体へのパラメータ設定 3をレジスタへ書き込み   ブートクロックの初期化 MCX A153では、Mid Drive ModeとStandard Drive Modeをサポートしています。 それぞれ、VDD_COREの電圧レベルが、1.0 Vと1.1 Vで、rfo_hfクロックが48MHzもしくは96MHzで動作します。 モードを切り換えるには、外部からの電源供給に加えて、LDO等の電圧関連のレジスタ設定が必要です。 //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitBootClocks(); 動作周波数に応じたレジスタ設定用の関数を用いて、クロックを設定します。 //(fsl_clock.cから抜粋) void BOARD_InitBootClocks(void) { BOARD_BootClockFRO96M(); }     デバッグポートの初期化 //(lpadc\interrupt\hardware_init.cから抜粋) BOARD_InitDebugConsole();   //(board.cから抜粋) void BOARD_InitDebugConsole(void) { /* attach 12 MHz clock to LPUART0 (debug console) */ CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u); CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH); RESET_PeripheralReset(BOARD_DEBUG_UART_RST); DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, BOARD_DEBUG_UART_CLK_FREQ); }   アプリケーションの初期化 ADCの初期化は、LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct);関数内で処理されます。 LPADC_Init()の関数は、fsl_lpadc.cのドライバ部分の関数になります。 DEMO_LPADC_BASE: 0x400A_F000 -> ADCの先頭アドレス 構造体テーブルを定義して、ADCのコンフィギュレーションを行います。 typedef struct {} lpadc_config_t 名称 属性 説明 lpadc_config_t 型 LPADCコンフィグパラメータ情報 enableInDozeMode bool ADC変換中のモードによる動作設定 conversionAverageMode lpadc_conversion_average_mode_t Auto Calibrationに関する設定 enableAnalogPreliminary bool ADC事前起動設定 powerUpDelay uint32_t ADC回路の安定時間 referenceVoltageSource lpadc_reference_voltage_source_t 基準電圧のソース powerLevelMode lpadc_power_level_mode_t 電源構成の選択 triggerPriorityPolicy lpadc_trigger_priority_policy_t 高プロイオリティトリガの処理方法 enableConvPause bool AD変換実行間隔の設定 convPauseDelay uint32_t コマンドシーケンス中のポーズ時間 FIFOWatermark uint32_t FIFO内データ数の閾値設定 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct); //(fsl_lpadc.cから抜粋) void LPADC_Init(ADC_Type *base, const lpadc_config_t *config) { /* 省略 */ base->CTRL |= ADC_CTRL_CAL_AVGS(config->conversionAverageMode); /* 省略 */ }   ADCのキャリブレーションについて   ADCでは、変換結果に含まれるオフセット誤差などを補正し、AD変換の精度を向上させるために、ADCの使用開始前にキャリブレーションを実行します。 キャリブレーション処理は、主に次の2段階に分けて考えることができます。 キャリブレーションのモードや条件を設定する キャリブレーションを実行し、補正値をADCへ反映する   デフォルトサンプルでは、LPADC_Init()の実行後、AD変換を開始する前にADCキャリブレーションを実行します。まず、対応するデバイスではLPADC_SetOffsetCalibrationMode()でオフセットキャリブレーションのモードを設定します。その後、DEMO_LPADC_DO_OFFSET_CALIBRATIONが有効な場合はLPADC_DoOffsetCalibration()を実行し、無効な場合はLPADC_SetOffsetValue()であらかじめ設定したオフセット値を使用します。 さらに、対応する機能マクロが有効な場合は、1 µs以上の待ち時間を置いてLPADC_DoAutoCalibration()を実行します。これにより、ゲイン誤差や直線性誤差のキャリブレーションを行います。各処理は、デバイスがサポートする機能マクロが有効な場合にのみコンパイルされます。   下記はLPADCのキャリブレーションモードの設定です。 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) /* Request LPADC calibration. */ #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE LPADC_SetOffsetCalibrationMode(DEMO_LPADC_BASE, DEMO_LPADC_OFFSET_CALIBRATION_MODE); #endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFSMODE */     オフセットキャリブレーションの実行 //(lpadc\interrupt\lpadc_interrupt.cから抜粋) #if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFS) && \ FSL_FEATURE_LPADC_HAS_CTRL_CALOFS #if defined(DEMO_LPADC_DO_OFFSET_CALIBRATION) && \ DEMO_LPADC_DO_OFFSET_CALIBRATION L PADC_DoOffsetCalibration(DEMO_LPADC_BASE); //キャリブレーションを実行しない場合 #else /* Update OFSTRIM register manually. */   5. MCX A153 DMA ADC変換にDMA転送を用いる理由 ADCで取得したデータをソフトウェアだけで処理する場合、ADC変換の完了をCPUが監視し、変換結果を読み出してメモリへ書き込む処理が必要になります。単発のAD変換であれば大きな問題にはなりませんが、一定周期で連続的にサンプリングする場合や、複数の入力チャネルを扱う場合には、この処理が繰り返し発生します。その結果、CPUの処理負荷が増加し、他のアプリケーション処理に割り当てられる時間が少なくなる可能性があります。 この課題を解決する方法の一つが、DMA(Direct Memory Access)を用いたADC変換結果の転送です。DMAを使用すると、ADC変換の完了をきっかけに、ADCの変換結果をメモリへ自動的に転送できます。つまり、AD変換結果の取得からメモリへの格納までをハードウェアで処理できるため、CPUによるデータ転送処理を減らし、ソフトウェアの処理負荷を低減できます。 このような理由から、連続的なAD変換や高速なデータ取得が必要なアプリケーションでは、ADCとDMAを組み合わせた構成がよく利用されます。本記事では、まずADCの基本的な初期化方法を説明した後、MCX A153でDMAを使用してADC変換結果をメモリへ転送する方法を紹介します。 DMAを用いたAD変換値の転送 概要 AD変換後のデータはADCペリフェラル内のバッファに格納されます。都度、ソフトウェアで読み出さずに、ADCのトリガによりDMA を起動し、データを転送することがあります。1例として、AD変換を連続で5回おこなった後、DMAにてRAM上のバッファに保存し、コンソールに平均値と最小、最大を表示するプログラムに変更します。 DMAを用いたAD変換値の転送手順 ADCのサンプルコードを変更し、DMAの処理を追加していきます。 DMA起動は、ADCからのDMA Request信号を用います。 DMAを用いて、ADC FIFOの値(5回変換分)をRAMへコピーし、CPUへ割り込みを通知します。 CPUは、DMA転送完了後にmainループ内で平均値をとり、min, max, aveをコンソールに表示させます。     注意事項 DMAのコードを追加するにあたり、DMAドライバのヘッダファイルとソースコードをプロジェクトに追加してください。 一番簡単と思われる方法は、MCUXpresso IDEからDMAのサンプルコード(frdmmcxa153_edma3_memory_to_memory_transfer)を作成し、コピーする方法です。 driversディレクトリから、以下のファイルをコピーすればOKです。 fsl_edma_core.h fsl_edma_soc.c fsl_edma_soc.h fsl_edma.c fsl_edma.h   5.1  ADCに関するコードの修正と追加   コードの修正手順 ADC変換完了時の割り込みをディスエーブルに修正 ADCのコンフィグレーションを追加 AD変換を連続5回実行する設定 DMAリクエストをイネーブル設定 FIFOのWatermarkを4に設定 DMAが転送した値の平均、最小、最大値取得処理とコンソール出力を追加     1. ADC変換完了時の割り込みを無効 LPADC_EnableInterrupts()関数とkLPADC_FIFOWatermarkInterruptEnableを用いて、Interrupt Enable Register (IE)を有効にしているため、この行をコメントアウトします。 // LPADC_EnableInterrupts(DEMO_LPADC_BASE, kLPADC_FIFOWatermarkInterruptEnable);   2. ADCのコンフィグレーションを追加 ADCを5回ループ設定(=5回のAD変換) mLpadcCommandConfigStruct.loopCount = 4 //loopCount +1回の変換 DMAリクエストをイネーブルに設定 //178行目 LPADC_EnableFIFOWatermarkDMA(DEMO_LPADC_BASE, 1); // 1でDMA Requestがイネーブル     3. FIFOのWaterMarkの段数を4に設定 // 33行目 /* ++ ADCのマクロ */ #define FIFO0WatermarkLEVEL (4) //108行目 mLpadcConfigStruct.FIFOWatermark = FIFO0WatermarkLEVEL;   4. DMAが転送した値の平均、最小、最大値取得処理とコンソール出力を追加 uint32_t adc_values[5] = {0}; PRINTF("Please press any key to get user channel's ADC value.\r\n"); while(1) { GETCHAR(); EXAMPLE_DMA_BASEADDR->CH[0].CH_CSR = DMA_CH_CSR_ERQ(1); EXAMPLE_DMA_BASEADDR->CH[0].TCD_DLAST_SGA = -0x14; LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U is trigger0 mask. */ while (!g_Transfer_Done) { /* DMA転送終了割り込み待ち */ } g_Transfer_Done = false; uint16_t min=adc_values[0]; uint16_t max=adc_values[0]; uint32_t sum=0; for(uint32_t i=0; i<5; i++) { if(max < (0x0000FFFF & adc_values[i])) max = adc_values[i]; if(min > (0x0000FFFF & adc_values[i])) min = adc_values[i]; sum += 0x0000FFFF & adc_values[i]; } PRINTF("ADC Min: %d, Max: %d, ave: %d\r\n", min, max, sum/5); for(size_t i=0; i<5; i++) { adc_values[i] = 0; } sum = 0; }   5.2 DMAに関するコードの追加   コードの追加方針 ヘッダファイルのインクルード DMA関連のマクロを追加 DMAのコンフィグレションと初期化 DMA転送のコンフィグレーション DMA転送完了割り込み処理   1. ヘッダのインクルード // 10行目 #include "fsl_debug_console.h" #include "pin_mux.h" #include "clock_config.h" #include "board.h" #include "fsl_lpadc.h" /* ++ */ #include "fsl_edma.h" // DMAドライバヘッダファイルの追加 #include "fsl_clock.h" #include "fsl_reset.h"   2. DMA関連のマクロを追加 // 32行目 #define EXAMPLE_DMA_BASEADDR DMA0 #define DEMO_DMA_CHANNEL_0 0U #define APP_DMA_IRQ DMA_CH0_IRQn #define APP_DMA_IRQ_HANDLER DMA_CH0_IRQHandler     3. DMAのコンフィグレーション // 197行目 edma_transfer_config_t transferConfig; edma_config_t userConfig; // 203行目 RESET_PeripheralReset(kDMA_RST_SHIFT_RSTn); /* Configure EDMA channel for one shot transfer */ EDMA_GetDefaultConfig(&userConfig); EDMA_Init(EXAMPLE_DMA_BASEADDR, &userConfig);     4. DMA転送のコンフィグレーション // 209行目 EDMA_PrepareTransfer(&transferConfig, (void *)0x400AF300, // eDMA transfer source address. sizeof(uint32_t), // eDMA transfer source address width(bytes) (void *)adc_values, // eDMA transfer destination address sizeof(&adc_values), // eDMA transfer destination address width(bytes) sizeof(adc_values), // eDMA transfer bytes per channel request sizeof(adc_values), // eDMA transfer bytes to be transferred kEDMA_PeripheralToMemory // eDMA transfer type ); EDMA_SetTransferConfig(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, &transferConfig, NULL); EDMA_SetChannelMux(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kDma0RequestMuxAdc0FifoRequest); EnableIRQ(APP_DMA_IRQ); EDMA_EnableChannelInterrupts(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kEDMA_MajorInterruptEnable); ソフトウェアADCをソフトウェアトリガで起動する前に、DMAのチャネル0に割込みのトリガが掛るようにEDMA_TriggerChannelStart()を追加します。 DMAの割込みフラグをクリアした際、DMAトリガによる割込みがディスエーブルになるため、ADCのソフトウェアトリガの前に処理をついかします。 // 242行目 while(1) { GETCHAR(); EDMA_TriggerChannelStart(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0); EXAMPLE_DMA_BASEADDR->CH[0].TCD_DLAST_SGA = -0x14; LPADC_DoSoftwareTrigger(DEMO_LPADC_BASE, 1U); /* 1U is trigger0 mask. */ while (!g_Transfer_Done) { /* DMA転送終了割り込み待ち */ } g_Transfer_Done = false;   5. DMA転送完了割り込み処理 void APP_DMA_IRQ_HANDLER(void) { if ((EDMA_GetChannelStatusFlags(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0) & kEDMA_InterruptFlag) != 0U) { EDMA_ClearChannelStatusFlags(EXAMPLE_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kEDMA_InterruptFlag); g_Transfer_Done = true; } } まとめ: 本記事では、MCX A153 ADCの基本機能、注意点、vscode sdkのADCサンプルプロジェクトを使った初期化と変換処理を説明しました。そして、後半の記事従い、ADCサンプルを使った初期化・変換処理から、DMAによる変換結果の自動転送まで、実際の開発に役立つ設定例とコードの流れを確認できると思います。(まずはADC単体のサンプルを動かし、動作を確認してからDMAを追加すると、問題を切り分けやすくなります。) =========================​ 本投稿の「Comment」欄にコメントをいただいても、現在返信に対応しておりません。​ お手数をおかけしますが、お問い合わせの際には「NXPへの技術質問 - 問い合わせ方法 (日本語ブログ)」をご参照ください。​ (既に弊社NXP代理店、もしくはNXPとお付き合いのある方は、直接担当者へご質問いただいてもかまいません。)​ この記事では、MCX A153に搭載されているADC(アナログ信号をデジタル値に変換する回路)の基本から、MCUXpresso SDKを使った初期化、さらにDMAを使った変換結果の自動転送までを説明します。ADCやDMAを初めて使う場合は、まず1章と2章で全体像を確認し、その後に4章のサンプルコード、5章のDMA設定へ進むと理解しやすくなります。 ADC:センサなどのアナログ信号を、マイコンで扱えるデジタル値に変換する機能 DMA:CPUを介さずに、ペリフェラルとメモリの間でデータを転送する機能 SDK:ソフトウェア開発に必要なドライバやサンプルコードをまとめた開発キット (読了:30分) General Purpose Microcontrollers introduction MCUXpresso IDE MCUXpresso SDK 日本語ブログ
View full article
VLM Edge Studio VLM Edge Studio In this post, I want to share a quick walkthrough of VLM Edge Studio, an NXP launcher application designed to interact with supported Vision-Language Models running locally on FRDM i.MX platforms with Ara240 DNPU acceleration. VLM Edge Studio provides a Qt/QML-based GUI for model selection, prompt input, and visual interaction with locally running VLMs at the edge. It communicates with the Ara240 Runtime SDK through the eIQ AAF Connector using a REST-based interface and streaming token responses.   Key Features Local Vision-Language Model inference on supported i.MX platforms Ara240 DNPU acceleration GUI-based model selection and prompt input Streaming token output Integration with eIQ AAF Connector and Ara240 Runtime SDK Support for camera-based visual input using a USB-C HD camera   Supported Model Qwen2.5-VL-7B-Instruct-Ara240 This model is provided as an Ara240-compatible model.dvm file and is intended for local execution on the target platform.   Running VLM Edge Studio ONLY for Release L6.18.37_2.1.0 apply the following command as a workaround (Check for more details at VLM Edge Studio - video analysis fails with PyAV 19.0.0 - NXP Community sed -i 's/av.open(filename, metadata_errors="ignore")/av.open(filename)/g' /usr/share/eiq/aaf-connector/venv/lib/python3.14/site-packages/torchvision/io/video.py Start the application with: run_vlm_edge_studio Before launching, make sure the Ara240 runtime service is running: systemctl status rt-sdk-ara2.service --no-pager -l Once the GUI appears, click LOAD to load the model. After the model is ready, enter a prompt and submit it to interact with the VLM locally on the i.MX platform.   Walkthrough Video In the attached video, I show how to launch VLM Edge Studio from GoPoint, load the supported Vision-Language Model, submit a prompt, and interact with the model running locally with Ara240 DNPU acceleration. (function() { var wrapper = document.getElementById('lia-vid-6405413539112w960h540r804'); var videoEl = wrapper ? wrapper.querySelector('video-js') : null; if (videoEl) { if (window.videojs) { window.videojs(videoEl).ready(function() { this.on('loadedmetadata', function() { this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) { bar.setAttribute('role', 'presentation'); bar.setAttribute('aria-hidden', 'true'); }); }); }); } }})(); (view in My Videos) Summary VLM Edge Studio is a useful tool for evaluating local Vision-Language Model inference on NXP i.MX platforms using Ara240 DNPU acceleration. It provides a simple workflow for loading the model, entering prompts, and interacting with visual-language AI directly at the edge.   Link VLM Edge Studio repository Errata: On Release Linux 6.18.37_2.1.0 there is an issue when launching VLM Edge Studio due to an external dependency change. To fix it check VLM Edge Studio - video analysis fails with PyAV 19.0.0 - NXP Community   ARA2-M2-16G-GT ARA240 Hands-On Training
View full article
Getting Started with S32 Design Studio AI Support and the FRDM-A-S32K312 Board   This guide explains how to set up S32 Design Studio AI Support with Claude Desktop, and then verify the setup by importing, building and flashing the Blinking LED example from Application Code Hub on the FRDM-A-S32K312 board.   Prerequisites NXP account – free and required for all NXP downloads. You can create one when prompted in the next step. Python 3.11 to 3.14 – download the Windows installer from Python.org. During installation, select Add python.exe to PATH. On the last page, click Disable path length limit if it is shown. To verify the installation, open a new Command Prompt and run python --version or py --version . NXP S32 software tools FRDM Automotive S32K3 + S32M27 Board Installation Package - download and run the installer as administrator from Automotive Software Package Manager | NXP Semiconductors Known Windows path-length limitation: If the installation fails because a file path is too long, rerun the installer and select a shorter installation directory, such as C:\NXP\K3 S32 Design Studio v.3.6.11 - Update the version using the S32 Design Studio Platform package available in the S32DS Extensions and Updates panel: S32 Design Studio -> Help -> S32DS Extensions and Updates -> S32 Design Studio Platform package -> Update S32 Design Studio MCP Integration plugin v.1.0.3 - Install it from S32DS Extensions and Updates panel  S32 Design Studio AI Support - download the .pyz installer from the latest release on Releases · nxp-agentic-ai/s32-ds-ai-support, under Assets. Note the folder where it is saved. An MCP-compatible AI agent - this guide uses Claude Desktop as example, but any MCP-compatible AI agent can be used Claude Desktop - download it from claude.com/download, install it and sign in with your Claude account. FRDM-A-S32K312 board and a USB cable Installation Close Claude Desktop completely, including from the system tray (right-click the Claude icon → Close). Otherwise, the MCP registration may fail. Open a Command Prompt in the folder containing the s32ds-agentic-ai-installer-{version}.pyz file (open the folder in File Explorer, type cmd in the address bar and press Enter) Run the command below, replacing {version} with the version in the file name. When prompted, press Enter to accept the default install location (C:/NXP/s32ds-agentic-ai) or type another path, then press Enter again to install all components. Then, select for which agents you want the MCP Server to be configured and then the skills to be copied. Choose 1 for Claude Desktop.   For all installer options, see the README on GitHub – S32 Design Studio AI Support python s32ds-agentic-ai-installer-{version}.pyz The MCP servers and skills should be now installed and registered in the specified agent. To verify in Claude Desktop, open Settings → Developer and check that the NXP S32 Design Studio MCP Server is listed without errors. To check that the skills were installed, type / in Claude Code. The installed skills should appear in the list.  If the MCP server is not listed, check the troubleshooting section. Start prompting   Connect the board to the laptop with the USB cable, open your AI agent and send the prompt below, replacing the paths with your own. The agent imports the Blinking LED example from Application Code Hub into S32 Design Studio, builds it and flashes it to the board. “S32 Design Studio is installed in C:\NXP\S32DS.3.6.8 and my workspace is C:\S32DS_Workspace. Import the Blinking LED example for the FRDM-A-S32K312 board from Application Code Hub, generate the configuration code, build the project and flash it to the board connected over USB.” Troubleshooting Known Claude Desktop limitation on Windows (MSIX) Due to a known Claude Desktop MSIX configuration issue on Windows (community issue #26073), Claude Desktop may not detect MCP servers that were automatically registered during installation. If this occurs, manually register the MCP Gateway using the steps below: Open Claude Desktop. Go to Settings → Developer → Edit Config In the existing mcpServers object, add the following s32ds-agentic-ai entry: { "mcpServers": { "s32ds-agentic-ai": { "command": "C:/NXP/s32ds-agentic-ai/run-mcp.bat", "args": [ "nxp.mcp.gateway", "configs/gateway.stdio.yaml" ], "disabled": false } } } Important. If other MCP servers are already configured, add only the s32ds-agentic-ai entry inside the existing mcpServers object. Do not replace or overwrite the existing configuration. The example above assumes the default installation structure. If a different installation directory was selected, adjust the command path accordingly. 4. Save the configuration. 5. Restart Claude Desktop. 6. Go to Settings → Developer and verify that the MCP server is listed without errors. Getting Started
View full article
S32K312 BCTU – FIFO Watermark Callback Working, but Last Conversion Callback Not Triggered Hello NXP Community, I am working with the S32K312 MCU using S32 Design Studio and S32K3 RTD 7.0.1. I have configured the BCTU to trigger a list of ADC conversions using a software trigger. I am testing both the BCTU FIFO1 watermark callback and the BCTU last-conversion callback. Current Configuration: MCU: S32K312 Driver: S32K3 RTD 7.0.1 ADC instance: ADC0 BCTU conversion list: 4 ADC channels (0, 2, 4, 3) Trigger source: BCTU software trigger Interrupt: BCTU_IRQn enabled Notifications: FIFO1 watermark and last-conversion callbacks Observed Behavior: When I enable the FIFO1 watermark notification, the watermark callback is triggered successfully, and I can read the ADC conversion results from FIFO1. However, when I enable the BCTU last-conversion notification, the corresponding callback is not triggered. During debugging, I observed: Execution enters Bctu_0_Isr(). The driver checks the enabled BCTU interrupt sources. The condition if((*Reg & Mask) != 0U) evaluates to false for the last-conversion notification. The LIST0_Last bit in the BCTU MSR register remains 0 when inspected during interrupt handling. As a result, the last-conversion callback is not executed. Questions: Why does the FIFO1 watermark callback work correctly while the BCTU last-conversion callback is not triggered? What exact hardware condition causes MSR.LIST0_Last to become 1? Does the last-conversion interrupt require additional configuration in the BCTU conversion list, trigger configuration, or interrupt enable settings? Can both the FIFO1 watermark callback and the BCTU last-conversion callback be used for the same conversion list? Is the LIST0_Last status flag automatically cleared by hardware or by the RTD interrupt handler? If so, at what point? Which BCTU registers should I monitor to verify that the last-conversion event is generated correctly? Could you please help me understand why the FIFO watermark interrupt is functioning correctly while the BCTU last-conversion interrupt is not being generated or handled as expected? I can provide screenshots of my BCTU configuration, register values, and ISR debugging observations if required. Thank you for your support. #s32k312 #adcbctu #bctuswconv #listlastconv Re: S32K312 BCTU – FIFO Watermark Callback Working, but Last Conversion Callback Not Triggered Hi, if remember well, Last Conversion Notification can be generated only when the ADC conversion result destination is set to ADCnDR. The Reference Manual also states it in the LIST_IEN description.   BR, Petr  
View full article
mlockall(MCL_FUTURE)を呼び出すプロセスでiMX8MP GPUを使用すると、カーネルBUG() あるお客様がiMX8MPのGPU使用(EGLによる描画)に関する問題を報告しました。以前mlockall(MCL_FUTURE)と呼ばれていたGPU初期化プロセスが、CMA領域がユーザースペースにマッピングされると、カーネルは以下のBUG()を報告します: Kernel BUG at remap_pfn_range_internal+0x23c/0x2c8 Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP CPU: 0 PID: 3197 Comm: galcore_window_ Tainted: G O 6.6.142-7.7.0-devel #1-Torizon Hardware name: Toradex Verdin iMX8M Plus WB on Verdin Development Board (DT) pc : remap_pfn_range_internal+0x23c/0x2c8 x27: 00000000a2100000 x20: 0068000000000fcb x19: 0000007f90000000 ^^^^^^^^^^^^^^^^^^^^^^ the PTE already present Call trace: remap_pfn_range_internal+0x23c/0x2c8 remap_pfn_range+0x24/0x58 dma_direct_mmap+0xf4/0x150 dma_mmap_attrs+0x18/0x3c _CMAFSLMapUser+0x9c/0x150 [galcore] gckOS_LockPages+0xe4/0x148 [galcore] gckKERNEL_MapVideoMemory+0x90/0x1dc [galcore] gckVIDMEM_NODE_LockCPU+0x1b4/0x250 [galcore] _LockVideoMemory.isra.0+0x1f4/0x28c [galcore] gckKERNEL_Dispatch+0x210/0x1730 [galcore] gckDEVICE_Dispatch+0xcc/0x220 [galcore] drv_ioctl+0x340/0x444 [galcore] __arm64_sys_ioctl+0xac/0xf0 Kernel panic - not syncing: Oops - BUG: Fatal exception mlockall(MCL_FUTURE)はリアルタイムアプリケーションで一般的に使われており、問題を報告した顧客はCODESYSを使ってHMIを駆動しています。 AIを活用した分析を実施した結果、問題が発生する理由として考えられる説明が明らかになりました。 galcoreドライバーのCMAアロケーターには.mmap()が含まれていません。フック。_CMAFSLMapUser() の実行中に、mmap() を呼び出して vma を取得し、それを使用して find_vma() を使用して CMA 領域を特定します。mmap() の呼び出し方法により、カーネルは要求を満たすために SHM 領域を遅延的に割り当てることになります。通常の場合、CMAが見つかって再マッピングされると、この割り当てはすぐに破棄されます。 しかし、MCL_FUTUREがアクティブなとカーネルはもはやSHM領域を怠惰に割り当てることができなくなり、mmap()が戻る前にエリア全体を埋め尽くします。この場合、このアドレスには有効なページがあり、後のremap_pfn_range()への呼び出しはメモリ管理のハウスキーピング情報を静かに破棄することになり、これはまさにBUG()が防いでいることです。 CODESYSを実行せずに問題を再現できるプログラムのソースコードを含むzipファイルを添付します。AIエージェントは、この問題を修正するために以下のパッチを提案しました。 diff -uNr a/hal/kernel/inc/gc_hal_options.h b/hal/kernel/inc/gc_hal_options.h --- a/hal/kernel/inc/gc_hal_options.h 2026-09-04 13:00:44.596621860 +0000 +++ b/hal/kernel/inc/gc_hal_options.h 2026-09-04 13:01:15.643862002 +0000 @@ -1471,9 +1471,17 @@ * Enable this macro can replace the /dev/zero by anon_inode: * [galcore] in /proc/ /maps. * Without the macro, run 'cat /proc/ /maps' will print "/dev/zero". + * + * It is also what gives the allocators an ->mmap handler, which is + * required so that the reservation made by vm_mmap() is created as a + * device mapping (VM_IO | VM_PFNMAP) rather than as ordinary anonymous + * memory. Without it, a process that has called mlockall(MCL_FUTURE) + * gets the range pre-faulted inside vm_mmap(), and the subsequent + * remap_pfn_range() then hits BUG_ON(!pte_none()) in remap_pte_range(). + * See tmp_mmap() in gc_hal_kernel_allocator.c. */ #ifndef gcdANON_FILE_FOR_ALLOCATOR -# define gcdANON_FILE_FOR_ALLOCATOR 0 +# define gcdANON_FILE_FOR_ALLOCATOR 1 #endif /* diff -uNr a/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c b/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c --- a/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c 2026-09-04 13:00:44.605314869 +0000 +++ b/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c 2026-09-04 13:01:15.644216883 +0000 @@ -400,7 +400,13 @@ gcmkHEADER_ARG("Allocator=%p Mdl=%p Cacheable=%d", Allocator, Mdl, Cacheable); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) +#if gcdANON_FILE_FOR_ALLOCATOR + /* Same as the gfp, dma and reserved_mem allocators: go through the + * allocator's anon file so that its ->mmap handler runs. */ + userLogical = (gctPOINTER)vm_mmap(Allocator->anon_file, +# else userLogical = (gctPOINTER)vm_mmap(gcvNULL, +# endif 0L, Mdl->numPages * PAGE_SIZE, PROT_READ | PROT_WRITE, diff -uNr a/hal/os/linux/kernel/gc_hal_kernel_allocator.c b/hal/os/linux/kernel/gc_hal_kernel_allocator.c --- a/hal/os/linux/kernel/gc_hal_kernel_allocator.c 2026-09-04 13:00:44.603242857 +0000 +++ b/hal/os/linux/kernel/gc_hal_kernel_allocator.c 2026-09-04 13:01:15.644041018 +0000 @@ -104,6 +104,36 @@ static int tmp_mmap(struct file *fp, struct vm_area_struct *vma) { + /* + * Declare the reservation as a device mapping with raw PFNs, before + * mmap() returns it to the caller. remap_pfn_range() sets both flags + * anyway; setting them here only makes them effective from the moment + * the VMA is created, and that is what matters: + * + * - the kernel treats VM_IO | VM_PFNMAP as VM_SPECIAL, documented in + * include/linux/mm.h as "Special vmas that are non-mergable, + * non-mlock()able". mmap_region() therefore clears VM_LOCKED from + * this VMA and leaves mm->locked_vm alone, and __mm_populate() + * skips it outright ("if (vma->vm_flags & (VM_IO | VM_PFNMAP)) + * continue;" in mm/gup.c). + * + * - so a process that has called mlockall(MCL_FUTURE) no longer has + * this range pre-faulted inside vm_mmap(). Every other mapping in + * that process keeps being locked and pre-faulted as before; only + * device memory, which is neither pageable nor swappable and gains + * nothing from being pre-faulted, is left out. + * + * - and the allocator's own remap_pfn_range(), a few microseconds + * later, therefore finds an empty range instead of one the kernel + * has just populated, so it no longer trips + * BUG_ON(!pte_none(ptep_get(pte))) in remap_pte_range(). + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_IO | VM_PFNMAP); +#else + vma->vm_flags |= VM_IO | VM_PFNMAP; +#endif + return 0; } 上流ドライバーはこの問題を回避する別のメカニズムを使用しています。他の galcore アロケータも同じパターン (vm_mmap を呼び出して vma を取得する) を使用しているため、同じ BUG() の影響を受ける可能性があります。 この件について調べて、galcoreドライバーを直してもらえますか?この問題は実際のユースケースが正常に動作することを妨げており、直接的にお客様に影響を及ぼしています。 ありがとうございました。 ラファエル Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() こんにちは@rbeims  テストを実行してからGPUチームに確認させてください。 よろしくお願いします、 志明 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() こんにちは、 @Zhiming_Liu さん、バグを再現できましたか?はいの場合、修正が貴社のBSPに実装される予定時期を教えていただけますか? よろしくお願いいたします。 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() こんにちは、 @alvaro_tx さん。 社内チームがこのパッチをテストしました。お客様が直面した問題を直接解決したものの、他のアプリケーションのテスト中に問題を引き起こしました。現在も調査中であり、最終的な結論には至っていません。 よろしくお願いします、 志明 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() こんにちは、 @Zhiming_Liu さん。分かりやすいレポートをありがとうございます。完全に理解していて、私たちもこれが起こり得ると思いました。すべて順調です。 引き続きこの件に取り組んでいただき、進捗状況があればお知らせください。 ありがとう、 アルバロ。 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() @Zhiming_Liu さん、調査の進捗状況はいかがですか? 進展がなければ、他のアプリケーションでテスト中にどのような問題が生じたのか教えていただけますか? お客様は開発を進める必要があり、公式な解決策がなければパッチの適用を検討していますが、デメリットを知りたいと考えています。 ありがとう、 アルバロ。 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() ありがとう@Zhiming_Liu 。 NXPのR&DのパッチはLinuxドライバではなくEGLライブラリに基づいているようです。 この変更はオープンソースのLinuxドライバではなく、クローズドソースのEGLライブラリに適用されるということでしょうか? パッチを開く予定がない場合は、パッチが適用される場所、特にLinuxカーネル(6.6、6.18?)についての情報を教えていただけると助かります。 研究開発チームは、回避策とは異なるアプローチであっても、このパッチが問題を解決することを確認したと理解すべきでしょうか? Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() こんにちは、 @alvaro_tx @rbeims お客様が言及した問題についてですが、該当パッチは現在マージ中です。しかし、NXP R&DのパッチはLinuxドライバではなくEGLライブラリに基づいているようです。 よろしくお願いします、 志明
View full article
[OSM-iMX937/952] Schematic review For our new project, the iMX937 and iMX952 will be using a shared board design Could you help to review iMX937 and iMX952 schematic? Please refer to the attached file. The following questions would like to be confirmed with NXP: (1) According to the EVK and checklist descriptions, C604 and C603 in the circuit exist for the NXP iMX95. Therefore, can they be directly removed in this project? (2) To reduce component count, the additional ADC VREF and VDD_DDR capacitors on page 4 of the circuit were directly removed. According to the documentation, these designs exist for the NXP iMX95, not the iMX937/952. Thanks. Re: [OSM-iMX937/952] Schematic review iMx937 and iMx952 are pretty new product since both of them is at preproduction phase. Please contact dedicated FAE for detailed datasheet and user manual Q1 : All platforms that have transmitters supporting 8.0 GT/s must implement the 176 nf to 265 nF CTX value. Platforms operating at 2.5 or 5.0 GT/s only may increase that range to 75 nf to 265 nF. For pull down capacitor, no comments since it may not be necessary I.mX937 === 1 x PCIe Gen 3.0 x1 Lane(2.5G mux) I.mX952 === 1x PCIe Gen 3.0 x1 lane (1G SGMII mux) i.mX95 === 2x PCIe Gen 3.0 x1 Q2: There are some capacitor on page5 for DDR already. Not sure it is duplicated on page4. LPDDR5 design guideline may be request from memory vendor for more detailed information due to PI consideration For VREFH_ADC0, 1 0.01 µf+0.1 µf could be a possible option but may not be deleted due to noise filter
View full article
MC705J1ACDWE 代金引換の確認が必要です ネタバレ (ハイライトして読む) MC705J1ACDWE製品は販売終了(EOL)となりました。この製品のウェハ拡散位置(COD)をご確認いただけますでしょうか。よろしくお願いいたします。 MC705J1ACDWE製品は販売終了(EOL)となりました。この製品のウェハ拡散位置(COD)をご確認いただけますでしょうか。よろしくお願いいたします。 回复: MC705J1ACDWE Need comfirm COD ご返信とご支援ありがとうございます。 さらに、別の情報源から入手した元のラベル情報には「Diffused In:TH」と記載されています。この情報を使って確認することは可能でしょうか? Re: MC705J1ACDWE Need comfirm COD ご不便をおかけし申し訳ありません。この終末期/廃止型ファミリの部品番号に関する情報は提供できません。 よろしくお願いいたします。 回复: MC705J1ACDWE Need comfirm COD 情報源の確認を手伝ってもらえますか? この問い合わせについて、製品販売代理店にお問い合わせください。これにより、対応するCODを見つけるのに役立ちます。 よろしくお願いいたします。
View full article
在调用 mlockall(MCL_FUTURE) 的进程中使用 iMX8MP GPU 会导致内核 BUG() 一位客户报告了一个与使用 iMX8MP GPU(使用 EGL 绘图)相关的问题。当初始化 GPU 的进程先前调用 mlockall(MCL_FUTURE) 时,一旦 CMA 区域被映射到用户空间,内核就会报告以下 BUG(): Kernel BUG at remap_pfn_range_internal+0x23c/0x2c8 Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP CPU: 0 PID: 3197 Comm: galcore_window_ Tainted: G O 6.6.142-7.7.0-devel #1-Torizon Hardware name: Toradex Verdin iMX8M Plus WB on Verdin Development Board (DT) pc : remap_pfn_range_internal+0x23c/0x2c8 x27: 00000000a2100000 x20: 0068000000000fcb x19: 0000007f90000000 ^^^^^^^^^^^^^^^^^^^^^^ the PTE already present Call trace: remap_pfn_range_internal+0x23c/0x2c8 remap_pfn_range+0x24/0x58 dma_direct_mmap+0xf4/0x150 dma_mmap_attrs+0x18/0x3c _CMAFSLMapUser+0x9c/0x150 [galcore] gckOS_LockPages+0xe4/0x148 [galcore] gckKERNEL_MapVideoMemory+0x90/0x1dc [galcore] gckVIDMEM_NODE_LockCPU+0x1b4/0x250 [galcore] _LockVideoMemory.isra.0+0x1f4/0x28c [galcore] gckKERNEL_Dispatch+0x210/0x1730 [galcore] gckDEVICE_Dispatch+0xcc/0x220 [galcore] drv_ioctl+0x340/0x444 [galcore] __arm64_sys_ioctl+0xac/0xf0 Kernel panic - not syncing: Oops - BUG: Fatal exception mlockall(MCL_FUTURE) 通常用于实时应用程序,而报告此问题的客户正在使用 CODESYS 来驱动其 HMI。 我们利用人工智能辅助分析了该问题,并找到了该问题触发原因的合理解释: galcore 驱动程序中的 CMA 分配器不包含 .mmap() 方法。钩。在 _CMAFSLMapUser() 执行期间,它调用 mmap() 获取 vma,然后使用该 vma 通过 find_vma() 定位 CMA 区域。mmap() 的调用方式导致内核延迟分配 SHM 区域以满足请求。正常情况下,当找到 CMA 区域并重新映射时,此分配会在片刻后被丢弃。 但是,当 MCL_FUTURE 处于活动状态时,内核不能再延迟分配 SHM 区域,因此它会在 mmap() 返回之前填充整个区域。在这种情况下,该地址上有有效的页面,而稍后对 remap_pfn_range() 的调用最终会默默地丢弃内存管理维护信息,这正是 BUG() 所阻止的。 我将附上一个 zip 文件,其中包含一个程序的源代码,该程序可以稳定地重现该问题,而无需运行 CODESYS。AI代理建议使用以下补丁来修复此问题: diff -uNr a/hal/kernel/inc/gc_hal_options.h b/hal/kernel/inc/gc_hal_options.h --- a/hal/kernel/inc/gc_hal_options.h 2026-09-04 13:00:44.596621860 +0000 +++ b/hal/kernel/inc/gc_hal_options.h 2026-09-04 13:01:15.643862002 +0000 @@ -1471,9 +1471,17 @@ * Enable this macro can replace the /dev/zero by anon_inode: * [galcore] in /proc/ /maps. * Without the macro, run 'cat /proc/ /maps' will print "/dev/zero". + * + * It is also what gives the allocators an ->mmap handler, which is + * required so that the reservation made by vm_mmap() is created as a + * device mapping (VM_IO | VM_PFNMAP) rather than as ordinary anonymous + * memory. Without it, a process that has called mlockall(MCL_FUTURE) + * gets the range pre-faulted inside vm_mmap(), and the subsequent + * remap_pfn_range() then hits BUG_ON(!pte_none()) in remap_pte_range(). + * See tmp_mmap() in gc_hal_kernel_allocator.c. */ #ifndef gcdANON_FILE_FOR_ALLOCATOR -# define gcdANON_FILE_FOR_ALLOCATOR 0 +# define gcdANON_FILE_FOR_ALLOCATOR 1 #endif /* diff -uNr a/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c b/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c --- a/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c 2026-09-04 13:00:44.605314869 +0000 +++ b/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c 2026-09-04 13:01:15.644216883 +0000 @@ -400,7 +400,13 @@ gcmkHEADER_ARG("Allocator=%p Mdl=%p Cacheable=%d", Allocator, Mdl, Cacheable); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) +#if gcdANON_FILE_FOR_ALLOCATOR + /* Same as the gfp, dma and reserved_mem allocators: go through the + * allocator's anon file so that its ->mmap handler runs. */ + userLogical = (gctPOINTER)vm_mmap(Allocator->anon_file, +# else userLogical = (gctPOINTER)vm_mmap(gcvNULL, +# endif 0L, Mdl->numPages * PAGE_SIZE, PROT_READ | PROT_WRITE, diff -uNr a/hal/os/linux/kernel/gc_hal_kernel_allocator.c b/hal/os/linux/kernel/gc_hal_kernel_allocator.c --- a/hal/os/linux/kernel/gc_hal_kernel_allocator.c 2026-09-04 13:00:44.603242857 +0000 +++ b/hal/os/linux/kernel/gc_hal_kernel_allocator.c 2026-09-04 13:01:15.644041018 +0000 @@ -104,6 +104,36 @@ static int tmp_mmap(struct file *fp, struct vm_area_struct *vma) { + /* + * Declare the reservation as a device mapping with raw PFNs, before + * mmap() returns it to the caller. remap_pfn_range() sets both flags + * anyway; setting them here only makes them effective from the moment + * the VMA is created, and that is what matters: + * + * - the kernel treats VM_IO | VM_PFNMAP as VM_SPECIAL, documented in + * include/linux/mm.h as "Special vmas that are non-mergable, + * non-mlock()able". mmap_region() therefore clears VM_LOCKED from + * this VMA and leaves mm->locked_vm alone, and __mm_populate() + * skips it outright ("if (vma->vm_flags & (VM_IO | VM_PFNMAP)) + * continue;" in mm/gup.c). + * + * - so a process that has called mlockall(MCL_FUTURE) no longer has + * this range pre-faulted inside vm_mmap(). Every other mapping in + * that process keeps being locked and pre-faulted as before; only + * device memory, which is neither pageable nor swappable and gains + * nothing from being pre-faulted, is left out. + * + * - and the allocator's own remap_pfn_range(), a few microseconds + * later, therefore finds an empty range instead of one the kernel + * has just populated, so it no longer trips + * BUG_ON(!pte_none(ptep_get(pte))) in remap_pte_range(). + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_IO | VM_PFNMAP); +#else + vma->vm_flags |= VM_IO | VM_PFNMAP; +#endif + return 0; } 上游驱动程序使用了一种不同的机制来绕过这个问题。其他 galcore 分配器使用相同的模式(调用 vm_mmap 获取 vma),因此很可能容易受到相同的 BUG() 的影响。 请您调查并修复 galcore 驱动程序?这个问题导致实际应用场景无法正常运行,直接影响到我们的客户。 谢谢! 拉斐尔 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() 嗨@rbeims 让我先运行一下测试,然后再和GPU团队确认。 此致, 志明 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() @Zhiming_Liu ,你好,请问你成功复现了这个bug吗?如果可以,请问预计何时能在BSP中实现该修复?谢谢。 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() 您好@Zhiming_Liu ,感谢您提供的清晰报告。完全理解,我们也预料到这种情况会发生。一切都好。 请继续推进这项工作,如有任何进展,请与我们联系。 谢谢你, 阿尔瓦罗。 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() 嗨@alvaro_tx 我们的内部团队测试了这个补丁。虽然它直接解决了客户遇到的问题,但在其他应用程序的测试过程中却造成了问题。我们仍在调查此事,尚未得出最终结论。 此致, 志明 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() @Zhiming_Liu ,调查有进展吗? 如果没有进展,能否与我们联系,告知您在其他应用程序测试过程中遇到了哪些问题? 客户需要推进开发工作,如果官方没有解决方案,他们正在考虑应用此补丁,但他们想知道其缺点。 谢谢你, 阿尔瓦罗。 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() 嗨@alvaro_tx @rbeims 关于客户提到的问题,相关的补丁目前正在合并中;但是,我发现 NXP R&D 的补丁是基于 EGL 库,而不是 Linux 驱动程序。 此致, 志明 Re: Using iMX8MP GPU on a process that call mlockall(MCL_FUTURE) causes kernel BUG() 谢谢@Zhiming_Liu 。 我发现 NXP 研发部门提供的补丁是基于 EGL 库,而不是 Linux 驱动程序。 这是否意味着这项更改将应用于闭源的EGL库,而不是开源的Linux驱动程序? 如果您不打算公开此补丁,请告知我们补丁的应用范围,特别是Linux内核版本(6.6、6.18?)。 我们是否可以理解为,研发团队已经确认,即使补丁方案与之前的变通方法不同,它也能解决这个问题?
View full article