diff options
| author | hathach <[email protected]> | 2023-11-16 21:35:12 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-11-16 21:35:12 +0700 |
| commit | 936551ebd157e1b4d259b87549cf337b056c3746 (patch) | |
| tree | b2288f66820dfe615b9c08d3aa6606a74eb1079b | |
| parent | 759f70f092cfb52cdd07363e126ee8f9be5d8993 (diff) | |
update rt1170 evk with led and button, but usb not working yet
| -rw-r--r-- | hw/bsp/imxrt/FreeRTOSConfig/FreeRTOSConfig.h | 2 | ||||
| -rw-r--r-- | hw/bsp/imxrt/boards/mimxrt1170_evkb/board.h | 23 | ||||
| -rw-r--r-- | hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.c | 29 | ||||
| -rw-r--r-- | hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.h | 12 | ||||
| -rw-r--r-- | hw/bsp/imxrt/boards/mimxrt1170_evkb/mimxrt1170_evkb.mex | 14 | ||||
| -rw-r--r-- | hw/bsp/imxrt/family.c | 9 |
6 files changed, 51 insertions, 38 deletions
diff --git a/hw/bsp/imxrt/FreeRTOSConfig/FreeRTOSConfig.h b/hw/bsp/imxrt/FreeRTOSConfig/FreeRTOSConfig.h index b65d8f1f9..2bc5491bb 100644 --- a/hw/bsp/imxrt/FreeRTOSConfig/FreeRTOSConfig.h +++ b/hw/bsp/imxrt/FreeRTOSConfig/FreeRTOSConfig.h @@ -59,7 +59,7 @@ #define configTICK_RATE_HZ ( 1000 ) #define configMAX_PRIORITIES ( 5 ) #define configMINIMAL_STACK_SIZE ( 128 ) -#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 ) +#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*8*1024 ) #define configMAX_TASK_NAME_LEN 16 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 diff --git a/hw/bsp/imxrt/boards/mimxrt1170_evkb/board.h b/hw/bsp/imxrt/boards/mimxrt1170_evkb/board.h index 0ff82e131..0b6b462e7 100644 --- a/hw/bsp/imxrt/boards/mimxrt1170_evkb/board.h +++ b/hw/bsp/imxrt/boards/mimxrt1170_evkb/board.h @@ -31,25 +31,18 @@ // required since iMX RT10xx SDK include this file for board size #define BOARD_FLASH_SIZE (0x1000000U) -// LED -#define LED_PINMUX IOMUXC_GPIO_AD_04_GPIO9_IO03 -#define LED_PORT GPIO9 -#define LED_PIN 3 +// LED: IOMUXC_GPIO_AD_04_GPIO9_IO03 +#define LED_PORT BOARD_INITPINS_USER_LED_PERIPHERAL +#define LED_PIN BOARD_INITPINS_USER_LED_CHANNEL #define LED_STATE_ON 0 -// SW8 button -#define BUTTON_PINMUX IOMUXC_WAKEUP_DIG_GPIO13_IO00 -#define BUTTON_PORT GPIO13 -#define BUTTON_PIN 0 +// SW8 button: IOMUXC_WAKEUP_DIG_GPIO13_IO00 +#define BUTTON_PORT BOARD_INITPINS_USER_BUTTON_PERIPHERAL +#define BUTTON_PIN BOARD_INITPINS_USER_BUTTON_CHANNEL #define BUTTON_STATE_ACTIVE 0 -// UART +// UART: IOMUXC_GPIO_AD_B0_13_LPUART1_RX, IOMUXC_GPIO_AD_B0_12_LPUART1_TX #define UART_PORT LPUART1 -#define UART_RX_PINMUX IOMUXC_GPIO_AD_B0_13_LPUART1_RX -#define UART_TX_PINMUX IOMUXC_GPIO_AD_B0_12_LPUART1_TX - -static inline uint32_t board_uart_get_clock(void) { - return CLOCK_GetRootClockFreq(kCLOCK_Root_Lpuart1); -} +#define UART_CLK_ROOT BOARD_BOOTCLOCKRUN_LPUART10_CLK_ROOT #endif /* BOARD_H_ */ diff --git a/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.c b/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.c index aaa8a5ebb..b70a7c5bd 100644 --- a/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.c +++ b/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.c @@ -14,12 +14,13 @@ processor_version: 13.0.2 board: MIMXRT1170-EVKB external_user_signals: {} pin_labels: -- {pin_num: M13, pin_signal: GPIO_AD_04, label: 'SIM1_PD/J44[C8]/USER_LED_CTL1/J9[8]/J25[7]', identifier: SIM1_PD;LED} +- {pin_num: M13, pin_signal: GPIO_AD_04, label: 'SIM1_PD/J44[C8]/USER_LED_CTL1/J9[8]/J25[7]', identifier: SIM1_PD;LED;USER_LED} * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** */ #include "fsl_common.h" #include "fsl_iomuxc.h" +#include "fsl_gpio.h" #include "pin_mux.h" /* FUNCTION ************************************************************************************************************ @@ -41,8 +42,8 @@ BOARD_InitPins: open_drain: Disable, drive_strength: High, slew_rate: Slow} - {pin_num: L13, peripheral: LPUART1, signal: TXD, pin_signal: GPIO_AD_24, software_input_on: Disable, pull_up_down_config: Pull_Down, pull_keeper_select: Keeper, open_drain: Disable, drive_strength: High, slew_rate: Slow} - - {pin_num: M13, peripheral: GPIO9, signal: 'gpio_io, 03', pin_signal: GPIO_AD_04, identifier: LED, pull_up_down_config: Pull_Down} - - {pin_num: T8, peripheral: GPIO13, signal: 'gpio_io, 00', pin_signal: WAKEUP, pull_up_down_config: Pull_Up} + - {pin_num: M13, peripheral: GPIO9, signal: 'gpio_io, 03', pin_signal: GPIO_AD_04, identifier: USER_LED, direction: OUTPUT, pull_up_down_config: Pull_Down, pull_keeper_select: Keeper} + - {pin_num: T8, peripheral: GPIO13, signal: 'gpio_io, 00', pin_signal: WAKEUP, direction: INPUT, pull_up_down_config: Pull_Up} * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** */ @@ -55,6 +56,24 @@ BOARD_InitPins: void BOARD_InitPins(void) { CLOCK_EnableClock(kCLOCK_Iomuxc); /* LPCG on: LPCG is ON. */ + /* GPIO configuration of USER_LED on GPIO_AD_04 (pin M13) */ + gpio_pin_config_t USER_LED_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_AD_04 (pin M13) */ + GPIO_PinInit(GPIO9, 3U, &USER_LED_config); + + /* GPIO configuration of USER_BUTTON on WAKEUP_DIG (pin T8) */ + gpio_pin_config_t USER_BUTTON_config = { + .direction = kGPIO_DigitalInput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on WAKEUP_DIG (pin T8) */ + GPIO_PinInit(GPIO13, 0U, &USER_BUTTON_config); + IOMUXC_SetPinMux( IOMUXC_GPIO_AD_04_GPIO9_IO03, /* GPIO_AD_04 is configured as GPIO9_IO03 */ 0U); /* Software Input On Field: Input Path is determined by functionality */ @@ -69,9 +88,9 @@ void BOARD_InitPins(void) { 0U); /* Software Input On Field: Input Path is determined by functionality */ IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_04_GPIO9_IO03, /* GPIO_AD_04 PAD functional properties : */ - 0x06U); /* Slew Rate Field: Slow Slew Rate + 0x02U); /* Slew Rate Field: Slow Slew Rate Drive Strength Field: high drive strength - Pull / Keep Select Field: Pull Enable + Pull / Keep Select Field: Pull Disable, Highz Pull Up / Down Config. Field: Weak pull down Open Drain Field: Disabled Domain write protection: Both cores are allowed diff --git a/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.h b/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.h index c778f487b..550bd1474 100644 --- a/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.h +++ b/hw/bsp/imxrt/boards/mimxrt1170_evkb/board/pin_mux.h @@ -37,14 +37,14 @@ void BOARD_InitBootPins(void); /* GPIO_AD_04 (coord M13), SIM1_PD/J44[C8]/USER_LED_CTL1/J9[8]/J25[7] */ /* Routed pin properties */ -#define BOARD_INITPINS_LED_PERIPHERAL GPIO9 /*!< Peripheral name */ -#define BOARD_INITPINS_LED_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_LED_CHANNEL 3U /*!< Signal channel */ +#define BOARD_INITPINS_USER_LED_PERIPHERAL GPIO9 /*!< Peripheral name */ +#define BOARD_INITPINS_USER_LED_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_USER_LED_CHANNEL 3U /*!< Signal channel */ /* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_LED_GPIO GPIO9 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_LED_GPIO_PIN 3U /*!< GPIO pin number */ -#define BOARD_INITPINS_LED_GPIO_PIN_MASK (1U << 3U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_USER_LED_GPIO GPIO9 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_USER_LED_GPIO_PIN 3U /*!< GPIO pin number */ +#define BOARD_INITPINS_USER_LED_GPIO_PIN_MASK (1U << 3U) /*!< GPIO pin mask */ /* WAKEUP (coord T8), USER_BUTTON */ /* Routed pin properties */ diff --git a/hw/bsp/imxrt/boards/mimxrt1170_evkb/mimxrt1170_evkb.mex b/hw/bsp/imxrt/boards/mimxrt1170_evkb/mimxrt1170_evkb.mex index 721a3504b..9b87a805d 100644 --- a/hw/bsp/imxrt/boards/mimxrt1170_evkb/mimxrt1170_evkb.mex +++ b/hw/bsp/imxrt/boards/mimxrt1170_evkb/mimxrt1170_evkb.mex @@ -27,7 +27,7 @@ <pins_profile> <processor_version>13.0.2</processor_version> <pin_labels> - <pin_label pin_num="M13" pin_signal="GPIO_AD_04" label="SIM1_PD/J44[C8]/USER_LED_CTL1/J9[8]/J25[7]" identifier="SIM1_PD;LED"/> + <pin_label pin_num="M13" pin_signal="GPIO_AD_04" label="SIM1_PD/J44[C8]/USER_LED_CTL1/J9[8]/J25[7]" identifier="SIM1_PD;LED;USER_LED"/> </pin_labels> <external_user_signals> <properties/> @@ -58,6 +58,11 @@ <data>true</data> </feature> </dependency> + <dependency resourceType="SWComponent" resourceId="platform.drivers.igpio" description="Pins initialization requires the IGPIO Driver in the project." problem_level="2" source="Pins:BOARD_InitPins"> + <feature name="enabled" evaluation="equal" configuration="cm7"> + <data>true</data> + </feature> + </dependency> </dependencies> <pins> <pin peripheral="LPUART1" signal="RXD" pin_num="M15" pin_signal="GPIO_AD_25"> @@ -82,12 +87,15 @@ </pin> <pin peripheral="GPIO9" signal="gpio_io, 03" pin_num="M13" pin_signal="GPIO_AD_04"> <pin_features> - <pin_feature name="identifier" value="LED"/> + <pin_feature name="identifier" value="USER_LED"/> + <pin_feature name="direction" value="OUTPUT"/> <pin_feature name="pull_up_down_config" value="Pull_Down"/> + <pin_feature name="pull_keeper_select" value="Keeper"/> </pin_features> </pin> <pin peripheral="GPIO13" signal="gpio_io, 00" pin_num="T8" pin_signal="WAKEUP"> <pin_features> + <pin_feature name="direction" value="INPUT"/> <pin_feature name="pull_up_down_config" value="Pull_Up"/> </pin_features> </pin> @@ -364,7 +372,7 @@ </clock_configuration> </clock_configurations> </clocks> - <dcdx name="DCDx" version="3.0" enabled="true" update_project_code="true"> + <dcdx name="DCDx" version="3.0" enabled="false" update_project_code="true"> <generated_project_files> <file path="board/dcd.c" update_enabled="true"/> <file path="board/dcd.h" update_enabled="true"/> diff --git a/hw/bsp/imxrt/family.c b/hw/bsp/imxrt/family.c index 61d7e9bb2..a9ba00305 100644 --- a/hw/bsp/imxrt/family.c +++ b/hw/bsp/imxrt/family.c @@ -91,7 +91,7 @@ void board_init(void) SystemCoreClockUpdate(); #ifdef TRACE_ETM - CLOCK_EnableClock(kCLOCK_Trace); + //CLOCK_EnableClock(kCLOCK_Trace); #endif #if CFG_TUSB_OS == OPT_OS_NONE @@ -115,13 +115,6 @@ void board_init(void) uart_config.enableTx = true; uart_config.enableRx = true; -// uint32_t freq = board_uart_get_clock(); -// if (CLOCK_GetMux(kCLOCK_UartMux) == 0) /* PLL3 div6 80M */ { -// freq = (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U); -// } else { -// freq = CLOCK_GetOscFreq() / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U); -// } - if ( kStatus_Success != LPUART_Init(UART_PORT, &uart_config, UART_CLK_ROOT) ) { // failed to init uart, probably baudrate is not supported // TU_BREAKPOINT(); |
