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)
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:
Beforehand, please make sure that S32DS and RTD, which were introduced in the previous article , are installed.
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.
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."
Navigate to main.c in the "Project Explorer" on the left and click to open the source code.
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.
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.
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.
Click the button below to return to the previous screen.
In the " generate " section of Project Explorer, you can view each software and its respective headers.
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.
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.
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.
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.
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.
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.
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) ".
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 .
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).
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.
(Estimated time: 15 minutes)