update freertos example

work with samd21 samd51 and nrf
This commit is contained in:
hathach 2020-03-10 23:16:09 +07:00
parent fd5c64d7b5
commit 65578dec44
16 changed files with 101 additions and 58 deletions

View File

@ -20,7 +20,7 @@ SRC_C += \
$(FREERTOS_SRC)/tasks.c \ $(FREERTOS_SRC)/tasks.c \
$(FREERTOS_SRC)/timers.c \ $(FREERTOS_SRC)/timers.c \
$(FREERTOS_SRC)/portable/MemMang/heap_4.c \ $(FREERTOS_SRC)/portable/MemMang/heap_4.c \
$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/port.c \ $(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/port.c
# FreeRTOS (lto + Os) linker issue # FreeRTOS (lto + Os) linker issue
LDFLAGS += -Wl,--undefined=vTaskSwitchContext LDFLAGS += -Wl,--undefined=vTaskSwitchContext

View File

@ -41,8 +41,17 @@
* *
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
#include "nrf.h"
// for OPT_MCU_
#include "tusb_option.h"
#if CFG_TUSB_MCU == OPT_MCU_NRF5X
#include "nrf.h"
#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51
#include "sam.h"
#else
#error "FreeRTOSConfig.h need to include low level mcu header for configuration"
#endif
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
@ -50,7 +59,7 @@
#define configTICK_RATE_HZ ( 1000 ) #define configTICK_RATE_HZ ( 1000 )
#define configMAX_PRIORITIES ( 5 ) #define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( 128 ) #define configMINIMAL_STACK_SIZE ( 128 )
#define configTOTAL_HEAP_SIZE ( 16*1024 ) #define configTOTAL_HEAP_SIZE ( 4*1024 )
#define configMAX_TASK_NAME_LEN 16 #define configMAX_TASK_NAME_LEN 16
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
@ -108,7 +117,7 @@
/* Define to trap errors during development. */ /* Define to trap errors during development. */
// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7 // Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7
#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) #if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
#define configASSERT(_exp) \ #define configASSERT(_exp) \
do {\ do {\
if ( !(_exp) ) { \ if ( !(_exp) ) { \
volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \ volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \
@ -119,7 +128,7 @@
}\ }\
} while(0) } while(0)
#else #else
#define configASSERT( x ) #define configASSERT( x )
#endif #endif
/* FreeRTOS hooks to NVIC vectors */ /* FreeRTOS hooks to NVIC vectors */
@ -144,15 +153,6 @@
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */ PRIORITY THAN THIS! (higher priorities are lower numeric values. */
/* SD priority
* 0: SD timing critical
* 1: SD memory protection
* 2: App Highest
* 3: App High
* 4: SD non-time-critical
* 5+ Remaining Application
*/
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
/* Interrupt priorities used by the kernel port layer itself. These are generic /* Interrupt priorities used by the kernel port layer itself. These are generic

View File

@ -53,6 +53,16 @@ enum {
TimerHandle_t blink_tm; TimerHandle_t blink_tm;
// static task
#define USBD_STACK_SIZE 150
StackType_t stack_usbd[USBD_STACK_SIZE];
StaticTask_t static_task_usbd;
#define CDC_STACK_SZIE 128
StackType_t stack_cdc[CDC_STACK_SZIE];
StaticTask_t static_task_cdc;
void led_blinky_cb(TimerHandle_t xTimer); void led_blinky_cb(TimerHandle_t xTimer);
void usb_device_task(void* param); void usb_device_task(void* param);
void cdc_task(void* params); void cdc_task(void* params);
@ -69,11 +79,11 @@ int main(void)
tusb_init(); tusb_init();
// Create a task for tinyusb device stack // Create a task for tinyusb device stack
xTaskCreate( usb_device_task, "usbd", 150, NULL, configMAX_PRIORITIES-1, NULL); (void) xTaskCreateStatic( usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES-1, stack_usbd, &static_task_usbd);
// Create task // Create task
#if CFG_TUD_CDC #if CFG_TUD_CDC
xTaskCreate( cdc_task, "cdc", 128, NULL, configMAX_PRIORITIES-2, NULL); (void) xTaskCreateStatic( cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES-2, stack_cdc, &static_task_cdc);
#endif #endif
vTaskStartScheduler(); vTaskStartScheduler();

View File

@ -41,4 +41,5 @@ JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: $(BUILD)/$(BOARD)-firmware.uf2
cp $< /media/$(USER)/CPLAYBOOT/

View File

@ -60,6 +60,11 @@ void board_init(void)
_sysctrl_init_referenced_generators(); _sysctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -68,9 +73,9 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_DOWN); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_DOWN);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -60,6 +60,11 @@ void board_init(void)
_sysctrl_init_referenced_generators(); _sysctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -68,9 +73,9 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -58,6 +58,11 @@ void board_init(void)
_oscctrl_init_referenced_generators(); _oscctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -66,9 +71,12 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_2_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_3_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -71,10 +71,8 @@ void board_init(void)
// Button // Button
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock/1000); SysTick_Config(SystemCoreClock/1000);
#endif
// UART // UART
nrfx_uarte_config_t uart_cfg = nrfx_uarte_config_t uart_cfg =
@ -99,7 +97,6 @@ void board_init(void)
// 2 is highest for application // 2 is highest for application
NVIC_SetPriority(USBD_IRQn, 2); NVIC_SetPriority(USBD_IRQn, 2);
// USB power may already be ready at this time -> no event generated // USB power may already be ready at this time -> no event generated
// We need to invoke the handler based on the status initially // We need to invoke the handler based on the status initially
uint32_t usb_reg; uint32_t usb_reg;

View File

@ -62,17 +62,14 @@ void board_init(void)
// Button // Button
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock/1000); SysTick_Config(SystemCoreClock/1000);
#endif
#if TUSB_OPT_DEVICE_ENABLED #if TUSB_OPT_DEVICE_ENABLED
// Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice // Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice
// 2 is highest for application // 2 is highest for application
NVIC_SetPriority(USBD_IRQn, 2); NVIC_SetPriority(USBD_IRQn, 2);
// USB power may already be ready at this time -> no event generated // USB power may already be ready at this time -> no event generated
// We need to invoke the handler based on the status initially // We need to invoke the handler based on the status initially
uint32_t usb_reg; uint32_t usb_reg;

View File

@ -60,6 +60,11 @@ void board_init(void)
_sysctrl_init_referenced_generators(); _sysctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -68,9 +73,9 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -58,6 +58,11 @@ void board_init(void)
_oscctrl_init_referenced_generators(); _oscctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -66,9 +71,12 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_2_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_3_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -60,6 +60,11 @@ void board_init(void)
_sysctrl_init_referenced_generators(); _sysctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -68,9 +73,9 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -58,6 +58,11 @@ void board_init(void)
_oscctrl_init_referenced_generators(); _oscctrl_init_referenced_generators();
_gclk_init_generators_by_fref(_GCLK_INIT_LAST); _gclk_init_generators_by_fref(_GCLK_INIT_LAST);
// Update SystemCoreClock since it is hard coded with asf4 and not correct
// Init 1ms tick timer (samd SystemCoreClock may not correct)
SystemCoreClock = CONF_CPU_FREQUENCY;
SysTick_Config(CONF_CPU_FREQUENCY / 1000);
// Led init // Led init
gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT); gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
gpio_set_pin_level(LED_PIN, 0); gpio_set_pin_level(LED_PIN, 0);
@ -66,9 +71,12 @@ void board_init(void)
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN); gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP); gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_FREERTOS
// 1ms tick timer (samd SystemCoreClock may not correct) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
SysTick_Config(CONF_CPU_FREQUENCY / 1000); NVIC_SetPriority(USB_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_2_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USB_3_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
/* USB Clock init /* USB Clock init

View File

@ -71,10 +71,8 @@ void board_init(void)
// Button // Button
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock/1000); SysTick_Config(SystemCoreClock/1000);
#endif
// UART // UART
nrfx_uarte_config_t uart_cfg = nrfx_uarte_config_t uart_cfg =

View File

@ -62,10 +62,8 @@ void board_init(void)
// Button // Button
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock/1000); SysTick_Config(SystemCoreClock/1000);
#endif
#if TUSB_OPT_DEVICE_ENABLED #if TUSB_OPT_DEVICE_ENABLED
// Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice // Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice

View File

@ -71,10 +71,8 @@ void board_init(void)
// Button // Button
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer // 1ms tick timer
SysTick_Config(SystemCoreClock/1000); SysTick_Config(SystemCoreClock/1000);
#endif
// UART // UART
nrfx_uarte_config_t uart_cfg = nrfx_uarte_config_t uart_cfg =