2378486_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2378486_en-US

2378486_en-US

Let's run an LED blinking application using the S32K – RTD, the first automotive-grade MCU (Japanese blog)

What is this article about?


In the previous article, we installed S32 Design Studio (hereinafter S32DS ) and Real-Time Driver (hereinafter RTD) to perform the necessary preliminary steps for evaluating and developing with the S32 MCU.

This time, as the next step, we will actually open an RTD sample project and experience the " first step " of S32K3 development by generating code, building, and debugging .


Goal of this article: Debug a sample from RTD on an S32K3 FRDM board and make an LED blink
(estimated time: 15 minutes)


Preparation


Hardware:

In this article, we will be using the new FRDM Automotive board, the FRDM-A-S32K344 , which uses the S32K3. The S32K344 is a 1x LockStep Arm Cortex-M7 microcontroller and is used in a wide range of applications, including motor control and body control .


software:

  • S32DS (IDE development environment)
  • RTD (Software for S32K3)

Beforehand, please make sure that S32DS and RTD, which were introduced in the previous article , are installed.


Step 1: Open the RTD sample


Launch S32DS and create a new project. Then, follow these steps to open the RTD sample.

Open " S32DS Project from Example " in the lower left corner, and click " S32K3XX Real-Time Drivers… " to see examples of ADC , CAN , GPT , I2C , PWM, etc.

YukoKinto_13-1780933148603.png


This time, let's use " Dio Example " as an example. Click on "Dio Example," and then select " Dio_Example_S32K344 " from there. The details of the example are displayed on the right, so check the contents and click "Finish."

YukoKinto_14-1780933148676.png


Navigate to main.c in the "Project Explorer" on the left and click to open the source code.

YukoKinto_15-1780933148992.png


You will see several "Warnings" in the bottom right and on the code, but these warnings do not indicate errors in the source code itself, but rather that S32DS is not correctly finding where to look for RTD-related header files.

YukoKinto_16-1780933149223.png



Step 2: Resolving the Warning


To resolve the warning, first click on "example_Dio.mex" in the Project Explorer on the left side of the screen. "example_Dio.mex" is a file that stores MCU settings (e.g., DIO = Digital I/O), Pins/Clock/Peripheral settings, and code generation settings.

YukoKinto_17-1780933149559.png


The Configuration Tool screen will appear. Click "Update Code" at the top center to update the code and resolve the error. Once the update is complete, the warning message will disappear from the "Problem" section at the bottom right.

YukoKinto_18-1780933149981.png


 

Step 3: Build


Click the button below to return to the previous screen.

YukoKinto_19-1780933150450.png


In the " generate " section of Project Explorer, you can view each software and its respective headers.

YukoKinto_20-1780933150921.png


Finally, click the build button in the upper left corner of the screen. You should also see a "Build Finished" message in the lower right corner of the screen, and confirm that there are no errors, which means the warning mentioned earlier has been resolved.

YukoKinto_21-1780933151268.png


Up to this point, we have confirmed that we can open the RTD sample project, generate code from the .mex file, and complete the build successfully.



Step 4: Debugging


Connect the FRDM-A-S32K344 to your PC using the included USB Type-C cable . The LED on the board will light up when the connection is successful.

FRDM-K3.png

Return to the S32DS screen and click the debug icon (bug logo) at the top center of the screen to start debugging. After clicking, a message will appear asking you to launch the PE Micro debugger, so allow it to launch and follow the on-screen instructions to proceed with debugging.

PE Micro is a debug driver (tool) used by the S32DS to connect the board to the PC.

In the current environment,

S32DS ( IDE ) ➡ PE Micro ( Debugging Tool ) FRDM-A-S32K344

This is the route through which we are communicating.

YukoKinto_23-1780933151944.png


After debugging, if logs such as " Target has been RESET " and " DAP successfully powered up " appear in the Console, and thread information ( Thread #1 ) is displayed in the Debug view, then the connection to the target board and program transfer have been completed successfully.


 

Step 5: Light up the LED


Now, let's actually check it on the FRDM-A-S32K344 board.

Click the play icon ▶ “Resume/Run” in the toolbar in the center of the screen to start the program execution.

Please note that each sample program has a breakpoint placed at the beginning of the main() function to facilitate debugging.

YukoKinto_24-1780933152481.png


If you can confirm that the LED lights up for a few seconds (the LED circled in yellow in the diagram below), then this debugging was successful.

In this example code, we are instructed to " while (count++ < 10) ".

  • Start with count = 0
  • The count increases by count++ with each loop iteration.
  • It only works while count < 10

In other words, the LED lights up a maximum of 10 times to complete the operation, so it's normal for the LED to light up for only a few seconds and then stop .

YukoKinto_25-1780933153221.png


Up to this point, we have been able to experience the entire process from building and debugging the RTD sample project to verifying its operation on the actual board ( turning the LEDs on and off).



Finally


This series of steps represents the basic development steps using the S32K3.

Code generation → Build → Debug → Test functionality

By actually seeing it in action on the board, you were able to gain a more intuitive understanding of how software controls hardware.

Based on these basic steps, try developing your own application.


=========================

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.)

In this article, we will use a sample LED blinking project within the S32K3 Real-Time Driver to experience the " first steps " of S32K3 development by generating, building, and debugging code.

  • Goal of this article: Debug a sample in RTD on an S32K3 FRDM board and blink an LED.

(Estimated time: 15 minutes)

General Purpose MicrocontrollersS32 Design StudioS32KSW | DownloadsJapanese Blog
タグ(1)
評価なし
バージョン履歴
最終更新日:
水曜日
更新者: