This document shows the step-by-step process to create a simple 'Blinking_LED' project. There is also a video which demonstrates the same steps. This project uses the S32K144EVB-Q100 EVB, connected to a PC through USB (OpenSDA) connection.
1. New S32DS Project
2. Provide a name for the project, for example 'S32K144_Blinking_LED'. The name must be entered with no space characters.
3. Expand Family S32K1xx, Select S32K144
4. Click Next
5. Click '…' button next to SDKs
6. Check box next to S32K144_SDK.
7. Click OK
8. Click Finish, wait for project generation wizard to complete
9. Notice Processor Expert views have opened.
10. Make sure the project is selected in Project Explorer view, then from the Components - S32K144_Blinking_LED view, select:
Components -> pinmux:PinSettings
11. From the Routing tab, select the GPIO pin routing group and scroll the list until PTD Pin 15 and Pin 16 are visible
12. Click on the fields in the Pin/Signal Selection and Direction columns to set the following:
a. Row: Pin 15, Pin/Signal Selection: PTD15, Direction: Output
b. Row: Pin 16, Pin/Signal Selection: PTD16, Direction: Output
13. Click Save
14. Project -> Generate Processor Expert Code
OR, click the button from the Components view
15. The main.c file from 'Sources' folder should be already open, if not, then in the project window click to expand the project folder then Sources, and finally double click the main.c file to open it.
16. Expand the clock_manager component in the Components Window, then locate CLOCK_DRV_Init
17. Drag and drop the CLOCK_DRV_Init function into main, after the comment 'Write your code here'
18. Now we need to supply an argument so the CLOCK_DRV_Init() function knows what clock settings to use. With clockMan1:clock_manager selected in the Components view, look at the Components Inspector and locate the name of the only clock configuration listed, 'clockMan1_InitConfig0'.
19. Enter the name of the clock configuration, with address operator, to the input arguments of CLOCK_DRV_Init(). Notice the name is shaded grey and a mouse-hover reveals the definition.
21. Expand the pin_mux:PinSettings component in the Components Window
22. Drag and drop the PINS_DRV_Init function into main, below the clock configuration
24. Drag and drop the PINS_DRV_SetPinsDirection function into main immediately after PINS_DRV_Init
25. Drag and drop the PINS_DRV_SetPins function into main
26. Drag and drop the PINS_DRV_ClearPins function into main
27. For each of the PINS_DRV functions, there are 2 arguments, first is always PTD (which is macro defined in SDK), the second is defined as follows:
PINS_DRV_SetPinsDirection: OR-ing of LEDRGB_RED and LEDRGB_GREEN = 1 << 15U | 1 << 16U
PINS_DRV_SetPins: Bit shift of LEDRGB_RED = 1 << 15U
PINS_DRV_ClearPins: Bit shift of LEDRGB_GREEN = 1 << 16U
28. Include an infinite loop after these functions
29. Drag and drop the PINS_DRV_TogglePins function in to main, and place it inside the 'for' loop.
30. Again, the first argument will be PTD and the second is the same as for PINS_DRV_SetPinsDirection above.
31. Within the 'for' loop, and prior to the PINS_DRV_TogglePins function, add a delay of 720000 cycles
int cycles = 720000;
32. Build 'Blinking_LED_S32DS'. Select the project name in 'C/C++ Projects' view and then press 'Debug_RAM'. Or you can build for Debug_FLASH, but programming RAM won't overwrite anything you already have in FLASH.
33. After the build completes, check that there are no errors.
34. Open Debug Configurations and select 'Blinking_LED_S32DS_Debug_RAM'
35. Check the Debugger settings and ensure that 'OpenSDA Embedded Debug - USB Port' is selected for interface. Or select the settings which are appropriate for your hardware configuration.
36. Click Debug
37. Set breakpoint on PINS_DRV_TogglePins. Double-click on the blue shaded area at left on the line of code to set breakpoint.
38. Step through initialization calls
39. To see the output register bits change, go to 'EmbSys Registers' tab and expand 'GPIO', then 'PTD' and 'PDOR'. Double-click on PDOR to enable reading of the values.
40. Click resume to advance to the breakpoint, see the LED on board change color.
41. Click resume again and see LED change to other color