diff --git a/ADIS_tinyK22_Blinky/.cproject b/ADIS_tinyK22_Blinky/.cproject index fd220fa..99e1252 100644 --- a/ADIS_tinyK22_Blinky/.cproject +++ b/ADIS_tinyK22_Blinky/.cproject @@ -23,78 +23,78 @@ - - - - - - - + + + + + - - - @@ -349,83 +349,83 @@ - - - - - - - - - - - + + + + + - - - @@ -675,7 +675,7 @@ SDK_2.x_MK22FN512xxx12 2.12.0 middleware.baremetal.MK22F51212;platform.drivers.smc.MK22F51212;platform.drivers.port.MK22F51212;platform.drivers.dspi.MK22F51212;platform.drivers.adc16.MK22F51212;platform.drivers.uart.MK22F51212;platform.drivers.clock.MK22F51212;platform.drivers.rtc.MK22F51212;platform.drivers.common.MK22F51212;platform.drivers.i2c.MK22F51212;platform.drivers.gpio.MK22F51212;device.MK22F51212_system.MK22F51212;device.MK22F51212_CMSIS.MK22F51212;CMSIS_Include_core_cm.MK22F51212;platform.utilities.assert.MK22F51212;component.serial_manager_uart.MK22F51212;utility.debug_console.MK22F51212;component.serial_manager.MK22F51212;component.uart_adapter.MK22F51212;component.lists.MK22F51212;project_template.MK22F51212.MK22F51212;device.MK22F51212_startup.MK22F51212; - MK22FN512VDC12 + MK22FN512VLH12 cm4 core0_MK22FN512xxx12 @@ -704,4 +704,5 @@ </TargetConfig> + \ No newline at end of file diff --git a/ADIS_tinyK22_Blinky/ADIS_tinyK22_Blinky.mex b/ADIS_tinyK22_Blinky/ADIS_tinyK22_Blinky.mex new file mode 100644 index 0000000..4cefe5d --- /dev/null +++ b/ADIS_tinyK22_Blinky/ADIS_tinyK22_Blinky.mex @@ -0,0 +1,165 @@ + + + + MK22FN512xxx12 + MK22FN512VLH12 + ksdk2_0 + + + + Configuration imported from ADIS_tinyK22_Blinky + + + true + false + false + true + false + + + + + + + + + 12.0.0 + + + + + + + Configures pin routing and optionally pin electrical features. + + true + core0 + true + + + + + true + + + + + true + + + + + true + + + + + + + + + + + + + + + + + + + + 12.0.0 + + + + + + + + + true + + + + + + + + + + + + + + + + true + + + + + + + N/A + + + + + + + + + + 12.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + N/A + + + + \ No newline at end of file diff --git a/ADIS_tinyK22_Blinky/board/clock_config.c b/ADIS_tinyK22_Blinky/board/clock_config.c index d65c12d..06ea4be 100644 --- a/ADIS_tinyK22_Blinky/board/clock_config.c +++ b/ADIS_tinyK22_Blinky/board/clock_config.c @@ -1,10 +1,3 @@ -/* - * Copyright 2018 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. @@ -40,10 +33,11 @@ /* clang-format off */ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* !!GlobalInfo -product: Clocks v5.0 +product: Clocks v10.0 processor: MK22FN512xxx12 +package_id: MK22FN512VLH12 mcu_data: ksdk2_0 -processor_version: 0.0.16 +processor_version: 12.0.0 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* clang-format on */ @@ -62,8 +56,6 @@ processor_version: 0.0.16 /******************************************************************************* * Variables ******************************************************************************/ -/* System clock frequency. */ -extern uint32_t SystemCoreClock; /******************************************************************************* * Code @@ -161,7 +153,7 @@ void BOARD_BootClockRUN(void) mcgConfig_BOARD_BootClockRUN.ircs, mcgConfig_BOARD_BootClockRUN.fcrdiv); /* Set MCG to FEI mode. */ -#if FSL_CLOCK_DRIVER_VERSION >= MAKE_VERSION(2, 2, 0) +#if FSL_CLOCK_DRIVER_VERSION >= MAKE_VERSION(2, 0, 0) CLOCK_BootToFeiMode(mcgConfig_BOARD_BootClockRUN.dmx32, mcgConfig_BOARD_BootClockRUN.drs, CLOCK_CONFIG_FllStableDelay); diff --git a/ADIS_tinyK22_Blinky/board/clock_config.h b/ADIS_tinyK22_Blinky/board/clock_config.h index 7ed3806..6e7391d 100644 --- a/ADIS_tinyK22_Blinky/board/clock_config.h +++ b/ADIS_tinyK22_Blinky/board/clock_config.h @@ -1,10 +1,3 @@ -/* - * Copyright 2018 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. diff --git a/ADIS_tinyK22_Blinky/board/peripherals.c b/ADIS_tinyK22_Blinky/board/peripherals.c index 8875ccd..a970785 100644 --- a/ADIS_tinyK22_Blinky/board/peripherals.c +++ b/ADIS_tinyK22_Blinky/board/peripherals.c @@ -1,10 +1,3 @@ -/* - * Copyright 2019 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. @@ -13,20 +6,41 @@ /* clang-format off */ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* !!GlobalInfo -product: Peripherals v6.0 +product: Peripherals v11.0 processor: MK22FN512xxx12 +package_id: MK22FN512VLH12 mcu_data: ksdk2_0 -processor_version: 0.0.18 +processor_version: 12.0.0 functionalGroups: - name: BOARD_InitPeripherals + UUID: 74acc050-89d1-4c54-a2cd-4d87a4233be4 called_from_default_init: true + selectedCore: core0 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* component: - type: 'system' - type_id: 'system_54b53072540eeeb8f8e9343e71f28176' -- global_system_definitions: [] +- global_system_definitions: + - user_definitions: '' + - user_includes: '' + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ + +/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +component: +- type: 'uart_cmsis_common' +- type_id: 'uart_cmsis_common_9cb8e302497aa696fdbb5a4fd622c2a8' +- global_USART_CMSIS_common: + - quick_selection: 'default' + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ + +/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +component: +- type: 'gpio_adapter_common' +- type_id: 'gpio_adapter_common_57579b9ac814fe26bf95df0a384c36b6' +- global_gpio_adapter_common: + - quick_selection: 'default' * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* clang-format on */ @@ -35,11 +49,39 @@ component: **********************************************************************************************************************/ #include "peripherals.h" +/*********************************************************************************************************************** + * BOARD_InitPeripherals functional group + **********************************************************************************************************************/ +/*********************************************************************************************************************** + * NVIC initialization code + **********************************************************************************************************************/ +/* clang-format off */ +/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +instance: +- name: 'NVIC' +- type: 'nvic' +- mode: 'general' +- custom_name_enabled: 'false' +- type_id: 'nvic_57b5eef3774cc60acaede6f5b8bddc67' +- functional_group: 'BOARD_InitPeripherals' +- peripheral: 'NVIC' +- config_sets: + - nvic: + - interrupt_table: [] + - interrupts: [] + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ +/* clang-format on */ + +/* Empty initialization function (commented out) +static void NVIC_init(void) { +} */ + /*********************************************************************************************************************** * Initialization functions **********************************************************************************************************************/ void BOARD_InitPeripherals(void) { + /* Initialize components */ } /*********************************************************************************************************************** diff --git a/ADIS_tinyK22_Blinky/board/peripherals.h b/ADIS_tinyK22_Blinky/board/peripherals.h index 1503606..2a75809 100644 --- a/ADIS_tinyK22_Blinky/board/peripherals.h +++ b/ADIS_tinyK22_Blinky/board/peripherals.h @@ -1,10 +1,3 @@ -/* - * Copyright 2019 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. @@ -13,6 +6,11 @@ #ifndef _PERIPHERALS_H_ #define _PERIPHERALS_H_ +/*********************************************************************************************************************** + * Included files + **********************************************************************************************************************/ +#include "fsl_common.h" + #if defined(__cplusplus) extern "C" { #endif /* __cplusplus */ @@ -20,6 +18,7 @@ extern "C" { /*********************************************************************************************************************** * Initialization functions **********************************************************************************************************************/ + void BOARD_InitPeripherals(void); /*********************************************************************************************************************** diff --git a/ADIS_tinyK22_Blinky/board/pin_mux.c b/ADIS_tinyK22_Blinky/board/pin_mux.c index 94b92c4..d9a3ff4 100644 --- a/ADIS_tinyK22_Blinky/board/pin_mux.c +++ b/ADIS_tinyK22_Blinky/board/pin_mux.c @@ -1,10 +1,3 @@ -/* - * Copyright 2019 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. @@ -14,15 +7,20 @@ /* * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* !!GlobalInfo -product: Pins v6.0 +product: Pins v12.0 processor: MK22FN512xxx12 +package_id: MK22FN512VLH12 mcu_data: ksdk2_0 -processor_version: 0.0.18 +processor_version: 12.0.0 +pin_labels: +- {pin_num: '45', pin_signal: ADC0_SE4b/CMP1_IN0/PTC2/SPI0_PCS2/UART1_CTS_b/FTM0_CH1/FB_AD12/I2S0_TX_FS/LPUART0_CTS_b, label: LED_BLUE, identifier: LED_BLUE} * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** */ /* clang-format on */ #include "fsl_common.h" +#include "fsl_port.h" +#include "fsl_gpio.h" #include "pin_mux.h" /* FUNCTION ************************************************************************************************************ @@ -40,8 +38,9 @@ void BOARD_InitBootPins(void) /* * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* BOARD_InitPins: -- options: {callFromInitBoot: 'true', enableClock: 'true'} -- pin_list: [] +- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'} +- pin_list: + - {pin_num: '45', peripheral: GPIOC, signal: 'GPIO, 2', pin_signal: ADC0_SE4b/CMP1_IN0/PTC2/SPI0_PCS2/UART1_CTS_b/FTM0_CH1/FB_AD12/I2S0_TX_FS/LPUART0_CTS_b, direction: OUTPUT} * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** */ /* clang-format on */ @@ -54,6 +53,18 @@ BOARD_InitPins: * END ****************************************************************************************************************/ void BOARD_InitPins(void) { + /* Port C Clock Gate Control: Clock enabled */ + CLOCK_EnableClock(kCLOCK_PortC); + + gpio_pin_config_t LED_BLUE_config = { + .pinDirection = kGPIO_DigitalOutput, + .outputLogic = 0U + }; + /* Initialize GPIO functionality on pin PTC2 (pin 45) */ + GPIO_PinInit(BOARD_INITPINS_LED_BLUE_GPIO, BOARD_INITPINS_LED_BLUE_PIN, &LED_BLUE_config); + + /* PORTC2 (pin 45) is configured as PTC2 */ + PORT_SetPinMux(BOARD_INITPINS_LED_BLUE_PORT, BOARD_INITPINS_LED_BLUE_PIN, kPORT_MuxAsGpio); } /*********************************************************************************************************************** * EOF diff --git a/ADIS_tinyK22_Blinky/board/pin_mux.h b/ADIS_tinyK22_Blinky/board/pin_mux.h index 28df852..f040628 100644 --- a/ADIS_tinyK22_Blinky/board/pin_mux.h +++ b/ADIS_tinyK22_Blinky/board/pin_mux.h @@ -1,10 +1,3 @@ -/* - * Copyright 2019 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - /*********************************************************************************************************************** * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. @@ -32,6 +25,19 @@ extern "C" { */ void BOARD_InitBootPins(void); +/*! @name PORTC2 (number 45), LED_BLUE + @{ */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_LED_BLUE_GPIO GPIOC /*!<@brief GPIO peripheral base pointer */ +#define BOARD_INITPINS_LED_BLUE_GPIO_PIN_MASK (1U << 2U) /*!<@brief GPIO pin mask */ + +/* Symbols to be used with PORT driver */ +#define BOARD_INITPINS_LED_BLUE_PORT PORTC /*!<@brief PORT peripheral base pointer */ +#define BOARD_INITPINS_LED_BLUE_PIN 2U /*!<@brief PORT pin number */ +#define BOARD_INITPINS_LED_BLUE_PIN_MASK (1U << 2U) /*!<@brief PORT pin mask */ + /* @} */ + /*! * @brief Configures pin routing and optionally pin electrical features. * diff --git a/ADIS_tinyK22_Blinky/source/application.c b/ADIS_tinyK22_Blinky/source/application.c new file mode 100644 index 0000000..4ef9858 --- /dev/null +++ b/ADIS_tinyK22_Blinky/source/application.c @@ -0,0 +1,19 @@ +#include "application.h" +#include "fsl_gpio.h" +#include "pin_mux.h" + +static void delay(void) +{ + uint32_t i; + + for (i = 0; i < 500000; ++i) { + __asm volatile ("nop"); + } +} + +void App_Run(void){ + while(1) { + GPIO_PortToggle(BOARD_INITPINS_LED_BLUE_GPIO, BOARD_INITPINS_LED_BLUE_GPIO_PIN_MASK); + delay(); + } +} diff --git a/ADIS_tinyK22_Blinky/source/application.h b/ADIS_tinyK22_Blinky/source/application.h new file mode 100644 index 0000000..00d3c45 --- /dev/null +++ b/ADIS_tinyK22_Blinky/source/application.h @@ -0,0 +1,13 @@ +/* + * application.h + * + * Created on: 22.09.2022 + * Author: jonas + */ + +#ifndef APPLICATION_H_ +#define APPLICATION_H_ + +void App_Run(void); + +#endif /* APPLICATION_H_ */ diff --git a/ADIS_tinyK22_Blinky/source/main.c b/ADIS_tinyK22_Blinky/source/main.c index fe04478..3331e2e 100644 --- a/ADIS_tinyK22_Blinky/source/main.c +++ b/ADIS_tinyK22_Blinky/source/main.c @@ -40,9 +40,10 @@ #include "MK22F51212.h" #include "fsl_debug_console.h" /* TODO: insert other include files here. */ - +#include "application.h" /* TODO: insert other definitions and declarations here. */ + /* * @brief Application entry point. */ @@ -59,14 +60,8 @@ int main(void) { PRINTF("Hello World\n"); - /* Force the counter to be placed into memory. */ - volatile static int i = 0 ; - /* Enter an infinite loop, just incrementing a counter. */ - while(1) { - i++ ; - /* 'Dummy' NOP to allow source level single stepping of - tight while() loop */ - __asm volatile ("nop"); - } + /* run app */ + App_Run(); + return 0 ; }