Clone an Example Project Using MCUXpresso Config Tool
The following steps will guide you through the manipulation of the general-purpose outputs. The example sets up a SCTimer to generate a PWM signal and change a LED brightness.
Open the MCUXpresso Config Tool
In the wizard that comes up, select the “Create a new configuration based on an SDK example or hello word project” radio button and click on Next
On the next screen, select the location of the MCUXpresso SDK . The SDK package must be unzipped beforehand. Then select the IDE that is being used. Note that only IDEs that were selected in the online SDK builder when the SDK was built will be available and click on clone select example. Then select the project to clone. For this example, we want to use the gpio led output project. You can filter for this by typing “ctimer” in the filter box and then selecting the “ctimer_match_interrupt_example” example project. You can then also specify where to clone the project and the name. Then click on Finish
After cloning go to the directory you selected and open the project for your IDE. Import, compile, and run the project as done in previous sections
You should see the BLUE and RED LED changing back and forth
Terminate the debug session
Use MCUXpresso IDE Pins Tools to Modify Example
Note: Previously, you had to clone an SDK project like in the previous step.
Open the pins tool by selecting “ConfigTools” on the top right hand of the file explorer window and then select “ Open Pins”
The pins tool should now display the pin configuration for the ctimer project
In the Pins view deselect “Show dedicated pins” and “Show no routed pins” checkboxes to see only the routed pins. Routed pins have a check in a green box next to the pin name. The functions selected for each routed pin are highlighted in green
In the current configuration, PIO3_2 and PIO3_3 are routed as the outputs of the CTimer. Let’s add a third Ctimer Match output and enable the Green LED
Select “Show no routed pins” to see the other options. To enable the third Ctimer Match Output, browse the column for Ctimer and select and output. In this example, we will select, Ctimer4 Match 2 on PIO3_6. Select the item in the Ctimer column to enable
Now, let’s route the Green LED. In the search box type “green” so that the routed pin for this LED is shown. Finally, click the box under the GPIO column. The box will highlight in green, and a check will appear next to the pin
Next configure the GPIO pin as an output in the “Routing Details” window
Now it’s time to implement these changes into the project by exporting the new updated pin_mux.c and pin_mux.h files that are generated by the Pins tool. Click on Update Project in the menu bar
The screen that pops up will show the files that are changing and you can click on “diff” to see the difference between the current file and the new file generated by the Pins tool. Click on “OK” to overwrite the new files into your project
Let’s add some additional code to the example. Open simple_match_interrupt.c file and add the following macros for the third ctimer output.
Add the Green LED functions as well.
Some additional code to be implemented will be the third ctimer’s callback, this can be copied from ctimer_match1_callback and modify the content to match2. To be able to visually identify the new ctimer, we will remove one of the previous ctimers as shown
The main function will need to include the initialization of both the Green LED and the Ctimer
Build and download the project as done in the previous section
Run the application. You should now see the Green and Blue LED blinking back and forth
Terminate the debug session
View full article