Multi Source Translation Content

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Multi Source Translation Content

讨论

排序依据:
i.MX9 ELE 的已知问题 根据 2025 年的讨论,i.MX 9 存在一个问题,即安全世界和非安全世界同时使用其 MU 与 ELE 通信。讨论中提到,计划在 2025 年第三季度修复该问题。这个修复程序发布了吗?该修复是在 ELE 固件中实现的,还是需要修改 Cortex A55 代码?如果该修复程序已在 ELE 固件中实现,那么哪个固件版本是第一个包含该修复程序的? 根据i.MX Linux 发行说明 (RN00210),电压变化会导致已知的 ELE 问题。这个问题会造成什么影响?即使发送了 ELE_VOLT_CHANGE_START_REQ 请求,电压故障检测器也会触发吗?电压变化会对随机数生成器产生影响吗?RN00210 仅针对 i.MX 93 提到了该问题。与 i.MX 91 非常相似的机型是否也受到影响? 背景:我们需要从 OP-TEE 内部可靠地访问 ELE,但我们不能指望 Linux 能够正常运行。 安全 Re: Known issues with i.MX9 ELE 你好, 您是在寻找特定型号的 i.MX9 吗? 这会影响该系列中的不同处理器,例如,在 i.MX91/93 上,OPTEE 使用专用的 Trusted MU 进行通信,因此这些处理器不受影响。 关于 ELE 电压变化问题,这是一个命令排序问题,而不是随机数据损坏问题。在接受 ELE_VOLT_CHANGE_START_REQ 后,ELE 会暂时禁用其电压故障传感器,并立即期望收到 ELE_VOLT_CHANGE_FINISH_REQ。因此,并发的 HRNG 请求可能会失败或挂起;如果完成请求延迟超过超时时间,ELE 可能会中止序列并 RESET SoC。 最后,i.MX 91 通常只在标称驱动电压和低驱动电压之间切换,两者之间的差异约为 50 mV,预计不会触发 GDET,因此它不受此问题的影响。 此致敬礼/Saludos, 阿尔多。 Re: Known issues with i.MX9 ELE 我在最初的问题中链接的讨论听起来像是并发 ELE 请求存在问题,尽管安全世界有自己的 MU。引用讨论中的内容: >>>>>> I'm aware that the >>>>>> i.MX93 has two MUs one for the secure and one for the non-secure >>>>>> world. But I'm really concerned about the fact that both MUs can't >>>>>> be used at the same time from both world: >>>>> >>>>> Yes, you are correct. >>>>> >>>>> Fix is still work in progress. Marco Felsch 在 GitHub 上链接到了 NXP 一位工程师的这条评论: 当内核和 OP-TEE 同时向 ELE 发出请求时,就会出现问题,而这并非 RNG 特有的问题。我们正在努力解决这个问题,很快就会有解决方案。 那么,这个解决方案已经发布了吗? 当非安全世界滥用 ELE_VOLT_CHANGE_START_REQ 来停止安全世界中的随机数生成时,重置 SoC 听起来是可以接受的。
查看全文
MCU选择和显示屏尺寸? 大家好,我正在做一个小项目,通过公共 API 获取我所在城市的本地车站的实时列车数据。我最终想通过微控制器将此内容显示在屏幕上,并将标牌固定在墙上。您对MCU/显示器有什么推荐吗?我希望显示屏尺寸大一些(如果可能的话,宽度至少要30厘米)。欢迎提出任何建议,因为我之前只使用过带小型液晶显示屏的mBed和Arduino。
查看全文
优惠券无效 FRDM-MCXN236 还有其他人遇到免费板优惠券代码无法使用的问题吗? NXP 正在宣传赠送一块免费电路板供用户入门,但结账时优惠券代码显示无效,即使该产品显然有库存。这是系统故障吗?还有其他人遇到这个问题吗? 开发板 FRDM培训 Re: Coupon not valid FRDM-MCXN236 很遗憾,我们的市场营销团队通知我们,此优惠券已达到使用上限,不会再延长有效期。 优惠券将在未来几天内失效。由此给您带来的不便,我们深表歉意,并感谢您的理解。
查看全文
FLS Driver Support for Micron MT35XU01GBBA on S32G399 Hi NXP Experts, I am an AUTOSAR software engineer working with the S32G399 platform. From my understanding, the MX25UW51245GXDR00 serial NOR Flash is mounted on the S32G-VNP-RDB3 board. The FLS driver examples provided in SW32G_RTD_4.4_5.0.0_QLP07 indicate support for the S32G-VNP-RDB3 board, so I assume the NXP FLS driver has been validated with the MX25UW51245GXDR00 device. I have recently received a customer board that uses a Micron MT35XU01GBBA serial NOR Flash instead. Could you please clarify whether the FLS driver included in SW32G_RTD_4.4_5.0.0_QLP07 supports the Micron MT35XU01GBBA device? If support is available, are there any specific configuration changes or limitations that I should be aware of when migrating from the MX25UW51245GXDR00 to the MT35XU01GBBA? Re: FLS Driver Support for Micron MT35XU01GBBA on S32G399 Thank you so much!!! Re: FLS Driver Support for Micron MT35XU01GBBA on S32G399 Hi, Thanks for sharing the details. I will review the relevant parameters and requirements to consider when migrating the QSPI Flash from the MX25UW51245GXDR00 to the Micron MT35XU01GBBA, including FLS driver support, required configuration changes, and any potential limitations. I will get back to you with more details once I complete the review. Best regards.
查看全文
CodeWarrior MPC82xx 调试版许可证 我需要使用 CodeWarrior for Power Architecture 8.8.x 调试 PowerQuicc MPC82xx 处理器。在NXP网站上查找后,似乎唯一的选择是价格昂贵的CW-DS-NETAPPS许可证。有没有更便宜的替代方案?我只需要能够通过我已有的TAP pod进行调试/JTAG操作即可。
查看全文
Known issues with i.MX9 ELE According to this discussion from 2025 there was an issue on i.MX 9 when both the secure and non-secure world were using their MUs at the same time to communicate with the ELE. In the discussion it was said that a fix was planned for Q3 2025. Has this fix been released? Is the fix implemented in the ELE firmware or did it need modifications to the Cortex A55 code? If it was implemented in the ELE firmware, which firmware version was the first one to contain the fix? According to the i.MX Linux Release Notes (RN00210) there is a known ELE problem with voltage changes. What is the impact of this problem? Will the voltage glitch detector trigger even if ELE_VOLT_CHANGE_START_REQ was sent? Or will the voltage change impact the random number generator? RN00210 mentions the problem only for i.MX 93. Is the very similar i.MX 91 affected as well? Background: We need reliable access to the ELE from within OP-TEE and can't trust Linux to behave nicely. Security Re: Known issues with i.MX9 ELE Hello, Are you looking for an specific i.MX9? This impact different processors in the familly, for example on the i.MX91/93 OPTEE uses a dedicated Trusted MU for the communication so this processors are no impacted. Regarding ELE voltage change issue, the issue is a command-sequencing problem, not corruption of random data. After ELE_VOLT_CHANGE_START_REQ is accepted, ELE temporarily disables its voltage-glitch sensors and expects ELE_VOLT_CHANGE_FINISH_REQ immediately. A concurrent HRNG request can therefore fail or hang; if the finish request is delayed beyond the timeout, ELE may abort the sequence and reset the SoC. And finally no, i.MX 91 normally switches only between nominal and low-drive voltage, with an approximately 50 mV difference that is not expected to trigger GDET, so it is not considered affected by this same issue. Best regards/Saludos, Aldo. Re: Known issues with i.MX9 ELE The discussion I linked in my initial question sounds like there were problems with concurrent ELE requests although the secure world has its own MU. To quote from the discussion: >>>>>> I'm aware that the >>>>>> i.MX93 has two MUs one for the secure and one for the non-secure >>>>>> world. But I'm really concerned about the fact that both MUs can't >>>>>> be used at the same time from both world: >>>>> >>>>> Yes, you are correct. >>>>> >>>>> Fix is still work in progress. Marco Felsch linked to this comment from an NXP engineer on Github: Problem comes when doing simultaneous request to ELE from Kernel and OP-TEE not specific to RNG, and we are working on the solution, which will be available soon. So, has this solution been made available? Resetting the SoC when the non-secure world abuses ELE_VOLT_CHANGE_START_REQ to stop random number generation in the secure world sounds acceptable.
查看全文
Good uses for Smartcard Reader? My Thinkpad T15 has a smartcard reader and I didn’t even know for a year. Is there some cool use for it? At work we use those to encrypt mails but that’s not really something for private use. I’m sure there must be cool things to do with it. Smart Cards Re: Good uses for Smartcard Reader? Hello Sir, This is Fabian from Customer Support. As you may have already seen, smart card readers support a wide range of applications, with authentication and access control being among the most common. However, please note that the reader itself only provides communication compliant with the ISO/IEC 7816-4 standard. To develop a complete solution and operate smart cards, you will need appropriate middleware or enablement software from Lenovo, as well as smart cards from a qualified card provider. For additional guidance, please refer to our Partner Directory for recommended vendors and solution providers.
查看全文
EMIOS counter bus configuration issue Hello experts, I configured .mex file for controller S32K342 with RTD 7.0.0. I am getting following error: I copied the configuration from S32K344 configuration with RTD 6.0.0 (because pin configuration and Peripherals configuration are same). I put all the counter bus correctly which we require. few screenshots for Emios_Mcl_Ip   Thanks. Re: EMIOS counter bus configuration issue Thank you for quick response. No, I did not copy entirely. I created new project with choosing 342 controller and copied the peripheral configurations. Not the whole project. Hope this helps. Thanks. Re: EMIOS counter bus configuration issue Thank you for the project. I copied the .mex file into one of my projects and, interestingly, I don't see any errors when generating code from it.. Could you please clarify what you mean by: "I copied the configuration from an S32K344 configuration with RTD 6.0.0"? Did you copy the .mex file from a project that was originally created with RTD 6.0.0? Regards, Daniel Re: EMIOS counter bus configuration issue Please the refer the configuration shared. Thanks. Re: EMIOS counter bus configuration issue Hello @sbidkar, Can you please share the .mex file? Thank you
查看全文
スマートカードリーダーの便利な活用法は? 私のThinkPad T15にはスマートカードリーダーが搭載されているのに、1年間もそのことに気づかなかった。 何か面白い使い道はあるの?職場ではメールの暗号化にそれらを使用していますが、それは個人的な用途にはあまり適していません。きっと何か面白い使い道があるはずだ。 スマート・カード Re: Good uses for Smartcard Reader? お世話になります。 こちらはカスタマーサポートのファビアンです。 すでにご覧の通り、スマートカードリーダーは幅広い用途に対応しており、認証やアクセス制御はその中でも最も一般的なものです。ただし、リーダー自体はISO/IEC 7816-4規格に準拠した通信のみを提供する点にご注意ください。完全なソリューションを開発しスマートカードを運用するには、Lenovoの適切なミドルウェアやイネーブルメントソフトウェア、そして資格を持つカードプロバイダーのスマートカードが必要です。 追加のガイダンスについては、推奨ベンダーやソリューションプロバイダーについてはパートナー一覧をご参照ください。
查看全文
EMIOSカウンタバス構成の問題 こんにちは、専門家の皆様、 .mexを設定しましたRTD 7.0.0でコントローラ S32K342ファイルを作成しました。 以下のエラーが発生しています。 RTD 6.0.0のS32K344設定から設定をコピーしました(ピン構成とペリフェラル構成が同じため)。 必要なカウンターバスをすべて正しく設置しました。 Emios_Mcl_Ip のスクリーンショットをいくつか   ありがとうございます。 Re: EMIOS counter bus configuration issue 迅速なご対応ありがとうございます。 いいえ、完全にコピーしたわけではありません。342コントローラーを選択して新しいプロジェクトを作成し、ペリフェラルの設定をコピーしました。プロジェクト全体ではない。 これがお役に立てば幸いです。 ありがとうございます。 Re: EMIOS counter bus configuration issue プロジェクトをありがとうございました。 .mexファイルをコピーしましたファイルを私のプロジェクトの一つに取り込んでみたところ、興味深いことに、そこからコードを生成してもエラーは発生しませんでした。 「RTD 6.0.0のS32K344構成から設定をコピーした」というのはどういう意味か、もう少し詳しく教えていただけますか?.mexファイルをコピーしましたか?RTD 6.0.0で作成されたプロジェクトのファイルですか? よろしくお願いいたします。 ダニエル Re: EMIOS counter bus configuration issue 共有されている設定ファイルを参照してください。 ありがとうございます。 Re: EMIOS counter bus configuration issue こんにちは、 @sbidkar さん、 .mexファイルを教えていただけますかファイル? よろしくお願い申し上げます。
查看全文
GPIO 简介:如何读取微控制器 (MCX A153) 的引脚并控制 LED(日语博客) 目录 介绍 了解MCX A153微控制器的引脚配置 GPIO 使用设置 检查引脚与电路板(FRDM-MCXA153)之间的关系。 演示:执行 GPIO 设置并体验 LED 控制。 额外知识点:了解LED灯的“开/关”原理 附加题——如果将两个LED并联会发生什么?   介绍 作为嵌入式系统开发的初学者,我是在接到撰写一篇关于GPIO文章的邀请后开始学习它的。本文记录了我尝试点亮单个LED灯的过程中,通过反复试验所学到的知识和心得体会。 本文解释了如何使用 GPIO(通用输入/输出),它是微控制器开发中最基本的外部设备之一。 GPIO 是嵌入式系统的基础,用于将微控制器连接到外部电路,实现诸如打开 LED、读取开关状态和接收来自传感器的信号等功能。 另一方面,在实际的微控制器开发中,“使用GPIO”并不仅仅意味着编写程序。微控制器有许多引脚,每个引脚除了GPIO之外还被分配了其他功能,例如定时器和通信接口。 所以, 要使用 GPIO,您需要了解数据手册中的引脚分配和功能。 PinMUX(引脚复用)设置,用于将GPIO分配给引脚 输入/输出方向设置 这件事必须妥善处理。 这次,我们将以FRDM-MCXA153为例,研究 MCX A153 的引脚配置和 PinMUX 机制,使用 Pins Tool 配置 GPIO 设置,最后演示连接到面包板上的 LED 闪烁。   了解MCX A153微控制器的引脚配置 FRDM-MCXA153搭载了一颗型号为 MCXA153VLH 的微控制器。该微控制器采用 LQFP 64 封装,共有 64 个引脚。其中 52 个引脚可用作 GPIO。其余引脚包括电源引脚 (VDD/VSS)、USB 引脚和模拟输入引脚,这些引脚不能用作 GPIO。 然而,即使它标有“52个GPIO”,这并不意味着这52个引脚都专用于GPIO。许多可用于GPIO的引脚也与其他外设功能(例如UART、SPI、I²C和定时器)共享。因此,要真正将它们用作GPIO,您需要使用PinMUX函数将这些引脚配置为GPIO。 让我们从数据手册中查看MCX A153的引脚配置。从第54页开始列出了每个引脚可以分配的功能。 例如,查看引脚名称为 P1_8 的“引脚复用分配”信息,可以看到有六种可能的功能。GPIO 被分配到“ALT0 - P1_8”。其他分配包括“ALT2 - LPUART1_RXD”,表示它将被用作 UART 接收端 (RXD);以及“ALT3 - LPI2C0_SDA”,表示它将被用作 I²C 数据线 (SDA)。 如您所见,一个引脚可以分配给多个功能,不仅包括 GPIO,还包括 UART、I²C 和定时器。   GPIO 使用设置 1. 选择引脚功能(PinMUX) 如前文所述,P1_8 引脚有多种潜在功能,包括 GPIO、UART 和 I²C。但是,同一个引脚不能同时用作 GPIO 和 UART。 因此,典型的微控制器都配备了一种称为 PinMUX 的机制。 PinMUX 就像一个拨动开关,用于将单个物理引脚连接到内部外设。 例如,P1_8 有六个潜在的连接目标。通过使用 PinMUX 选择 GPIO,P1_8 即可用作 GPIO 引脚。 2. 设置引脚的电气特性。 引脚不仅可以配置其功能,还可以配置其电气特性。典型设置包括: • 引体向上 • 下拉 驱动力 明渠 以下是一些示例。例如,开关输入通常会启用上拉电阻,驱动 LED 或高速信号时可以调整驱动强度。即使用作 GPIO,也必须根据应用进行适当的电气设置。 本文将省略对这些电气特性的详细解释。 3. 设置 GPIO 的输入/输出方向。 最后一步是确定信号流的方向。GPIO 有两种主要的工作模式。 • 输入 – 接收来自外部的信号 • 输出 – 向外部发送信号 微控制器内部在输入输出方面究竟发生了什么? MCX A153 是一款工作电压为 3.3V 的微控制器。因此,其 GPIO 引脚基本上处理两种状态:低电平(约 0V)和高电平(约 3.3V)。A153 的工作电压范围为 1.71V 至 3.6V,FRDM 板使用 3.3V。 GPIO输出值 引脚电压 低(0) 大约 0V 高(1) 约3.3伏 例如,如果您将某个 GPIO 引脚设置为输出并连接一个外部 LED,将其设置为高电平(约 3.3V)会在 GPIO 引脚和 GND 之间产生电位差,从而允许电流流过 LED。将其设置为低电平(约 0V)会消除与 GND 之间的电位差,因此没有电流流过。换句话说,LED 的“闪烁”是由于 GPIO 引脚的电压在高电平 (1) 和低电平 (0) 之间反复切换,从而导致 LED 闪烁和熄灭交替发生。 另一方面,在输入模式下,微控制器会监控GPIO引脚的状态。例如,如果从外部电路输入约3.3V电压,则识别为高电平(1);如果输入约0V电压,则识别为低电平(0)。 上述引脚功能选择、电气特性设置和输入/输出设置均可通过 GUI 使用引脚工具(NXP 的免费配置工具中包含)进行配置。   检查引脚与电路板(FRDM-MCXA153)之间的关系。 到目前为止,我们已经了解到,要使用 GPIO,需要配置 PinMUX 设置和输入/输出方向设置。 接下来,让我们确认 FRDM-MCXA153 板上 MCU 引脚的连接位置,同时牢记我们将要进行的演示。 检查原理图,确认上一章中作为示例使用的引脚“P1_8”的布线位置。 查看电路图第 8 页,我们可以看到 P1_8 连接到 FRDM-MCXA153 上的Arduino 接头 J2 的 D18 。 FRDM-MCXA153原理图 那么,Arduino 接头 J2 上的 D18 在哪里呢? 接下来,我们来查阅一下电路板用户手册。 FRDM-MCXA153 开发板用户手册 第 6 页包含板上安装的连接器的示意图,这使我能够确定 Arduino 接头 J2 上的 D18 的位置。 在本练习中,我们将使用面包板上的 D18 引脚连接一个外部 LED。但是,如果您没有面包板或 LED,也可以使用 FRDM-MCXA153 开发板上自带的 RGB LED。 然而,有一点需要注意。当使用板载 RGB LED 时,LED 的阳极 (+) 连接到 VDD_BOARD (3.3V),阴极 (-) 连接到 GPIO。因此,与前面提到的外接 LED 不同,将 GPIO 设置为高电平 (1) 也会使 GPIO 电压达到约 3.3V,LED 两端的电位差几乎消失,导致 LED 熄灭。 另一方面,将 GPIO 设置为低电平 (0) 会在 LED 两端产生电位差,从而导致电流流动并使 LED 点亮。 当你检查电路图中的每个引脚时…… P3_12 是一个红色 LED P3_13 是一个绿色 LED P3_0 是一个蓝色 LED 它支持这些功能。通过配置引脚复用器 (PinMUX) 设置和输入/输出设置,您还可以使用板上的 LED 指示灯来验证其运行情况。 这样,您就可以使用电路图和电路板用户手册来检查微控制器内部的物理引脚在电路板上的连接位置。   演示:执行 GPIO 设置并体验 LED 控制。 在本章中,我们将使用 MCUXpresso 配置工具中的引脚工具来配置 GPIO 并控制面包板上外部连接的 LED。 演示中使用的设备: FRDM-MCXA153 面包板 LED • 电阻器和跳线 本演示将假设您已在 VS Code 环境中安装了 MCUXpresso SDK 和配置工具。 *如果您尚未安装 MCUXpresso SDK 和配置工具,请参阅此博客文章。 MCUXpresso 配置工具:引脚工具的使用方法(日语博客) 注意:虽然博客文章描述了 FRDM-MCXN947 的 SDK 安装,但本文中请安装 FRDM-MCXA153 的 SDK。 我手头有一个红色LED和一个绿色LED,但我不知道它们的型号,所以我先尝试点亮红色LED。我有一个390Ω的电阻。红色LED的正向电压(Vf)通常在1.8~2.2V之间,所以我假设它是2.0V,并计算流过LED的电流。 微控制器的工作电压为3.3V。Vf使用 2.0V 电压和 390Ω 电阻,可以根据欧姆定律计算电流值,如下所示。请注意,LED 具有规定的最大正向电流 (Ifmax),许多通用 LED 的 Ifmax 为 20mA。务必谨慎选择电阻值,因为超过 20mA 的电流可能会损坏 LED。 此外,GPIO引脚的输出电流也有限制。根据数据手册,MCX A153在正常工作状态下的电气特性是基于4mA电流(高驱动引脚为6mA)设定的。因此,当使用GPIO引脚直接点亮LED时,需要选择一个合适的电阻值,该电阻值不仅要考虑LED的电流限制,还要考虑GPIO引脚的电流限制。 电路板和面包板接线 首先,我们要进行线路连接。 在 FRDM 板上,我们将使用之前确定的 Arduino 接头 J2 上的“D18”和“14 GND” 。 下图是根据电路板用户手册绘制的。 FRDM-MCXA153 开发板用户手册 请参考以下视频了解接线说明。 (function() { var wrapper = document.getElementById('lia-vid-6405195304112w960h540r888'); 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'); }); }); }); } }})(); (显示我的视频) 导入示例代码 接下来,我们将从 FRDM-MCXA153 SDK 导入示例代码。 点击左侧面板中的“从存储库导入示例”。 在右侧显示的选项卡中,选择“存储库”下的导入的 FRDM-MCXA153 SDK,然后选择“板”下的 FRDM-MCXA153。 使用的模板是“driver_examples/gpio/gpio_led_output”。 选择所需的工具链,然后单击“导入”。 导入完成后,它将被添加到左侧面板的“项目”部分。 查看源代码 gpio_led_output.c。 这次,我们要使用引脚工具配置 GPIO 输入/输出设置,因此我们将从源代码中删除红色方框内包含的 GPIO 输出设置代码。 使用引脚工具配置GPIO设置。 接下来,打开配置工具。右键单击项目,然后选择“使用 MCUXpresso 配置工具打开”。稍等片刻,配置工具将启动。 打开配置工具后,首先在右侧面板的“概览”中选择“引脚”。 图钉工具现已打开。 启用引脚 P1_8。 点击 P1_8 将打开另一个窗口,如下图所示。在此窗口中找到“GPIO1:GPIO,8(P1_8)”,并勾选其旁边的复选框。 选中该复选框后,将出现以下窗口,但您可以单击“否”将其关闭。 完成这些步骤后,P1_8 将添加到引脚工具底部的布线详细信息中。 接下来,按如下方式更改 GPIO 输入/输出设置。 将输出端的引脚 #38 (P3_12) 连接到未指定端,将未指定端的引脚 #2 (P1_8) 连接到输出端。 GPIO #38 的初始状态将出现错误,请将其从逻辑 0 更改为 n/a。 完成这些步骤后,您就可以重写示例代码了。首先,点击“配置工具”屏幕左上角的“更新代码”。 此时会弹出一个窗口。您可以在这里根据需要查看代码更改。已修改的文件旁边会显示“更改”字样。 返回 VS Code 后,您会在屏幕顶部看到三个复选框。请确保选中它们,然后单击“确定”。 不久之后,源代码的修改就会完成。 接下来,我们将修改源代码 gpio_led_output.c 中的 GPIO 控制目标。 打开 gpio_led_output.c 文件时, 内容如下:   while (1) { delay(); GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN); } 按如下方式修改 GPIO_PinInit() 和 GPIO_PortToggle() 的内容: 这里,P1_8 被指定为控制目标,每次调用该函数时,P1_8 的状态都会在高 (1) 和低 (0) 之间切换。 while (1) { delay(); GPIO_PortToggle(GPIO1, 1u << 8); } 更多详情:GPIO 引脚以 Px_y 格式表示,其中x为 GPIO 端口号, y为该端口内的位位置。例如, P1_8表示“GPIO 端口 1 的第 8 位”。 在代码中 GPIO_PortToggle(GPIO1, 1U << 8); 在, GPIO1 1U << 8 表示 GPIO 端口 1, 是一个位掩码,其中只有第 8 位设置为 1。 1U << 8 ↓ 0000 0001 0000 0000 (2進数) 这样就可以只反转(在高电平和低电平之间切换)GPIO 端口 1 中的第 8 位。 将 PC 连接到 FRDM-MCXA153。 调试(构建、编写和运行应用程序)。 调试过程完成后,程序将在断点处停止,因此请点击屏幕顶部的“|▶”图标。 LED灯将开始闪烁。 (function() { var wrapper = document.getElementById('lia-vid-6404528566112w304h540r105'); 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'); }); }); }); } }})(); (显示我的视频) 额外知识——了解 LED 的“开/关”状态 顺便问一下,这个LED灯何时亮起,取决于GPIO输出是高电平(1)还是低电平(0)?我之前提到过,当输出高电平(1)时它会亮起,但我们来验证一下是否正确。 以下是我们之前使用的代码。 `while(1)` 语句表示一个无限循环,重复执行花括号 {} 内的代码。 此外,delay() 函数用于等待特定时间段。GPIO_PortToggle() 是一个 GPIO 控制函数,用于反转高电平 (1) 和低电平 (0)。 while (1) { delay(); GPIO_PortToggle(GPIO1, 1u<<8); } } 但是,这段代码并没有告诉我们,当 LED 为高电平 (1) 或低电平 (0) 时,LED 是亮起还是熄灭。 因此,我们使用不同的函数 GPIO_PinWrite() 来显式控制 GPIO 的状态。 具体来说,代码将修改为在高电平 (1) 状态下等待一次 delay() 调用,然后在低电平 (0) 状态下等待五次 delay() 调用。这样应该能让 LED 保持熄灭状态更长时间。 while (1) { GPIO_PinWrite (GPIO1,8U ,1); delay(); GPIO_PinWrite(GPIO1,8U ,0); delay(); delay(); delay(); delay(); delay(); } 运行调试程序,然后点击屏幕顶部的“|▶”图标。 (function() { var wrapper = document.getElementById('lia-vid-6404528052112w304h540r114'); 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'); }); }); }); } }})(); (显示我的视频) 正如预期的那样,LED灯关闭了更长时间。 这使我们能够验证 LED 在点亮时输出高电平 (1),在熄灭时输出低电平 (0)。 总结一下,当 GPIO 为高电平 (1) 时,设置为 GPIO 引脚的 P1_8 处的电压约为 3.3V。该电压与 GND 之间形成电位差,导致电流流过电阻和 LED。此时,LED 两端施加正向电压(约 2.0V),剩余的约 1.3V 电压施加在电阻两端。因此,LED 点亮。 另一方面,当 GPIO 为低电平 (0) 时,P1_8 端的电压接近 0V。由于 GPIO 引脚与 GND 之间没有电位差,因此没有电流流过,LED 熄灭。 如果你觉得使用大量的 `delay()` 函数看起来很丑陋,你也可以使用循环函数。 while (1) { GPIO_PinWrite(GPIO1, 8U, 1); delay(); GPIO_PinWrite(GPIO1, 8U, 0); for (int i = 0; i < 5; i++) { delay(); } } 附加题——如果将两个LED并联会发生什么? 我尝试将手边的一个绿色LED与一个红色LED并联起来。 由于绿色 LED 的正向电压 (Vf) 一般为 2.0 至 2.2V,我假设它与红色 LED 类似,为 2.0V,并搭建了以下电路。 由于无需更改引脚设置,我使用之前的代码进行调试,红色 LED 闪烁,但绿色 LED 没有闪烁。这是为什么呢? (function() { var wrapper = document.getElementById('lia-vid-6404530194112w304h540r514'); 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'); }); }); }); } }})(); (显示我的视频) LED的特性是,当正向电压(Vf)超过其值时,电流会迅速增加。因此,如果将一个红色LED和一个绿色LED简单地并联,电流会集中在Vf较低的LED上,而另一个LED可能几乎不会发光。在这种情况下,红色LED的Vf低于绿色LED,因此电流集中在红色LED上。 当我用测试仪实际测量 LED 两端的电压时,红色 LED 的电压为 1.765V,绿色 LED 的电压为 1.766V。 在这个电压下,红色LED可以点亮,但绿色LED接收到的电压不足以产生足够的电流。因此,红色LED会亮,而绿色LED不会亮,因为几乎没有电流流过它。 如上图所示,简单地将不同类型的LED并联,即使正向电压(Vf)存在微小差异,也会导致电流出现显著偏差。因此,并联LED时,通常的做法是为每个LED串联一个限流电阻。 添加电阻时,需要考虑 GPIO 的电流限制。如果我们像之前那样直接添加一个 390Ω 的电阻并计算电流,那么施加到 GPIO 上的电流将超过 6mA。因此,为了确保总电流不超过 4mA,我们连接了两个 680Ω 的电阻,并搭建了以下电路。 当我再次调试同一段代码时,红色和绿色 LED 都亮了起来。 (function() { var wrapper = document.getElementById('lia-vid-6405719291112w304h540r698'); 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'); }); }); }); } }})(); (显示我的视频) 测量LED两端的电压时,红色LED的电压为1.750V,绿色LED的电压为1.906V。通过在每个LED上串联一个电阻,可以使合适的电流流过每个LED。 本文解释了嵌入式开发初学者会遇到的“问题”和“障碍”,内容涵盖如何解读各种文档、使用配置工具以及LED的工作原理等。我们希望本文能对那些首次尝试使用NXP微控制器实现LED闪烁的用户有所帮助。 =========================​ 我们目前无法 回复 此帖子“ 评论”部分留下的评论。 对于由此造成的不便,我们深表歉意,但 在进行咨询时, 请 参考“ NXP 技术问题 - 如何联系我们 ( 日语博客 ) ” 。 (如果您已经是 恩智浦的 分销商或 与 恩智浦 有合作关系 ,您可以直接咨询您的代表。) 本文以 LED 闪烁为例,解释了如何使用 GPIO(通用输入/输出),这是微控制器开发中最基本的外部设备之一。 GPIO 是许多微控制器开发人员最先接触的外设之一。很多人想用 GPIO 来点亮 LED,但他们可能不知道如何阅读数据手册或如何配置引脚。本文以 FRDM-MCXA153 为例,讲解 GPIO 的基础知识,面向微控制器开发初学者。我们将学习如何从数据手册和电路图中读取引脚信息,如何使用引脚工具配置设置,并最终体验如何控制外部 LED。 (预计时间:15 分钟)*假设开发环境已安装。 MCUXpresso MCUXpresso 配置工具 MCUXpresso IDE MCUXpresso SDK MCX 日本博客
查看全文
GPIO入門:マイコン(MCX A153)のピンを読み解き、LEDを制御する方法(日本語ブログ) 目次 はじめに MCX A153マイコンのピン構成を理解する GPIOを使用するための設定 ピンとボード(FRDM-MCXA153)の関係を確認する デモンストレーション:GPIO設定を行いLED制御を体感する おまけ LEDの「点・滅」について理解する おまけ – 2つのLEDを並列に接続したら?   はじめに 組み込み開発初心者である筆者は、「GPIOについて記事を書いてほしい」という依頼をきっかけにGPIOの学習を始めました。本記事は、LEDを一つ点灯させるために試行錯誤する中で学んだ内容や気づきを、備忘録としてまとめたものです。 本記事では、マイコンを使った開発において最も基本的なペリフェラルの一つであるGPIO(General Purpose Input/Output)の使い方を解説します。 GPIOは、LEDを点灯したり、スイッチの状態を読み取ったり、センサからの信号を受け取ったりと、マイコンと外部回路をつなぐための組み込みシステムの基盤となっています。 一方で、実際のマイコン開発において、「GPIOを使う」と言っても、単にプログラムを書くだけではありません。マイコンには多数のピンが存在し、それぞれのピンにはGPIO以外にもタイマや通信インターフェースなどの機能が割り当てられています。 そのため、 GPIOを利用するには、データシートからピンの配置や機能を理解すること GPIOをピンに割り当てるためのPinMUX(ピン・マルチプレックス)設定 入出力方向の設定 を適切に行う必要があります。 今回はFRDM-MCXA153を題材に、MCX A153のピン構成やPinMUXの仕組みを確認しながら、Pins Tool上でGPIO設定を行い、最終的にはブレッドボード上に接続したLED点滅のデモンストレーションを紹介します。   MCX A153マイコンのピン構成を理解する FRDM-MCXA153にはMCXA153VLHという型番のマイコンが搭載されています。このマイコンはLQFP 64パッケージを採用しており、全部で64本のピンが存在します。そのうち52本がGPIOとして利用可能です。残りは電源端子(VDD/VSS)やUSB端子、アナログ専用端子などGPIOとして利用できない端子で構成されています。 ただし、「52本のGPIOがある」といっても、52本のGPIO専用ピンが用意されているわけではありません。GPIOとして利用可能なピンの多くは、UARTやSPI、I²C、タイマなどの周辺機能と共有されています。そのため、実際にGPIOとして利用する際には、PinMUX機能を使い、そのピンをGPIOとして動作させるための設定が必要になります。 MCX A153のピン構成をデータシートから確認してみます。54ページ以降に各ピンに割り当て可能な機能が一覧で記載されています。 例えば、Pin Name :P1_8 の「Pinmux Assignment」を見ると、6つの機能候補があります。GPIOは”ALT0 - P1_8”が該当します。他にも”ALT2 - LPUART1_RXD”はUARTの受信端子(RXD)、”ALT3 - LPI2C0_SDA”はI²Cデータ線(SDA)として使用することを意味します。 このように1本のピンに対してGPIOだけでなく、UARTやI²C、タイマなどの複数の機能が割り振られていることがわかります。   GPIOを使用するための設定 1. ピン機能の選択(PinMUX) 前節で確認したように、P1_8にはGPIO、UART、I²Cなど複数の機能候補が存在します。しかし、同じピンを同時にGPIOとUARTとして利用することはできません。 そこで一般的なマイコンには PinMUXという仕組みが用意されています。 PinMUXは、1本の物理ピンと内部ペリフェラルを接続するための切替スイッチのようなものです。 例えばP1_8には6つの接続先候補がありました。PinMUXによってGPIOを選択すると、P1_8はGPIOとして利用することができるようになります。 2. ピンの電気的特性を設定する ピンには機能だけでなく、電気的な振る舞いも設定できます。 代表的な設定として、 ・Pull-up(プルアップ) ・Pull-down(プルダウン) ・Drive Strength(ドライブ強度) ・Open Drain(オープンドレイン) などがあります。 例えばスイッチ入力ではプルアップ抵抗を有効にすることが多く、LEDや高速信号を駆動する場合にはドライブ強度を調整することがあります。 GPIOとして使用する場合でも、アプリケーションに応じた適切な電気的設定を行うことが重要です。 本記事ではこの電気的特性に関する詳細な説明は割愛します。 3. GPIOの入出力方向を設定する 最後に決めるのが信号の流れる方向です。GPIOには大きく分けて2つの動作モードがあります。 ・Input(入力) – 外部から信号を受け取る ・Output(出力) – 外部へ信号を出力する Input・Outputとはマイコン内部で何が起こっているのでしょうか? MCX A153は3.3Vで動作するマイコンです。そのためGPIOピンは、基本的にLow(約0V)とHigh(約3.3V)の2つの状態を扱います(なお、MCX A153の動作電圧範囲は1.71V〜3.6Vであり、FRDMボードでは3.3Vが採用されています)。 GPIO出力値 ピン電圧 Low (0) 約0V High (1) 約3.3V 例えば特定のGPIOピンをOutputに設定し、外部にLEDを接続した場合、High(約3.3V)にするとGPIOとGNDの間に電位差が生じ、LEDに電流が流れ、Low(約0V)の状態にするとGNDとの電位差がなくなるので電流が流れなくなります。つまり、LEDの”点滅”はGPIOピンの電圧をHigh(1)とLow(0)の間で切り替えることで点滅と消灯という動作を繰り返していることになります。 一方、InputではGPIOピンの状態をマイコンが監視します。例えば外部回路から約3.3Vが入力されればHigh(1)、約0Vが入力されればLow(0)として認識します。 ここまで説明したピンの機能選択・電気的特性の設定・入出力設定はPins Tool(Pins ToolはNXPが無償提供しているConfig Toolsに含まれます)を用いてGUI上で設定することが可能です。   ピンとボード(FRDM-MCXA153)の関係を確認する ここまでで、GPIOを利用するためにはPinMUX設定や入出力方向の設定が必要であることが分かりました。 続いて今回のデモンストレーションを想定し、MCUのピンがFRDM-MCXA153ボード上のどこに接続されているのかを確認しておきましょう。 Schematics(回路図)を確認し、前章で例として取り上げたピン "P1_8"はどこに引き出されているのかを確認します。 回路図の8ページを見てみると、P1_8はFRDM-MCXA153上にあるArduinoヘッダー: J2のD18に接続されていることがわかります。 FRDM-MCXA153 Schematics では、Arduinoヘッダー J2のD18とはどこでしょうか? 続いてBoard User Manualを確認します。 FRDM-MCXA153 Board User Manual 6ページ目にボードに搭載されているコネクタの外観図が載っており、ArduinoヘッダーJ2のD18はどこかを特定することができました。 今回は勉強のため、D18ピンからブレッドボードを経由してLEDを外部接続しますが、ブレッドボードやLEDをお持ちでない場合は、FRDM-MCXA153のボード上に搭載されているRGB LEDを活用することができます。 ただし一点注意があります。ボード上のRGB LEDを使用する場合はLEDのアノード側(+)がVDD_BOARD(3.3V)に接続されており、カソード側(-)がGPIOに接続されています。そのため、先ほどの外部接続したLEDとは逆でGPIOをHigh(1)にするとGPIO側も約3.3Vとなり、LED両端の電位差がほとんどなくなるためLEDは消灯します。 一方、GPIOをLow(0)にするとLED両端に電位差が生じて電流が流れ、LEDは点灯します。 回路図でそれぞれのピンを確認すると P3_12は赤色LED P3_13は緑色のLED P3_0は青色LED に対応しています。これらのPinMUX設定や入出力設定を行うことでボードに搭載されているLEDを使った動作を確認することもできます。 このように回路図やBoard User Manualを使って、マイコン内部の物理ピンがボード上のどこに接続されているかを確認することができます。   デモンストレーション:GPIO設定を行いLED制御を体感する この章では、MCUXpresso Config Toolsの Pins Tool を使用してGPIOの設定を行い、ブレッドボード上に外部接続したLEDを制御してみます。 デモンストレーションで使用した備品 ・FRDM-MCXA153 ・ブレッドボード ・LED ・抵抗 ・ジャンパ線 また今回はVS Code環境にてMCUXpresso SDKとConfig Toolsをインストール済みという前提でデモンストレーションを進めます。 ※MCUXpresso SDKとConfig Toolsのインストールがお済みでない方はこちらのブログをご参照ください。 MCUXpresso Config Tools : Pins Toolの使い方 (日本語ブログ) 注意:ブログ内ではFRDM-MCXN947のSDKをインストールしていますが本記事においてはFRDM-MCXA153のSDKをインストールしてください。 手元に品番不明の赤色LEDと緑色LEDがあったので、まずは赤色LEDの点灯から試してみます。抵抗は390Ωのものがありました。赤色LEDの順方向電圧(Vf)は一般的に1.8~2.2Vのため、仮に2.0VとしてLEDに流れる電流値を求めます。 マイコンの動作電圧は3.3Vです。Vf 2.0Vと抵抗390Ωを用いると、オームの法則から以下のように電流値が求められます。なおLEDには最大順方向電流(Ifmax)が規定されており、多くの汎用LEDでは20mAと言われています。20mAを超える電流が流れると破損する可能性があるので抵抗値にはご注意ください。 また、GPIOにも出力可能な電流に制限があります。データシートを参照するとMCX A153の通常動作時の電気特性は4mA(High Drive対応ピンでは6mA)を基準として規定されています。このため、GPIOからLEDを直接点灯する場合は、LEDだけでなくGPIO側の電流制限も考慮して抵抗値を選定する必要があります。 ボードとブレッドボードの配線 はじめに配線を行います FRDMボード上では、先ほど特定した ArduinoヘッダーJ2の"D18"と"14 GND"を使用します。 以下の図はBoard User Manualを参照しています。 FRDM-MCXA153 Board User Manual 以下の動画を参考に配線してください。 (function() { var wrapper = document.getElementById('lia-vid-6405195304112w960h540r888'); 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'); }); }); }); } }})(); (マイビデオを表示) サンプルコードのインポート 続いて、FRDM-MCXA153のSDKからサンプルコードのインポートへ進みます。 左側のパネルから「Import Example From Repository」をクリックしてください。 右側に表示された各タブ内で、「Repository」ではインポートしたFRDM-MCXA153のSDKを選択、「Board」はFRDM-MCXA153を選択してください。 「Template」は、「driver_examples/gpio/gpio_led_output」を使用します。 任意のToolchainを選択して、「Import」をクリックしてください。 Importが完了すると左側のパネルのProjectsに追加されます。 ソースコード gpio_led_output.cを確認します。 今回は、Pins Toolを用いてGPIOの入出力設定を行いたいので、ソースコード側から赤枠で囲んだGPIO出力設定に関する記述を削除します。 Pins ToolでGPIOの設定を行う 続いてConfig Toolsを開きます。Project上で右クリックして「Open with MCUXpresso Config Tools」を選択してください。少し待つとConfig Toolsが立ち上がります。 Config Toolsが開いたらまずは右側のパネルにあるOverviewよりPinsを選択します。 これでPins Toolが開いた状態になりました。 ピンP1_8を有効にします。 P1_8をクリックすると、下記画像のように別のWindowが開くので、ここから「GPIO1:GPIO,8(P1_8)」を探して✓を入れてください。 ✓を入れると同時に下記のWindowが表示されますがNoで閉じていただいて問題ありません。 ここまで完了するとPins Tool下部のRouting DetailsにP1_8が追加されます。 続いてGPIOの入出力設定を以下のように変更します。 #38(P3_12)のピンをOutput → Not Specifiedへ、#2(P1_8)のピンをNot Specified → Output へ。 #38のGPIO initial stateにエラーが出ますので、Logical 0→n/aへ変更してください。 ここまで完了したらサンプルコードを書き換えます。まずはConfig Toolsの画面左上にあるUpdate Codeをクリックしてください。 その後Windowが表示されます。ここで必要に応じてコードの変更点を確認することができます。変更が生じたファイルには「change」の記載があります。 VS Codeに戻ると、画面上部に3つのチェックボックスが表示されているので✓が入った状態でOKをクリックします。 少し時間が経つと、ソースコードへの変更が完了します。 続いてソースコード gpio_led_output.cよりGPIOの制御対象を変更します。 gpio_led_output.cを開くと、 以下の記述があります。   while (1) { delay(); GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN); } GPIO_PinInit()およびGPIO_PortToggle()の中身を以下のように変更します。 ここではP1_8を制御対象として指定しており、関数が呼ばれるたびにP1_8の状態がHigh(1)とLow(0)の間で切り替わります。 while (1) { delay(); GPIO_PortToggle(GPIO1, 1u << 8); } さらに詳しく:GPIOピンは Px_y という形式で表記されます。ここで x はGPIOポート番号、y はそのポート内のビット位置を表します。例えば P1_8 は「GPIOポート1の8ビット目」を意味します。 コード中の GPIO_PortToggle(GPIO1, 1U << 8); において、 GPIO1 はGPIOポート1を表し、 1U << 8 は8ビット目だけを1にしたビットマスクです。 1U << 8 ↓ 0000 0001 0000 0000 (2進数) となり、GPIOポート1の中の8ビット目のみを反転(HighとLowを切り替える)させることができます。 PCとFRDM-MCXA153を接続します。 デバッグ(ビルド&書き込み&アプリケーションの実行)します。 デバッグのプロセスが完了したら、プログラムがブレイクポイントで止まっているので、画面上部のアイコン内の"|▶"をクリックします。 LEDが点滅を開始します。 (function() { var wrapper = document.getElementById('lia-vid-6404528566112w304h540r105'); 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'); }); }); }); } }})(); (マイビデオを表示) おまけ – LEDの「点・滅」について理解する  ところで、このLEDはGPIOからHigh(1) , Low(0) どちらを出力したときに点灯しているのでしょうか?先ほどはHigh(1)を出力したときに点灯していると言及しましたが、本当か検証してみます。 以下が先ほど使用したコードです。 while(1)は無限ループを意味し、波括弧{}の中の処理を繰り返し実行します。 また、delay()は一定時間待機するための関数です。GPIO_PortToggle()はGPIO制御関数なので、High(1)とLow(0)を反転します。 while (1) { delay(); GPIO_PortToggle(GPIO1, 1u<<8); } } しかしながら、このコードではLEDがHigh(1)のときに点灯しているのか、Low(0)のときに点灯しているのかがわかりません。 そこで異なる関数GPIO_PinWrite() を使用して、GPIOの状態を明示的に制御します。 具体的には以下のようにHigh(1)の状態でdelay()1回分待機し、その後Low(0)の状態でdelay()5回分待機するコードへ変更します。これでLEDの消灯時間のほうが長くなるはずです。 while (1) { GPIO_PinWrite (GPIO1,8U ,1); delay(); GPIO_PinWrite(GPIO1,8U ,0); delay(); delay(); delay(); delay(); delay(); } デバッグを実行し、画面上部のアイコン内の"|▶"をクリックします。 (function() { var wrapper = document.getElementById('lia-vid-6404528052112w304h540r114'); 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'); }); }); }); } }})(); (マイビデオを表示) 狙い通り、LEDの消灯時間のほうが長くなりました。 これによりLEDが点灯しているときにはHigh(1)を出力し、消灯しているときにはLow(0)を出力していることが検証できました。 おさらいすると、GPIOがHigh(1)になると、GPIOピンとして設定したP1_8は約3.3Vになります。GNDとの間に電位差が生じるため、抵抗とLEDを通して電流が流れます。このときLEDの両端には順方向電圧(約2.0V)がかかり、残りの約1.3Vが抵抗にかかります。その結果、LEDが発光します。 一方、GPIOがLow(0)になるとP1_8の電圧は約0Vになります。GPIOピンとGNDの間に電位差がなくなるため電流は流れず、LEDは消灯します。 delay()がたくさん並ぶのはかっこ悪いという方はループ関数も使えます。 while (1) { GPIO_PinWrite(GPIO1, 8U, 1); delay(); GPIO_PinWrite(GPIO1, 8U, 0); for (int i = 0; i < 5; i++) { delay(); } } おまけ – 2つのLEDを並列に接続したら? 手元にあった緑色のLEDを赤色LEDと並列接続しようと試みました。 緑色の順方向電圧(Vf)は一般的に2.0~2.2Vのため、赤色LEDと同様に仮に2.0Vとして以下のような回路を組みました。 ピンの設定は変える必要がないため、そのまま先ほど使ったコードでデバッグを行ったところ、赤色LEDは点滅しますが緑色LEDは点滅しません。なぜでしょうか? (function() { var wrapper = document.getElementById('lia-vid-6404530194112w304h540r514'); 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'); }); }); }); } }})(); (マイビデオを表示) LEDには、順方向電圧(Vf)を超えると急激に電流が流れ始めるという特性があります。そのため赤色LEDと緑色LEDを単純に並列接続すると、Vfの低いLEDに電流が集中し、もう一方はほとんど点灯しないことがあります。つまり今回の場合は赤色LEDのVfが緑色LEDに比べて低いので、赤色LEDに電流が集中したという状態となっています。 実際にテスターでLED両端の電圧を測定したところ、赤色LEDは1.765V , 緑色LEDは1.766Vでした。 この電圧では赤色LEDは発光できるものの、緑色LEDは十分な電流が流れるほどの電圧に達していません。その結果、赤色LEDには電流が流れて点灯しますが、緑色LEDにはほとんど電流が流れず点灯しませんでした。 このように、LEDを異なる種類のまま単純に並列接続すると、わずかなVfの差によって電流の流れ方が大きく偏ることがあります。そのためLEDを並列接続する場合は、LEDごとに電流制限抵抗を設けるのが一般的です。 抵抗を追加する際にはGPIOの電流制限を考慮する必要があります。単純にこれまで使ってきた390Ωをひとつ追加して電流値を計算すると計算上では6mAを超える電流がGPIOに掛かってしまいます。したがって、総電流が4mA超えないよう680Ωの抵抗を2つ接続し、以下のような回路を組みました。 再度同じコードでデバッグを行ったところ、赤色LED、緑色LEDともに点灯しました。 (function() { var wrapper = document.getElementById('lia-vid-6405719291112w304h540r698'); 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'); }); }); }); } }})(); (マイビデオを表示) LED両端の電圧を測定したところ、赤色LEDは1.750V , 緑色LEDは1.906Vでした。抵抗をそれぞれのLEDに追加したことで、各LEDに適切な電流が流れるようになりました。 以上、今回は各種ドキュメントの読み解き方、Config Toolsの使い方からLEDの動作原理にいたるまで組み込み開発初心者の目線から「困った」「詰まった」点を解説しました。NXPマイコンを使って初めてLチカにチャレンジするという方のご参考になれば幸いです。 =========================​ 本投稿の「Comment」欄にコメントをいただいても、現在返信に対応しておりません。​ お手数をおかけしますが、お問い合わせの際には「NXPへの技術質問 - 問い合わせ方法 (日本語ブログ)」をご参照ください。​ (既に弊社NXP代理店、もしくはNXPとお付き合いのある方は、直接担当者へご質問いただいてもかまいません。) マイコンを使った開発において最も基本的なペリフェラルの一つであるGPIO(General Purpose Input/Output)をLEDの点滅を例に使い方を解説します。 GPIOは多くのマイコン開発者が最初に学ぶペリフェラルです。GPIOを使ってLEDを光らせてみたいけれど、「データシートの見方がわからない」「ピンの設定方法がわからない」という方も多いのではないでしょうか。本記事ではマイコン開発初心者向けに、FRDM-MCXA153を使ったGPIO入門を解説します。データシートや回路図からピン情報を読み解き、Pins Toolを使った設定を行いながら、最終的に外部LEDの制御を体験します。 (作業時間:15分) ※開発環境をインストール済みの前提 MCUXpresso MCUXpresso Conig Tools MCUXpresso IDE MCUXpresso SDK MCX 日本語ブログ
查看全文
GPIO Introduction: How to Read the Pins of a Microcontroller (MCX A153) and Control an LED (Japanese Blog) table of contents Introduction Understanding the pin configuration of the MCX A153 microcontroller Settings for using GPIO Check the relationship between the pins and the board (FRDM-MCXA153). Demonstration: Perform GPIO settings and experience LED control. Bonus: Understanding the "on/off" of LEDs Bonus – What happens if you connect two LEDs in parallel?   Introduction As a beginner in embedded systems development, I began learning about GPIO after receiving a request to write an article about it. This article is a record of what I learned and the insights I gained through trial and error while trying to light up a single LED. This article explains how to use GPIO (General Purpose Input/Output), one of the most basic peripherals in microcontroller development. GPIO is the foundation of embedded systems for connecting microcontrollers to external circuits, enabling functions such as turning on LEDs, reading the state of switches, and receiving signals from sensors. On the other hand, in actual microcontroller development, "using GPIO" doesn't simply mean writing a program. Microcontrollers have numerous pins, and each pin is assigned functions other than GPIO, such as timers and communication interfaces. Therefore, To use GPIO, you need to understand the pin assignments and functions from the datasheet. PinMUX (pin multiplex) settings for assigning GPIO to pins Input/Output Direction Settings This needs to be done properly. This time, using the FRDM-MCXA153 as an example, we will examine the pin configuration of the MCX A153 and the mechanism of PinMUX, configure GPIO settings using Pins Tool, and finally demonstrate blinking LEDs connected to a breadboard.   Understanding the pin configuration of the MCX A153 microcontroller The FRDM-MCXA153 is equipped with a microcontroller with the model number MCXA153VLH. This microcontroller uses an LQFP 64 package and has a total of 64 pins. Of these, 52 are available as GPIOs. The remaining pins consist of power terminals (VDD/VSS), USB terminals, and analog-only terminals, which cannot be used as GPIOs. However, even though it has "52 GPIOs," this doesn't mean that 52 pins are dedicated to GPIO. Many of the pins available for GPIO use are shared with peripheral functions such as UART, SPI, I²C, and timers. Therefore, to actually use them as GPIOs, you need to use the PinMUX function to configure those pins to function as GPIOs. Let's check the pin configuration of the MCX A153 from the datasheet . A list of functions that can be assigned to each pin is provided starting on page 54. For example, looking at the "Pinmux Assignment" for Pin Name: P1_8, there are six possible functions. GPIO is assigned to "ALT0 - P1_8". Other assignments include "ALT2 - LPUART1_RXD" which means it will be used as the UART receive terminal (RXD), and "ALT3 - LPI2C0_SDA" which means it will be used as the I²C data line (SDA). As you can see, a single pin can be assigned to multiple functions, including not only GPIO but also UART, I²C, and timers.   Settings for using GPIO 1. Select pin function (PinMUX) As confirmed in the previous section, P1_8 has several potential functions, including GPIO, UART, and I²C. However, the same pin cannot be used as both GPIO and UART simultaneously. Therefore, typical microcontrollers are equipped with a mechanism called PinMUX. PinMUX is like a toggle switch for connecting a single physical pin to an internal peripheral. For example, P1_8 had six potential connection destinations. By selecting GPIO using PinMUX, P1_8 becomes available for use as a GPIO pin. 2. Set the electrical characteristics of the pins. Pins can be configured not only for their function but also for their electrical behavior. Typical settings include: • Pull-up • Pull-down Drive Strength Open Drain These are some examples. For instance, pull-up resistors are often enabled for switch inputs, and the drive strength may be adjusted when driving LEDs or high-speed signals. Even when used as GPIO, it is important to make appropriate electrical settings according to the application. This article will omit a detailed explanation of these electrical characteristics. 3. Set the input/output direction of the GPIO. The final step is determining the direction in which the signal flows. GPIO has two main operating modes. • Input – Receives signals from the outside • Output – Sends signals to the outside What exactly is happening inside the microcontroller when it comes to Input and Output? The MCX A153 is a microcontroller that operates at 3.3V. Therefore, the GPIO pins basically handle two states: Low (approximately 0V) and High (approximately 3.3V).The A153 has an operating voltage range of 1.71V to 3.6V, and 3.3V is used for the FRDM board. GPIO output values Pin voltage Low (0) Approximately 0V High (1) Approximately 3.3V For example, if you set a specific GPIO pin to Output and connect an external LED, setting it to High (approximately 3.3V) creates a potential difference between the GPIO and GND, allowing current to flow through the LED. Setting it to Low (approximately 0V) eliminates the potential difference with GND, so no current flows. In other words, the "blinking" of the LED is caused by repeatedly switching the voltage of the GPIO pin between High (1) and Low (0), alternating between blinking and being off. On the other hand, in Input mode, the microcontroller monitors the state of the GPIO pins. For example, if approximately 3.3V is input from an external circuit, it is recognized as High (1), and if approximately 0V is input, it is recognized as Low (0). The pin function selection, electrical characteristic settings, and input/output settings described above can all be configured via a GUI using the Pins Tool (which is included in NXP's free Config Tools).   Check the relationship between the pins and the board (FRDM-MCXA153). So far, we've learned that in order to use GPIO, you need to configure PinMUX settings and input/output direction settings. Next, let's confirm where the MCU pins are connected on the FRDM-MCXA153 board, keeping in mind the demonstration we'll be performing. Check the schematics and confirm where pin "P1_8", which was used as an example in the previous chapter, is routed. Looking at page 8 of the circuit diagram, we can see that P1_8 is connected to D18 of Arduino header J2 on the FRDM-MCXA153. FRDM-MCXA153 Schematics So, where is D18 on the Arduino header J2? Next, let's check the Board User Manual. FRDM-MCXA153 Board User Manual Page 6 contains a diagram of the connectors mounted on the board, which allowed me to identify the location of D18 on the Arduino header J2. For this learning exercise, we will connect an external LED via a breadboard using the D18 pin. However, if you do not have a breadboard or LED, you can use the RGB LED mounted on the FRDM-MCXA153 board. However, there is one point to note. When using the RGB LED on the board, the anode (+) of the LED is connected to VDD_BOARD (3.3V), and the cathode (-) is connected to GPIO. Therefore, unlike the externally connected LED mentioned earlier, setting GPIO to High (1) will also bring the GPIO voltage to approximately 3.3V, and the potential difference across the LED will almost disappear, causing the LED to turn off. On the other hand, setting GPIO to Low (0) creates a potential difference across the LED, causing current to flow and the LED to light up. When you check each pin in the circuit diagram... P3_12 is a red LED P3_13 is a green LED P3_0 is a blue LED It supports these features. By configuring these PinMUX settings and input/output settings, you can also verify the operation using the LEDs on the board. In this way, you can use the circuit diagram and the Board User Manual to check where the physical pins inside the microcontroller are connected on the board.   Demonstration: Perform GPIO settings and experience LED control. In this chapter, we will use the Pins Tool in MCUXpresso Config Tools to configure GPIO and control an externally connected LED on a breadboard. Equipment used in the demonstration: FRDM-MCXA153 Breadboard LED • Resistors and jumper wires This demonstration will assume that you have already installed the MCUXpresso SDK and Config Tools in your VS Code environment. *If you have not yet installed the MCUXpresso SDK and Config Tools, please refer to this blog post. MCUXpresso Config Tools: How to Use the Pins Tool (Japanese Blog) Note: While the blog post describes installing the SDK for FRDM-MCXN947, please install the SDK for FRDM-MCXA153 in this article. I had a red LED and a green LED on hand, but I didn't know the part numbers, so I'll start by trying to light up the red LED. I had a 390Ω resistor. The forward voltage (Vf) of a red LED is generally 1.8~2.2V, so I'll assume it's 2.0V and calculate the current flowing through the LED. The microcontroller's operating voltage is 3.3V. VfUsing 2.0V and a 390Ω resistor, the current value can be calculated using Ohm's law as follows. Note that LEDs have a specified maximum forward current (Ifmax), which is said to be 20mA for many general-purpose LEDs. Be careful with the resistance value, as currents exceeding 20mA may cause damage. Furthermore, GPIO pins also have limitations on the current they can output. According to the datasheet, the MCX A153's electrical characteristics during normal operation are specified based on 4mA (6mA for High Drive pins). Therefore, when directly lighting an LED using a GPIO pin, you need to select a resistor value that takes into account not only the LED's current limit but also the GPIO's current limit. Board and breadboard wiring First, we'll do the wiring. On the FRDM board, we will use "D18" and "14 GND" on the Arduino header J2 that we identified earlier . The following diagram is based on the Board User Manual. FRDM-MCXA153 Board User Manual Please refer to the following video for wiring instructions. (function() { var wrapper = document.getElementById('lia-vid-6405195304112w960h540r888'); 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'); }); }); }); } }})(); (Show My Videos) Importing sample code Next, we will proceed to import the sample code from the FRDM-MCXA153 SDK. Click "Import Example From Repository" in the panel on the left. In the tabs displayed on the right, select the imported FRDM-MCXA153 SDK under "Repository" and select FRDM-MCXA153 under "Board". The template used is "driver_examples/gpio/gpio_led_output". Select your desired Toolchain and click "Import". Once the import is complete, it will be added to the Projects section in the left-hand panel. Check the source code gpio_led_output.c. This time, we want to configure GPIO input/output settings using Pins Tool, so we will remove the GPIO output setting code enclosed in the red box from the source code. Configure GPIO settings using Pins Tool. Next, open Config Tools. Right-click on the Project and select "Open with MCUXpresso Config Tools". After a short wait, Config Tools will launch. Once Config Tools opens, first select Pins from Overview in the right-hand panel. The Pins Tool is now open. Enable pin P1_8. Clicking on P1_8 will open another window as shown in the image below. Find "GPIO1:GPIO,8(P1_8)" in this window and check the box next to it. When you check the box, the following window will appear, but you can close it by clicking No. Once you've completed these steps, P1_8 will be added to the Routing Details at the bottom of the Pins Tool. Next, change the GPIO input/output settings as follows. Connect pin #38 (P3_12) from Output to Not Specified, and pin #2 (P1_8) from Not Specified to Output. An error will occur in the GPIO initial state of #38, so please change it from Logical 0 to n/a. Once you've completed these steps, you can rewrite the sample code. First, click Update Code in the upper left corner of the Config Tools screen. A window will then appear. Here you can review the code changes as needed. Files that have been modified will have "change" written next to them. When you return to VS Code, you will see three checkboxes at the top of the screen. Make sure they are checked and click OK. After a short while, the changes to the source code will be completed. Next, we will change the target of GPIO control in the source code gpio_led_output.c. When you open gpio_led_output.c, The following is stated:   while (1) { delay(); GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN); } Modify the contents of GPIO_PinInit() and GPIO_PortToggle() as follows: Here, P1_8 is specified as the control target, and each time the function is called, the state of P1_8 switches between High (1) and Low (0). while (1) { delay(); GPIO_PortToggle(GPIO1, 1u << 8); } Further details: GPIO pins are represented in the format Px_y, where x is the GPIO port number and y represents the bit position within that port. For example, P1_8 means "bit 8 of GPIO port 1". In the code GPIO_PortToggle(GPIO1, 1U << 8); In, GPIO1 1U << 8 represents GPIO port 1, is a bitmask where only the 8th bit is set to 1. 1U << 8 ↓ 0000 0001 0000 0000 (2進数) This allows you to invert (switch between High and Low) only the 8th bit in GPIO port 1. Connect the PC to the FRDM-MCXA153. Debugging (build, write, and run the application). Once the debugging process is complete, the program will have stopped at the breakpoint, so click the "|▶" icon at the top of the screen. The LED will start blinking. (function() { var wrapper = document.getElementById('lia-vid-6404528566112w304h540r105'); 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'); }); }); }); } }})(); (Show My Videos) Bonus – Understanding LED "on/off" By the way, when does this LED light up, based on whether the GPIO outputs High (1) or Low (0)? Earlier I mentioned that it lights up when High (1) is output, but let's verify if that's true. The following is the code we used earlier. The `while(1)` statement implies an infinite loop, repeatedly executing the code within the curly braces {}. Additionally, delay() is a function for waiting for a certain period of time. GPIO_PortToggle() is a GPIO control function, so it inverts High (1) and Low (0). while (1) { delay(); GPIO_PortToggle(GPIO1, 1u<<8); } } However, this code doesn't tell us whether the LED is lit when it's High (1) or Low (0). Therefore, we use a different function, GPIO_PinWrite(), to explicitly control the state of the GPIO. Specifically, the code will be changed to wait for one delay() call while in a High (1) state, and then wait for five delay() calls while in a Low (0) state. This should make the LED stay off for a longer period of time. while (1) { GPIO_PinWrite (GPIO1,8U ,1); delay(); GPIO_PinWrite(GPIO1,8U ,0); delay(); delay(); delay(); delay(); delay(); } Run the debug and click the "|▶" icon at the top of the screen. (function() { var wrapper = document.getElementById('lia-vid-6404528052112w304h540r114'); 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'); }); }); }); } }})(); (Show My Videos) As intended, the LEDs were turned off for a longer period. This allowed us to verify that the LED outputs High (1) when it is lit and Low (0) when it is off. To recap, when the GPIO goes high (1), the voltage at P1_8, which is set as the GPIO pin, becomes approximately 3.3V. A potential difference is created between this voltage and GND, causing current to flow through the resistor and the LED. At this time, a forward voltage (approximately 2.0V) is applied across the LED, and the remaining approximately 1.3V is applied across the resistor. As a result, the LED lights up. On the other hand, when GPIO goes low (0), the voltage at P1_8 becomes approximately 0V. Since there is no potential difference between the GPIO pin and GND, no current flows, and the LED turns off. If you think having a lot of `delay()` functions looks ugly, you can also use loop functions. while (1) { GPIO_PinWrite(GPIO1, 8U, 1); delay(); GPIO_PinWrite(GPIO1, 8U, 0); for (int i = 0; i < 5; i++) { delay(); } } Bonus – What happens if you connect two LEDs in parallel? I tried connecting a green LED I had on hand in parallel with a red LED. Since the forward voltage (Vf) of a green LED is generally 2.0 to 2.2V, I assumed it to be 2.0V, similar to the red LED, and built the following circuit. Since there was no need to change the pin settings, I debugged using the same code as before, and the red LED blinked, but the green LED did not. Why is that? (function() { var wrapper = document.getElementById('lia-vid-6404530194112w304h540r514'); 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'); }); }); }); } }})(); (Show My Videos) LEDs have the characteristic that current starts flowing rapidly when the forward voltage (Vf) is exceeded. Therefore, if a red LED and a green LED are simply connected in parallel, the current will concentrate on the LED with the lower Vf, and the other LED may hardly light up at all. In this case, the Vf of the red LED is lower than that of the green LED, so the current is concentrated on the red LED. When I actually measured the voltage across the LEDs with a tester, the red LED was 1.765V and the green LED was 1.766V. At this voltage, the red LED can light up, but the green LED does not receive enough voltage to generate sufficient current. As a result, the red LED lights up, but the green LED does not light up because almost no current flows through it. As shown above, simply connecting different types of LEDs in parallel can cause significant bias in current flow due to even small differences in forward voltage (Vf). Therefore, when connecting LEDs in parallel, it is common practice to install a current-limiting resistor for each LED. When adding resistors, you need to consider the GPIO current limit. If you simply add one more 390Ω resistor as we've been using and calculate the current, the calculated current applied to the GPIO will exceed 6mA. Therefore, to ensure the total current does not exceed 4mA, we connected two 680Ω resistors and built the following circuit. When I debugged the same code again, both the red and green LEDs lit up. (function() { var wrapper = document.getElementById('lia-vid-6405719291112w304h540r698'); 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'); }); }); }); } }})(); (Show My Videos) When the voltage across the LEDs was measured, the red LED was 1.750V and the green LED was 1.906V. By adding a resistor to each LED, the appropriate current was able to flow through each LED. In this article, we've explained the "problems" and "stumbling blocks" encountered by a beginner in embedded development, from how to interpret various documents and use Config Tools to the operating principles of LEDs. We hope this will be helpful for those attempting to blink an LED for the first time using an NXP microcontroller. =========================​ 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 how to use GPIO (General Purpose Input/Output), one of the most basic peripherals in microcontroller development, using the blinking of an LED as an example. GPIO is one of the first peripherals that many microcontroller developers learn about. Many people want to use GPIO to light up an LED, but they may not know how to read the datasheet or how to configure the pins. This article explains the basics of GPIO using the FRDM-MCXA153, aimed at beginners in microcontroller development. We will learn to read pin information from the datasheet and circuit diagram, configure settings using Pins Tool, and finally experience controlling an external LED. (Estimated time: 15 minutes) *Assuming the development environment is already installed. MCUXpresso MCUXpresso Configuration Tools MCUXpresso IDE MCUXpresso SDK MCX Japanese Blog
查看全文
Example FRMD-A-S32K344 FlexCAN TX_RX FreeRTOS S32DS36 RTD600 * ================================================================================================= * Detailed Description: * * This example demonstrates Classical CAN and CAN FD reception and transmission using * interrupt-driven Message Buffers and FreeRTOS. * * FlexCAN0 is configured in Normal mode. MB0 receives standard-ID frames and MB1 receives * extended-ID frames. The FlexCAN callback copies every received frame into a FreeRTOS queue * and immediately rearms the corresponding RX Message Buffer. * * A dedicated FreeRTOS task waits for frames in the queue and echoes them through CAN TX MB2. * The transmitted frame preserves the received identifier type, identifier, payload length, * payload, CAN FD EDL state, and BRS state. The user LED is toggled after a transmit request * is accepted by the driver. * * Note: * FreeRTOS API functions such as xQueueSendFromISR() are used from the FlexCAN callback. * Therefore, the FlexCAN interrupt priority must comply with the FreeRTOS interrupt-priority * requirements defined by configMAX_SYSCALL_INTERRUPT_PRIORITY. * * ================================================================================================= * Test HW: FRDM-A-S32K344 (SCH-94921 / SPF-94921 Rev. C) * MCU: S32K344 * Compiler: S32DS 3.6.x * RTD release: S32K3_RTD_6_0_0_D2506_ASR_REL_4_7_REV_0000_20250610 * Debugger: On-Board Debugger * Target: Internal_FLASH * Communication: Classical CAN / CAN FD, STD and EXT ID, optional BRS * =================================================================================================
查看全文
S32K Examples S32K1xx S32K144 Example S32K144 CMP Round-robin S32DS2.0  Example S32K144 Verify Backdoor Access Key S32DS1.3  Example S32K144 FlexCAN0 RXFIFO DMA nonSDK S32DS13  Example S32K144 PDB ADC trigger DMA ISR S32DS  Example S32K144 Flash RW simple S32DS  Example S32K144 DMA memory copy test S32DS  Example S32K144 EEEPROM usage Example S32K144 EEEPROM usage - No SDK  Example S32K144 RTC VLPS  Example S32K144 WDOG RCM interrupt  Example S32K144 SRAM ECC Injection  Example S32K144 RAM Retention S32DS.R1 Example S32K144 I2C Master MPL3115A2 S32DSR1_v3  Example S32K144 FlexCAN RXFIFO DMA S32DS.ARM.2018.R1  Example S32K144_printf_implementation - S32DS_1.0  Example S32k144 UART printf/scanf under FreeRTOS - S32DS Example S32K144 SDK Function call on configurable period using LPIT timer.  Example S32K144 .noinit section usage Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1   Example S32K144 RAM selftest simple S32DS 2018.R1  Example S32K144 Position Independent Code  Example S32K144 FlexCAN Pretended Networking STOP mode test S32DS.ARM.2.2  Example S32K144 LPIT DMA LPSPI  Example S32K144 FlexCAN TX/RX/Error ISR test S32DS2.2  Example S32K144 FlexIO Idle Detection S32DS2.2 S32K142 Example_S32K142_LMEN_Cache_v1_0_S32DS3.6_RTD300  Lauterbach_Script_For_MDM_AP_Mass_erase_S32K142  S32K146 Example S32K146 Set_whole_FlexRAM-as_RAM S32DS.ARM.2.2 S32K148 Example S32K148 PDB0-PDB1 ring S32DS3.4 RTM4.0.3  Example S32K148 PDB0-PDB1 ring DMA S32DS3.4 RTM4.0.3  Example S32K148 GPIO Interrupt   S32K116 Example S32K116 WDOG Fast Test  Example S32K116 LPUART LIN Slave TXRX ISR S32DS.ARM.2.2  Example S32K116 FlexCAN PN STOP S32DS.ARM.2.2 Example S32K116 FlexCAN VLPR test S32DS.ARM.2.2 S32K118 Example S32K118-SRAM-keep_data_over_SW_reset v0_1 S32DS.ARM.2.2 S32K3xx S32K312 Example S32K312 ADC_IP Continuous Scan DMA S32DS36 RTD600    S32K344 Example S32K344 PIT BTCU ADC DMA DS3.4 RTD100   Example S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO test S32DS3.4 RTD200     Example Siul2_Port_Ip_Example_S32K344_ITCM_DTCM S32DS3.4 RTD300   Example S32K344 LPUART RX/TX ISR FreeRTOS S32DS36 RTD600    Example_S32K344_MCAL_MCU_ClockMonitor_v1_0_S32DS36_RTD600    Example_S32K314_DTCM1_Backdoor_RTD201_DS34_v3    Example_Reg_Prot_Flash_Controller_S32K344   Example S32K344 PIT SWtrig ADC ANAMUX S32DS 3.6.0 RTD 6.0.0   Example S32K344 EMAC lwIP FreeRTOS miniEVB S32DS 3.6.1 RTD 6.0.0   Example S32K344 EMAC lwIP FreeRTOS MRCANHUB S32DS 3.6.1 RTD600   Example_S32K344_BIST_eMCEM_SPD106_v2_0_S32DS365_RTD700  Example S32K344EVB_T172 UART_ETH_Gateway HLD S32DS368 RTD701   Example_S32K344_CMU_FM_POR_WDG_v1_0_S32DS369_RTD701    Example_S32K344_FLS_Integrity_Margin_Check_v1_0_S32DS36_RTD701    Example S32K344 LPSPI LCD-PAR-S035 FRDM S32DS 3.6.6 RTD 7.0.1   Example FRDM-A-S32K344 FlexCAN TX_RX FreeRTOS S32DS36 RTD600    S32K358   S32K358 Multicore Start CM7_2 from CM7_0    Example S32K358 FlexCAN TXRX ISR S32DS35 RTD400/500   Example S32K358 GMAC 100M lwIP FreeRTOS S32DS 3.6.1 RTD600   Example S32K358 GMAC 1G lwIP FreeRTOS S32DS 3.6.1 RTD600   Example S32K358 GMAC lwIP FreeRTOS RDBESS S32DS 3.6.1 RTD600   Example_S32K358_XRDC_SEMA42_Multicore_v1_0_S32DS369_RTD701    S32K388 Example S32K388 GMAC0 lwIP FreeRTOS S32DS 3.6.1 RTD600   S32K389 Example S32K389 GMAC0 lwIP FreeRTOS S32DS 3.6.1 RTD 6.0.0   Example S32K389 GMAC1 SABRE lwIP FreeRTOS S32DS 3.6.1 RTD600  
查看全文
S32K 示例 S32K1xx S32K144 示例 S32K144 CMP 轮询 S32DS2.0 示例 S32K144 验证后门访问密钥 S32DS1.3 示例 S32K144 FlexCAN0 RXFIFO DMA nonSDK S32DS13 示例 S32K144 PDB ADC 触发 DMA ISR S32DS 示例 S32K144 Flash RW simple S32DS 示例 S32K144 DMA 内存复制测试 S32DS S32K144 EEEPROM 使用示例 示例 S32K144 EEEPROM 使用 - 无 SDK 示例 S32K144 RTC VLPS 示例 S32K144 WDOG RCM 中断 示例 S32K144 SRAM ECC 注入  S32K144 RAM 保留示例 S32DS.R1 示例 S32K144 I2C主设备 MPL3115A2 S32DSR1_v3 示例S32K144 FlexCAN RXFIFO DMA S32DS.ARM.2018.R1  示例 S32K144_printf_implementation - S32DS_1.0 示例 S32K144 在 FreeRTOS 下使用 UART printf/scanf - S32DS 示例 使用 LPIT 定时器实现可配置周期函数调用的 S32K144 SDK 示例 S32K144 .noinit章节用法 示例 S32K144 PDB ADC DMA S32DS.ARM.2018.R1 示例 S32K144 RAM 自检简单 S32DS 2018.R1 示例 S32K144 位置无关代码  示例 S32K144 FlexCAN 虚拟网络停止模式测试 S32DS.ARM.2.2 示例 S32K144 LPIT DMA LPSPI 示例 S32K144 FlexCAN TX/RX/Error ISR 测试 S32DS2.2 示例 S32K144 FlexIO 空闲检测 S32DS2.2 S32K146 示例 S32K146 Set_whole_FlexRAM-as_RAM S32DS.ARM.2.2 S32K148 示例 S32K148 PDB0-PDB1 环 S32DS3.4 RTM4.0.3 示例 S32K148 PDB0-PDB1 环 DMA S32DS3.4 RTM4.0.3 示例 S32K148 GPIO 中断 S32K116 示例 S32K116 WDOG 快速测试 示例 S32K116 LPUART LIN 从机 TXRX ISR S32DS.ARM.2.2 示例 S32K116 FlexCAN PN 停止 S32DS.ARM.2.2 示例 S32K116 FlexCAN VLPR 测试 S32DS.ARM.2.2 S32K118 示例 S32K118-SRAM-keep_data_over_SW_reset v0_1 S32DS.ARM.2.2 S32K3xx S32K344 示例 S32K344 PIT BTCU ADC DMA DS3.4 RTD100   示例 S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO 测试 S32DS3.4 RTD200   示例 Siul2_Port_Ip_Example_S32K344_ITCM_DTCM S32DS3.4RTD300   示例 S32K358 FlexCAN TXRX ISR S32DS35 RTD400/500    
查看全文
S32Kの例 S32K1xx S32K144 例:S32K144 CMPラウンド・ロビンS32DS2.0  例:S32K144バックドア・アクセス・キー検証S32DS1.3  例:S32K144 FlexCAN0 RXFIFO DMA非SDK S32DS13  例:S32K144 PDB ADCトリガDMA ISR S32DS  例:S32K144 Flash RWシンプルS32DS  例:S32K144 DMAメモリ・コピー・テストS32DS  例:S32K144 EEEPROMの使用方法 例:S32K144 EEEPROMの使用方法 - 非SDK  例:S32K144 RTC VLPS  例:S32K144 WDOG RCM割り込み  例:S32K144 SRAM ECC注入  例 S32K144 RAM 保持 S32DS.R1 例:S32K144 I2CマスタMPL3115A2 S32DSR1_v3  例:S32K144 FlexCAN RXFIFO DMA S32DS.ARM.2018.R1  例:S32K144_printf_implementation - S32DS_1.0  例:FreeRTOS環境でのS32k144 UART printf/scanf - S32DS 例:S32K144 LPITタイマを使用した構成可能期間に対するSDK関数の呼び出し  例:S32K144 .noinitセクションの使用方法 例:S32K144 PDB ADC DMA S32DS.ARM.2018.R1   例:S32K144 RAMセルフテスト・シンプルS32DS 2018.R1  例:S32K144ポジショニング独立コード 例:S32K144 FlexCAN疑似ネットワーキングSTOPモードのテストS32DS.ARM.2.2  例:S32K144 LPIT DMA LPSPI  例:S32K144 FlexCAN TX/RX/エラーISRテストS32DS2.2  例:S32K144 FlexIOアイドル検出S32DS2.2 S32K146 S32K146 Set_whole_FlexRAM-as_RAM S32DS.ARM.2.2の例 S32K148 例:S32K148 PDB0-PDB1リングS32DS3.4 RTM4.0.3  例:S32K148 PDB0-PDB1 ring DMA S32DS3.4 RTM4.0.3  例:S32K148 GPIO割り込み  S32K116 例:S32K116 WDOG高速テスト  例:S32K116 LPUART LINスレーブTXRX ISR S32DS.ARM.2.2  例 S32K116 FlexCAN PN STOP S32DS.ARM.2.2 例:S32K116 FlexCAN VLPRテストS32DS.ARM.2.2 S32K118 例 S32K118-SRAM-keep_data_over_SW_reset v0_1 S32DS.ARM.2.2 S32K3XXシリーズ S32K344 例:S32K344 PIT BTCU ADC DMA DS3.4 RTD100   例:S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFOテストS32DS3.4 RTD200     例Siul2_Port_Ip_Example_S32K344_ITCM_DTCM S32DS3.4RTD300   例:S32K358 FlexCAN TXRX ISR S32DS35 RTD400/500     
查看全文
Example S32K344 LPSPI LCD-PAR-S035 FRDM S32DS 3.6.6 RTD 7.0.1 * Detailed Description: * * This project provides a minimal bring-up and reference example for the LCD-PAR-S035 * display and GT911 capacitive touchscreen on the S32K344. It includes standalone LCD * and touchscreen diagnostic modes, together with an LVGL demonstration mode. * * The display is controlled through the LPSPI interface using the ST7796S * display controller driver. The touchscreen is controlled through the LPI2C * interface and uses GPIO signals for interrupt and reset control. * * The original LCD, DBI and touchscreen drivers were obtained from an NXP * App Code Hub MCUXpresso SDK example and adapted to the S32K3 RTD * environment. The project also integrates LVGL 9.4 as the graphical user * interface library. * * The application mode is selected at compile time using the APP_MODE macro * defined in this file. It allows the user to select a standalone display * test, a standalone touchscreen test or the complete LVGL demonstration. * Only one application mode shall be selected for each build. * * A graphical application can be designed using NXP GUI Guider 2.0.1. * GUI Guider is configured for LVGL 9.4.0. The contents of the GUI Guider * "generated" and "custom" output directories can be copied directly into * the corresponding gui_guider directories in this project. After replacing * the generated output, the project shall be rebuilt to include the updated * screens, widgets, events and custom callbacks. * * Installed packages for S32 Design Studio 3.6.6: * * SW32K3_S32M27x_RTD_R23-11_7.0.1_D2603_DesignStudio_updatesite.zip * * Software Sources: * * NXP App Code Hub demo: * https://github.com/nxp-appcodehub/dm-https-lcd-led-demo * * LVGL release/v9.4: * https://github.com/lvgl/lvgl/tree/release/v9.4 * * NXP GUI Guider 2.0.1: * https://www.nxp.com/webapp/Download?colCode=GUI-GUIDER-INSTALLER-2.0.1-WIN&appType=license * * Hardware: * * FRDM-A-S32K344: * Remove jumper JP11 when using an external debugger. * * LCD-PAR-S035: * Set SW1 to 111. * * Board Connections: * * +------------------+----------------------+-----------------+-------------------+------------------------------+ * | FRDM-A-S32K344 | MCU Signal | LCD-PAR-S035 | LCD-PAR-S035 | Function | * | Connector | | Signal | Connector | | * +------------------+----------------------+-----------------+-------------------+------------------------------+ * | J2-20 | PTC27 / GPIO | TP_INT | J5-12 | Touch interrupt, active low | * | J2-19 | PTC7 / LPI2C1_SCL | TP_SCL | J5-8 | Touchscreen I2C clock | * | J2-17 | PTC6 / LPI2C1_SDA | TP_SDA | J5-6 | Touchscreen I2C data | * | J2-13 | GND | GND | J5-4 | Signal ground | * | J2-11 | PTB14 / LPSPI1_SCK | LCD_WR | J5-5 | LCD SPI clock | * | J2-9 | PTB15 / LPSPI1_SIN | LCD_RD | Not connected | SPI data from LCD | * | J2-7 | PTB16 / LPSPI1_SOUT | LCD_MOSI | J5-9 | SPI data to LCD | * | J2-5 | PTB17 / GPIO | LCD_CS | J5-11 | LCD chip select, active low | * | J2-3 | PTC10 / GPIO | LCD_D_C | J5-7 | Command low, data high | * | J2-1 | PTC11 / GPIO | LCD_RST | J5-10 | LCD reset, active low | * | JA3-3 | VDD_HV_A | VCC | J5-1 or J5-2 | 3.3 V supply | * | JA3-13 or JA3-15 | GND | GND | J5-3 | Power ground | * +------------------+----------------------+-----------------+-------------------+------------------------------+ * * Project Files: * * Format: * File or directory - Description - Source - License * * | lvgl_app.c/.h * | LVGL application layer * | Created for this project * | NXP proprietary license * | * | lv_conf.h * | Project-specific LVGL configuration * | Derived from the LVGL v9.4.0 configuration template * | MIT License * | * | lv_port.c/.h * | LVGL initialization and S32K3 port layer * | Created for this project * | NXP proprietary license * | * | main.c * | Application entry point and compile-time mode selection * | Created for this project * | NXP proprietary license * | * +---gui_guider * | +---custom * | | User callbacks and custom GUI logic * | | GUI Guider 2.0.1 output * | | NXP proprietary license * | | * | \---generated * | Generated screens, widgets and events * | GUI Guider 2.0.1 output * | NXP proprietary license * | * +---lcdc * | fsl_st7796s.c/.h * | ST7796S LCD controller driver * | NXP App Code Hub demo * | BSD-3-Clause License * | * +---lcd_par_s035 * | lcd_par_s035.c/.h * | LCD-PAR-S035 board and display integration * | Created for this project * | NXP proprietary license * | * | lcd_par_s035_config.h * | LCD-PAR-S035 project configuration * | Created for this project * | NXP proprietary license * | * +---lvgl * | \---src * | LVGL 9.4 graphics library * | LVGL release/v9.4 * | MIT License * | * +---platform * | display_compat.h * | MCUXpresso SDK and S32K3 RTD compatibility definitions * | Created for this project * | NXP proprietary license * | * | fsl_dbi.c/.h * | Generic display bus interface implementation * | NXP App Code Hub demo * | BSD-3-Clause License * | * | lcd_dbi_s32k3.c/.h * | S32K3 DBI transport implementation using LPSPI * | Created for this project * | NXP proprietary license * | * | lcd_platform.c/.h * | S32K344 board and platform abstraction * | Created for this project * | NXP proprietary license * | * \---touchpanel * fsl_gt911.c/.h * GT911 touchscreen controller driver * NXP App Code Hub demo * BSD-3-Clause License * * gt911_s32k3.c/.h * S32K3 adaptation using LPI2C and GPIO * Created for this project * NXP proprietary license * * ---------------------------------------------------------------------------- * Test Hardware: FRDM-A-S32K344, schematic revision B * MCU: S32K344 * Display: LCD-PAR-S035 with ST7796S controller * Touchscreen: GT911 capacitive touchscreen controller * Debugger: Lauterbach TRACE32 * Build Target: internal_FLASH
查看全文
Request FlexNet entitlement for SW32K14-MCAL421-RTMC-1.0.1 Hello NXP Support Team, I would like to request access to: SW32K14-MCAL421-RTMC-1.0.1 Target MCU: S32K144 AUTOSAR MCAL: 4.2.x I have already followed the solution suggested in the existing NXP Community topic: 1. I searched for "S32K1 MCAL" on nxp.com and entered Flexera through the official product page. 2. I also tried the direct link for SW32K14-MCAL421-RTMC-1.0.1 while logged into my NXP account. However, the "Previous" tab is still greyed out, and the direct link shows: "Either the item was not found, or you are not authorized to download this item." I also attempted to create an NXP Support Case, but the Case Portal shows "Case creation disabled" because my email address cannot be linked to a company. It appears that my NXP account does not currently have access rights / FlexNet entitlement for this package. Could you please help add SW32K14-MCAL421-RTMC-1.0.1 to my NXP account, or advise how I can obtain access to this legacy release? Thank you very much for your support. Best regards Re: Request FlexNet entitlement for SW32K14-MCAL421-RTMC-1.0.1 Hi @pikaqiu  Try it now: https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=SW32K1-MCAL-D However, this SW is not supported and maintained anymore. We recommend to use latest RTD drivers.  Regards, Lukas Re: Request FlexNet entitlement for SW32K14-MCAL421-RTMC-1.0.1 Hi Lukas, Thank you for your support. It has been about a week since your reply, and the issue has now been resolved. I can access the required software successfully. Thank you again for your help. Best regards
查看全文
cst creates invalid RSA-PSS signatures with old OpenSSL When using cst with OpenSSL < 3.1 the salt used in the PSS signatures is too long. Processors like the i.MX91 expect the salt to have the same length as the digest, but before OpenSSL 3.1 the default was to make the salt as big as possible. But even with newer OpenSSL versions using the default is not good as it will accept shorter salts during signature verification. The fix is to call EVP_PKEY_CTX_set_rsa_pss_saltlen with second parameter set to RSA_PSS_SALTLEN_DIGEST. Note that OpenSSL 3.0 is EOL since last month. Security
查看全文