From f25d000d5349ba3d065228449d4469078710207c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Tue, 20 Jul 2021 20:14:42 +0300 Subject: [PATCH] [FL-1558] Technical Debt: console, bootloader, targets, stdglue, etc... (#590) * ApiHal: console abstraction, change uart baud rate to 230400. Bootloader: drop F5. Furi: prevent thread local output to serial console in stdglue. * ApiHal: take control over system initialization, reorder some subsystems in a hope of fixing USB issues. * Main: cleanup dead code. ISR: take care of HSECSS by our self. USB: leave clock configuration alone. * F6 cube: switch RCC to LL. * Cli: rollback return behavior. --- applications/cli/cli.c | 5 +- bootloader/targets/f5/api-hal/api-hal-i2c.c | 137 -- bootloader/targets/f5/api-hal/api-hal-i2c.h | 43 - bootloader/targets/f5/api-hal/api-hal-light.c | 43 - bootloader/targets/f5/api-hal/api-hal-light.h | 17 - .../targets/f5/api-hal/api-hal-resources.h | 42 - bootloader/targets/f5/api-hal/api-hal.c | 6 - bootloader/targets/f5/api-hal/api-hal.h | 6 - .../targets/f5/stm32wb55xx_flash_cm4.ld | 187 --- bootloader/targets/f5/target.c | 178 --- bootloader/targets/f5/target.mk | 48 - core/furi/stdglue.c | 13 +- firmware/targets/api-hal-include/api-hal.h | 1 + firmware/targets/f6/Inc/usart.h | 52 - firmware/targets/f6/Src/main.c | 135 +- firmware/targets/f6/Src/stm32wbxx_it.c | 18 +- firmware/targets/f6/Src/usart.c | 55 - firmware/targets/f6/Src/usbd_conf.c | 2 - firmware/targets/f6/api-hal/api-hal-clock.c | 102 +- firmware/targets/f6/api-hal/api-hal-console.c | 54 + firmware/targets/f6/api-hal/api-hal-console.h | 16 + firmware/targets/f6/api-hal/api-hal-power.c | 1 + .../targets/f6/api-hal/api-hal-resources.c | 2 + .../targets/f6/api-hal/api-hal-resources.h | 3 + firmware/targets/f6/api-hal/api-hal.c | 78 +- firmware/targets/f6/ble-glue/app_debug.c | 40 +- firmware/targets/f6/ble-glue/tl_dbg_conf.h | 10 +- firmware/targets/f6/cube/Inc/main.h | 11 +- .../targets/f6/cube/Inc/stm32wbxx_hal_conf.h | 2 +- firmware/targets/f6/cube/Inc/usart.h | 2 - firmware/targets/f6/cube/Makefile | 7 +- firmware/targets/f6/cube/Src/main.c | 159 ++- firmware/targets/f6/cube/Src/stm32wbxx_it.c | 1 - firmware/targets/f6/cube/Src/usart.c | 123 +- firmware/targets/f6/cube/f6.ioc | 1138 +++++++++-------- firmware/targets/f6/target.mk | 8 +- 36 files changed, 988 insertions(+), 1757 deletions(-) delete mode 100644 bootloader/targets/f5/api-hal/api-hal-i2c.c delete mode 100644 bootloader/targets/f5/api-hal/api-hal-i2c.h delete mode 100644 bootloader/targets/f5/api-hal/api-hal-light.c delete mode 100644 bootloader/targets/f5/api-hal/api-hal-light.h delete mode 100644 bootloader/targets/f5/api-hal/api-hal-resources.h delete mode 100644 bootloader/targets/f5/api-hal/api-hal.c delete mode 100644 bootloader/targets/f5/api-hal/api-hal.h delete mode 100644 bootloader/targets/f5/stm32wb55xx_flash_cm4.ld delete mode 100644 bootloader/targets/f5/target.c delete mode 100644 bootloader/targets/f5/target.mk delete mode 100644 firmware/targets/f6/Inc/usart.h delete mode 100644 firmware/targets/f6/Src/usart.c create mode 100644 firmware/targets/f6/api-hal/api-hal-console.c create mode 100644 firmware/targets/f6/api-hal/api-hal-console.h diff --git a/applications/cli/cli.c b/applications/cli/cli.c index fa424729..97b35d39 100644 --- a/applications/cli/cli.c +++ b/applications/cli/cli.c @@ -155,8 +155,6 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) { // Execute command command->callback(cli, args, command->context); loader_unlock(loader); - // Clear line - cli_reset(cli); } else { printf("Other application is running, close it first"); } @@ -164,8 +162,6 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) { } else { // Execute command command->callback(cli, args, command->context); - // Clear line - cli_reset(cli); } if(!(command->flags & CliCommandFlagInsomniaSafe)) { @@ -212,6 +208,7 @@ static void cli_handle_enter(Cli* cli) { } furi_check(osMutexRelease(cli->mutex) == osOK); + cli_reset(cli); cli_prompt(cli); // Cleanup command and args diff --git a/bootloader/targets/f5/api-hal/api-hal-i2c.c b/bootloader/targets/f5/api-hal/api-hal-i2c.c deleted file mode 100644 index 2ff0b8e9..00000000 --- a/bootloader/targets/f5/api-hal/api-hal-i2c.c +++ /dev/null @@ -1,137 +0,0 @@ -#include - -#include -#include -#include -#include -#include - -void api_hal_i2c_init() { - LL_I2C_InitTypeDef I2C_InitStruct = {0}; - LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; - - LL_RCC_SetI2CClockSource(LL_RCC_I2C1_CLKSOURCE_PCLK1); - - LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA); - GPIO_InitStruct.Pin = POWER_I2C_SCL_Pin | POWER_I2C_SDA_Pin; - GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; - GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; - GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; - GPIO_InitStruct.Alternate = LL_GPIO_AF_4; - LL_GPIO_Init(GPIOA, &GPIO_InitStruct); - - LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C1); - - I2C_InitStruct.PeripheralMode = LL_I2C_MODE_I2C; - I2C_InitStruct.Timing = POWER_I2C_TIMINGS; - I2C_InitStruct.AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE; - I2C_InitStruct.DigitalFilter = 0; - I2C_InitStruct.OwnAddress1 = 0; - I2C_InitStruct.TypeAcknowledge = LL_I2C_ACK; - I2C_InitStruct.OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT; - LL_I2C_Init(I2C1, &I2C_InitStruct); - LL_I2C_EnableAutoEndMode(I2C1); - LL_I2C_SetOwnAddress2(I2C1, 0, LL_I2C_OWNADDRESS2_NOMASK); - LL_I2C_DisableOwnAddress2(I2C1); - LL_I2C_DisableGeneralCall(I2C1); - LL_I2C_EnableClockStretching(I2C1); -} - -bool api_hal_i2c_tx( - I2C_TypeDef* instance, - uint8_t address, - const uint8_t* data, - uint8_t size, - uint32_t timeout) { - uint32_t time_left = timeout; - bool ret = true; - - while(LL_I2C_IsActiveFlag_BUSY(instance)) - ; - - LL_I2C_HandleTransfer( - instance, - address, - LL_I2C_ADDRSLAVE_7BIT, - size, - LL_I2C_MODE_AUTOEND, - LL_I2C_GENERATE_START_WRITE); - - while(!LL_I2C_IsActiveFlag_STOP(instance) || size > 0) { - if(LL_I2C_IsActiveFlag_TXIS(instance)) { - LL_I2C_TransmitData8(instance, (*data)); - data++; - size--; - time_left = timeout; - } - - if(LL_SYSTICK_IsActiveCounterFlag()) { - if(--time_left == 0) { - ret = false; - break; - } - } - } - - LL_I2C_ClearFlag_STOP(instance); - - return ret; -} - -bool api_hal_i2c_rx( - I2C_TypeDef* instance, - uint8_t address, - uint8_t* data, - uint8_t size, - uint32_t timeout) { - uint32_t time_left = timeout; - bool ret = true; - - while(LL_I2C_IsActiveFlag_BUSY(instance)) - ; - - LL_I2C_HandleTransfer( - instance, - address, - LL_I2C_ADDRSLAVE_7BIT, - size, - LL_I2C_MODE_AUTOEND, - LL_I2C_GENERATE_START_READ); - - while(!LL_I2C_IsActiveFlag_STOP(instance) || size > 0) { - if(LL_I2C_IsActiveFlag_RXNE(instance)) { - *data = LL_I2C_ReceiveData8(instance); - data++; - size--; - time_left = timeout; - } - - if(LL_SYSTICK_IsActiveCounterFlag()) { - if(--time_left == 0) { - ret = false; - break; - } - } - } - - LL_I2C_ClearFlag_STOP(instance); - - return ret; -} - -bool api_hal_i2c_trx( - I2C_TypeDef* instance, - uint8_t address, - const uint8_t* tx_data, - uint8_t tx_size, - uint8_t* rx_data, - uint8_t rx_size, - uint32_t timeout) { - if(api_hal_i2c_tx(instance, address, tx_data, tx_size, timeout) && - api_hal_i2c_rx(instance, address, rx_data, rx_size, timeout)) { - return true; - } else { - return false; - } -} diff --git a/bootloader/targets/f5/api-hal/api-hal-i2c.h b/bootloader/targets/f5/api-hal/api-hal-i2c.h deleted file mode 100644 index 835693a6..00000000 --- a/bootloader/targets/f5/api-hal/api-hal-i2c.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void api_hal_i2c_init(); - -bool api_hal_i2c_tx( - I2C_TypeDef* instance, - const uint8_t address, - const uint8_t* data, - const uint8_t size, - uint32_t timeout); - -bool api_hal_i2c_rx( - I2C_TypeDef* instance, - const uint8_t address, - uint8_t* data, - const uint8_t size, - uint32_t timeout); - -bool api_hal_i2c_trx( - I2C_TypeDef* instance, - const uint8_t address, - const uint8_t* tx_data, - const uint8_t tx_size, - uint8_t* rx_data, - const uint8_t rx_size, - uint32_t timeout); - -#define with_api_hal_i2c(type, pointer, function_body) \ - { \ - *pointer = ({ type __fn__ function_body __fn__; })(); \ - } - -#ifdef __cplusplus -} -#endif diff --git a/bootloader/targets/f5/api-hal/api-hal-light.c b/bootloader/targets/f5/api-hal/api-hal-light.c deleted file mode 100644 index 425018a1..00000000 --- a/bootloader/targets/f5/api-hal/api-hal-light.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -#define LED_CURRENT_RED 50 -#define LED_CURRENT_GREEN 50 -#define LED_CURRENT_BLUE 50 -#define LED_CURRENT_WHITE 150 - -void api_hal_light_init() { - lp5562_reset(); - - lp5562_set_channel_current(LP5562ChannelRed, LED_CURRENT_RED); - lp5562_set_channel_current(LP5562ChannelGreen, LED_CURRENT_GREEN); - lp5562_set_channel_current(LP5562ChannelBlue, LED_CURRENT_BLUE); - lp5562_set_channel_current(LP5562ChannelWhite, LED_CURRENT_WHITE); - - lp5562_set_channel_value(LP5562ChannelRed, 0x00); - lp5562_set_channel_value(LP5562ChannelGreen, 0x00); - lp5562_set_channel_value(LP5562ChannelBlue, 0x00); - lp5562_set_channel_value(LP5562ChannelWhite, 0x00); - - lp5562_enable(); - lp5562_configure(); -} - -void api_hal_light_set(Light light, uint8_t value) { - switch(light) { - case LightRed: - lp5562_set_channel_value(LP5562ChannelRed, value); - break; - case LightGreen: - lp5562_set_channel_value(LP5562ChannelGreen, value); - break; - case LightBlue: - lp5562_set_channel_value(LP5562ChannelBlue, value); - break; - case LightBacklight: - lp5562_set_channel_value(LP5562ChannelWhite, value); - break; - default: - break; - } -} \ No newline at end of file diff --git a/bootloader/targets/f5/api-hal/api-hal-light.h b/bootloader/targets/f5/api-hal/api-hal-light.h deleted file mode 100644 index 1d571f06..00000000 --- a/bootloader/targets/f5/api-hal/api-hal-light.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void api_hal_light_init(); - -void api_hal_light_set(Light light, uint8_t value); - -#ifdef __cplusplus -} -#endif diff --git a/bootloader/targets/f5/api-hal/api-hal-resources.h b/bootloader/targets/f5/api-hal/api-hal-resources.h deleted file mode 100644 index 8bf55562..00000000 --- a/bootloader/targets/f5/api-hal/api-hal-resources.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define POWER_I2C_SCL_Pin LL_GPIO_PIN_9 -#define POWER_I2C_SCL_GPIO_Port GPIOA -#define POWER_I2C_SDA_Pin LL_GPIO_PIN_10 -#define POWER_I2C_SDA_GPIO_Port GPIOA - -#define POWER_I2C I2C1 -/* Timing register value is computed with the STM32CubeMX Tool, - * Fast Mode @100kHz with I2CCLK = 64 MHz, - * rise time = 0ns, fall time = 0ns - */ -#define POWER_I2C_TIMINGS 0x10707DBC - -/* Input Keys */ -typedef enum { - InputKeyUp, - InputKeyDown, - InputKeyRight, - InputKeyLeft, - InputKeyOk, - InputKeyBack, -} InputKey; - -/* Light */ -typedef enum { - LightRed, - LightGreen, - LightBlue, - LightBacklight, -} Light; - -#ifdef __cplusplus -} -#endif diff --git a/bootloader/targets/f5/api-hal/api-hal.c b/bootloader/targets/f5/api-hal/api-hal.c deleted file mode 100644 index 2d3afc71..00000000 --- a/bootloader/targets/f5/api-hal/api-hal.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void api_hal_init() { - api_hal_i2c_init(); - api_hal_light_init(); -} \ No newline at end of file diff --git a/bootloader/targets/f5/api-hal/api-hal.h b/bootloader/targets/f5/api-hal/api-hal.h deleted file mode 100644 index 9230b28a..00000000 --- a/bootloader/targets/f5/api-hal/api-hal.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include -#include - -void api_hal_init(); \ No newline at end of file diff --git a/bootloader/targets/f5/stm32wb55xx_flash_cm4.ld b/bootloader/targets/f5/stm32wb55xx_flash_cm4.ld deleted file mode 100644 index 41d36b11..00000000 --- a/bootloader/targets/f5/stm32wb55xx_flash_cm4.ld +++ /dev/null @@ -1,187 +0,0 @@ -/** -***************************************************************************** -** -** File : stm32wb55xx_flash_cm4.ld -** -** Abstract : System Workbench Minimal System calls file -** -** For more information about which c-functions -** need which of these lowlevel functions -** please consult the Newlib libc-manual -** -** Environment : System Workbench for MCU -** -** Distribution: The file is distributed “as is,” without any warranty -** of any kind. -** -***************************************************************************** -** -**

© COPYRIGHT(c) 2019 Ac6

-** -** Redistribution and use in source and binary forms, with or without modification, -** are permitted provided that the following conditions are met: -** 1. Redistributions of source code must retain the above copyright notice, -** this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation -** and/or other materials provided with the distribution. -** 3. Neither the name of Ac6 nor the names of its contributors -** may be used to endorse or promote products derived from this software -** without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -***************************************************************************** -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -/* Highest address of the user mode stack */ -_estack = 0x20030000; /* end of RAM */ -/* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ - -/* Specify the memory areas */ -MEMORY -{ -FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K -RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFFC -RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K -} - -/* Define output sections */ -SECTIONS -{ - /* The startup code goes first into FLASH */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >FLASH - - /* The program code and other data goes into FLASH */ - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(4); - _etext = .; /* define a global symbols at end of code */ - } >FLASH - - /* Constant data goes into FLASH */ - .rodata : - { - . = ALIGN(4); - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - . = ALIGN(4); - } >FLASH - - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH - .ARM : { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } >FLASH - - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } >FLASH - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } >FLASH - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } >FLASH - - /* used by the startup to initialize data */ - _sidata = LOADADDR(.data); - - /* Initialized data sections goes into RAM, load LMA copy after code */ - .data : - { - . = ALIGN(4); - _sdata = .; /* create a global symbol at data start */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - - . = ALIGN(4); - _edata = .; /* define a global symbol at data end */ - } >RAM1 AT> FLASH - - - /* Uninitialized data section */ - . = ALIGN(4); - .bss : - { - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; - } >RAM1 - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(8); - PROVIDE ( end = . ); - PROVIDE ( _end = . ); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(8); - } >RAM1 - - - - /* Remove information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } - MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED - MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED - MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED -} - - diff --git a/bootloader/targets/f5/target.c b/bootloader/targets/f5/target.c deleted file mode 100644 index edf3cbde..00000000 --- a/bootloader/targets/f5/target.c +++ /dev/null @@ -1,178 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// Boot request enum -#define BOOT_REQUEST_TAINTED 0x00000000 -#define BOOT_REQUEST_CLEAN 0xDADEDADE -#define BOOT_REQUEST_DFU 0xDF00B000 -// Boot to DFU pin -#define BOOT_DFU_PORT GPIOB -#define BOOT_DFU_PIN LL_GPIO_PIN_11 -// USB pins -#define BOOT_USB_PORT GPIOA -#define BOOT_USB_DM_PIN LL_GPIO_PIN_11 -#define BOOT_USB_DP_PIN LL_GPIO_PIN_12 -#define BOOT_USB_PIN (BOOT_USB_DM_PIN | BOOT_USB_DP_PIN) - -#define RTC_CLOCK_IS_READY() (LL_RCC_LSE_IsReady() && LL_RCC_LSI1_IsReady()) - -void target_led_control(char* c) { - api_hal_light_set(LightRed, 0x00); - api_hal_light_set(LightGreen, 0x00); - api_hal_light_set(LightBlue, 0x00); - do { - if(*c == 'R') { - api_hal_light_set(LightRed, 0xFF); - } else if(*c == 'G') { - api_hal_light_set(LightGreen, 0xFF); - } else if(*c == 'B') { - api_hal_light_set(LightBlue, 0xFF); - } else if(*c == '.') { - LL_mDelay(125); - api_hal_light_set(LightRed, 0x00); - api_hal_light_set(LightGreen, 0x00); - api_hal_light_set(LightBlue, 0x00); - LL_mDelay(125); - } else if(*c == '-') { - LL_mDelay(250); - api_hal_light_set(LightRed, 0x00); - api_hal_light_set(LightGreen, 0x00); - api_hal_light_set(LightBlue, 0x00); - LL_mDelay(250); - } else if(*c == '|') { - api_hal_light_set(LightRed, 0x00); - api_hal_light_set(LightGreen, 0x00); - api_hal_light_set(LightBlue, 0x00); - } - c++; - } while(*c != 0); -} - -void clock_init() { - LL_Init1msTick(4000000); - LL_SetSystemCoreClock(4000000); -} - -void gpio_init() { - LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA); - LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB); - LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC); - // USB D+ - LL_GPIO_SetPinMode(BOOT_USB_PORT, BOOT_USB_DP_PIN, LL_GPIO_MODE_OUTPUT); - LL_GPIO_SetPinSpeed(BOOT_USB_PORT, BOOT_USB_DP_PIN, LL_GPIO_SPEED_FREQ_VERY_HIGH); - LL_GPIO_SetPinOutputType(BOOT_USB_PORT, BOOT_USB_DP_PIN, LL_GPIO_OUTPUT_OPENDRAIN); - // USB D- - LL_GPIO_SetPinMode(BOOT_USB_PORT, BOOT_USB_DM_PIN, LL_GPIO_MODE_OUTPUT); - LL_GPIO_SetPinSpeed(BOOT_USB_PORT, BOOT_USB_DM_PIN, LL_GPIO_SPEED_FREQ_VERY_HIGH); - LL_GPIO_SetPinOutputType(BOOT_USB_PORT, BOOT_USB_DM_PIN, LL_GPIO_OUTPUT_OPENDRAIN); - // Button: back - LL_GPIO_SetPinMode(BOOT_DFU_PORT, BOOT_DFU_PIN, LL_GPIO_MODE_INPUT); - LL_GPIO_SetPinPull(BOOT_DFU_PORT, BOOT_DFU_PIN, LL_GPIO_PULL_UP); -} - -void rtc_init() { - // LSE and RTC - LL_PWR_EnableBkUpAccess(); - if(!RTC_CLOCK_IS_READY()) { - // Start LSI1 needed for CSS - LL_RCC_LSI1_Enable(); - // Try to start LSE normal way - LL_RCC_LSE_SetDriveCapability(LL_RCC_LSEDRIVE_MEDIUMLOW); - LL_RCC_LSE_Enable(); - uint32_t c = 0; - while(!RTC_CLOCK_IS_READY() && c < 200) { - LL_mDelay(10); - c++; - } - // Plan B: reset backup domain - if(!RTC_CLOCK_IS_READY()) { - target_led_control("-R.R.R."); - LL_RCC_ForceBackupDomainReset(); - LL_RCC_ReleaseBackupDomainReset(); - NVIC_SystemReset(); - } - // Set RTC domain clock to LSE - LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE); - // Enable LSE CSS - LL_RCC_LSE_EnableCSS(); - } - // Enable clocking - LL_RCC_EnableRTC(); - LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_RTCAPB); -} - -void version_save(void) { - LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR1, (uint32_t)version_get()); -} - -void usb_wire_reset() { - LL_GPIO_ResetOutputPin(BOOT_USB_PORT, BOOT_USB_PIN); - LL_mDelay(10); - LL_GPIO_SetOutputPin(BOOT_USB_PORT, BOOT_USB_PIN); -} - -void target_init() { - clock_init(); - gpio_init(); - api_hal_init(); - target_led_control("RGB"); - rtc_init(); - version_save(); - usb_wire_reset(); - - // Errata 2.2.9, Flash OPTVERR flag is always set after system reset - __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS); -} - -int target_is_dfu_requested() { - if(LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR0) == BOOT_REQUEST_TAINTED) { - // Default system state is tainted - // We must ensure that MCU is cleanly booted - LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_CLEAN); - NVIC_SystemReset(); - } else if(LL_RTC_BAK_GetRegister(RTC, LL_RTC_BKP_DR0) == BOOT_REQUEST_DFU) { - return 1; - } - LL_mDelay(100); - if(!LL_GPIO_IsInputPinSet(BOOT_DFU_PORT, BOOT_DFU_PIN)) { - return 1; - } - - return 0; -} - -void target_switch(void* offset) { - asm volatile("ldr r3, [%0] \n" - "msr msp, r3 \n" - "ldr r3, [%1] \n" - "mov pc, r3 \n" - : - : "r"(offset), "r"(offset + 0x4) - : "r3"); -} - -void target_switch2dfu() { - target_led_control("B"); - // Mark system as tainted, it will be soon - LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_TAINTED); - // Remap memory to system bootloader - LL_SYSCFG_SetRemapMemory(LL_SYSCFG_REMAP_SYSTEMFLASH); - target_switch(0x0); -} - -void target_switch2os() { - target_led_control("G"); - SCB->VTOR = OS_OFFSET; - target_switch((void*)(BOOT_ADDRESS + OS_OFFSET)); -} diff --git a/bootloader/targets/f5/target.mk b/bootloader/targets/f5/target.mk deleted file mode 100644 index 13170b8e..00000000 --- a/bootloader/targets/f5/target.mk +++ /dev/null @@ -1,48 +0,0 @@ -TOOLCHAIN = arm - -BOOT_ADDRESS = 0x08000000 -FW_ADDRESS = 0x08008000 -OS_OFFSET = 0x00008000 -FLASH_ADDRESS = 0x08000000 - -OPENOCD_OPTS = -f interface/stlink.cfg -c "transport select hla_swd" -f ../debug/stm32wbx.cfg -c "init" -BOOT_CFLAGS = -DBOOT_ADDRESS=$(BOOT_ADDRESS) -DFW_ADDRESS=$(FW_ADDRESS) -DOS_OFFSET=$(OS_OFFSET) -MCU_FLAGS = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard - -CFLAGS += $(MCU_FLAGS) $(BOOT_CFLAGS) -DSTM32WB55xx -Wall -fdata-sections -ffunction-sections -LDFLAGS += $(MCU_FLAGS) -specs=nosys.specs -specs=nano.specs - -CUBE_DIR = ../lib/STM32CubeWB - -# ST HAL -CFLAGS += -DUSE_FULL_LL_DRIVER -ASM_SOURCES += $(CUBE_DIR)/Drivers/CMSIS/Device/ST/STM32WBxx/Source/Templates/gcc/startup_stm32wb55xx_cm4.s -C_SOURCES += $(CUBE_DIR)/Drivers/CMSIS/Device/ST/STM32WBxx/Source/Templates/system_stm32wbxx.c -C_SOURCES += $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_utils.c -C_SOURCES += $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_gpio.c -C_SOURCES += $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_i2c.c - -CFLAGS += -I$(CUBE_DIR)/Drivers/CMSIS/Include -CFLAGS += -I$(CUBE_DIR)/Drivers/CMSIS/Device/ST/STM32WBxx/Include -CFLAGS += -I$(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Inc - -LDFLAGS += -T$(TARGET_DIR)/stm32wb55xx_flash_cm4.ld - -# Drivers -DRIVERS_DIR = ../lib/drivers -CFLAGS += -I$(DRIVERS_DIR) -C_SOURCES += $(DRIVERS_DIR)/lp5562.c - -# API-HAL -CFLAGS += -I$(TARGET_DIR)/api-hal -C_SOURCES += $(wildcard $(TARGET_DIR)/api-hal/*.c) - -# Version generation -CFLAGS += -I../lib/version -C_SOURCES += ../lib/version/version.c - -ASM_SOURCES += $(wildcard $(TARGET_DIR)/*.s) -C_SOURCES += $(wildcard $(TARGET_DIR)/*.c) -CPP_SOURCES += $(wildcard $(TARGET_DIR)/*.cpp) - -SVD_FILE = ../debug/STM32WB55_CM4.svd diff --git a/core/furi/stdglue.c b/core/furi/stdglue.c index 98823301..26d0095e 100644 --- a/core/furi/stdglue.c +++ b/core/furi/stdglue.c @@ -2,15 +2,8 @@ #include "check.h" #include "memmgr.h" -#include -#include -#include -#include +#include #include -#include "FreeRTOS.h" -#include "task.h" - -extern UART_HandleTypeDef DEBUG_UART; DICT_DEF2( FuriStdglueCallbackDict, @@ -29,6 +22,7 @@ static FuriStdglue* furi_stdglue = NULL; static ssize_t stdout_write(void* _cookie, const char* data, size_t size) { furi_assert(furi_stdglue); + bool consumed = false; osKernelState_t state = osKernelGetState(); osThreadId_t thread_id = osThreadGetId(); if(state == osKernelRunning && thread_id && @@ -50,6 +44,7 @@ static ssize_t stdout_write(void* _cookie, const char* data, size_t size) { FuriStdglueCallbackDict_get(furi_stdglue->thread_outputs, (uint32_t)thread_id); if(callback_ptr) { (*callback_ptr)(_cookie, data, size); + consumed = true; } furi_check(osMutexRelease(furi_stdglue->mutex) == osOK); } @@ -63,7 +58,7 @@ static ssize_t stdout_write(void* _cookie, const char* data, size_t size) { return 0; } // Debug uart - HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)data, (uint16_t)size, HAL_MAX_DELAY); + if(!consumed) api_hal_console_tx((const uint8_t*)data, size); // All data consumed return size; } diff --git a/firmware/targets/api-hal-include/api-hal.h b/firmware/targets/api-hal-include/api-hal.h index 145961dc..e6b30db0 100644 --- a/firmware/targets/api-hal-include/api-hal.h +++ b/firmware/targets/api-hal-include/api-hal.h @@ -6,6 +6,7 @@ template struct STOP_EXTERNING_ME {}; #include "api-hal-boot.h" #include "api-hal-clock.h" +#include "api-hal-console.h" #include "api-hal-os.h" #include "api-hal-i2c.h" #include "api-hal-resources.h" diff --git a/firmware/targets/f6/Inc/usart.h b/firmware/targets/f6/Inc/usart.h deleted file mode 100644 index 7a4d7465..00000000 --- a/firmware/targets/f6/Inc/usart.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - ****************************************************************************** - * @file usart.h - * @brief This file contains all the function prototypes for - * the usart.c file - ****************************************************************************** - * @attention - * - *

© Copyright (c) 2021 STMicroelectronics. - * All rights reserved.

- * - * This software component is licensed by ST under Ultimate Liberty license - * SLA0044, the "License"; You may not use this file except in compliance with - * the License. You may obtain a copy of the License at: - * www.st.com/SLA0044 - * - ****************************************************************************** - */ -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __USART_H__ -#define __USART_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "main.h" - -/* USER CODE BEGIN Includes */ - -/* USER CODE END Includes */ - -extern UART_HandleTypeDef huart1; - -/* USER CODE BEGIN Private defines */ - -/* USER CODE END Private defines */ - -void MX_USART1_UART_Init(void); - -/* USER CODE BEGIN Prototypes */ - -/* USER CODE END Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif /* __USART_H__ */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/firmware/targets/f6/Src/main.c b/firmware/targets/f6/Src/main.c index ec0fed26..8af59229 100644 --- a/firmware/targets/f6/Src/main.c +++ b/firmware/targets/f6/Src/main.c @@ -1,73 +1,17 @@ #include "main.h" -#include "cmsis_os2.h" -#include "adc.h" -#include "aes.h" -#include "comp.h" -#include "crc.h" -#include "pka.h" -#include "rf.h" -#include "rng.h" -#include "rtc.h" -#include "spi.h" -#include "tim.h" -#include "usart.h" -#include "usb_device.h" -#include "gpio.h" #include "fatfs/fatfs.h" #include #include #include -void SystemClock_Config(void); -void MX_FREERTOS_Init(void); - int main(void) { // Initialize FURI layer furi_init(); - // Initialize ST HAL hardware + // Initialize ST HAL HAL_Init(); - SystemClock_Config(); - - // USB must be initialized as soon as possible - MX_USB_Device_Init(); - FURI_LOG_I("HAL", "USB OK"); - - // Initialise the rest of HAL - MX_USART1_UART_Init(); - FURI_LOG_I("HAL", "USART OK"); - MX_RTC_Init(); - FURI_LOG_I("HAL", "RTC OK"); - MX_GPIO_Init(); - FURI_LOG_I("HAL", "GPIO OK"); - MX_ADC1_Init(); - FURI_LOG_I("HAL", "ADC1 OK"); - MX_SPI1_Init(); - FURI_LOG_I("HAL", "SPI1 OK"); - MX_SPI2_Init(); - FURI_LOG_I("HAL", "SPI2 OK"); - MX_TIM1_Init(); - FURI_LOG_I("HAL", "TIM1 OK"); - MX_TIM2_Init(); - FURI_LOG_I("HAL", "TIM2 OK"); - MX_TIM16_Init(); - FURI_LOG_I("HAL", "TIM16 OK"); - MX_COMP1_Init(); - FURI_LOG_I("HAL", "COMP1 OK"); - MX_RF_Init(); - FURI_LOG_I("HAL", "RF OK"); - MX_PKA_Init(); - FURI_LOG_I("HAL", "PKA OK"); - MX_RNG_Init(); - FURI_LOG_I("HAL", "RNG OK"); - MX_AES1_Init(); - FURI_LOG_I("HAL", "AES1 OK"); - MX_AES2_Init(); - FURI_LOG_I("HAL", "AES2 OK"); - MX_CRC_Init(); - FURI_LOG_I("HAL", "CRC OK"); // Flipper API HAL api_hal_init(); @@ -75,91 +19,20 @@ int main(void) { // 3rd party MX_FATFS_Init(); FURI_LOG_I("HAL", "FATFS OK"); + // CMSIS initialization osKernelInitialize(); FURI_LOG_I("HAL", "KERNEL OK"); + // Init flipper flipper_init(); + // Start kernel osKernelStart(); while (1) {} } -void SystemClock_Config(void) -{ - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - - HAL_PWR_EnableBkUpAccess(); - - __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMLOW); - __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - LL_RCC_HSE_SetCapacitorTuning(0x18); - - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE - | RCC_OSCILLATORTYPE_LSI1 | RCC_OSCILLATORTYPE_LSE; - RCC_OscInitStruct.HSIState = RCC_HSI_ON; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.LSIState = RCC_LSI_ON; - RCC_OscInitStruct.LSEState = RCC_LSE_ON; - RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV2; - RCC_OscInitStruct.PLL.PLLN = 8; - RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; - RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; - RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; - if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { - Error_Handler(); - } - - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4|RCC_CLOCKTYPE_HCLK2 - |RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK - |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; - RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; - RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; - RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; - RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV2; - RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1; - - if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK) { - Error_Handler(); - } - - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS|RCC_PERIPHCLK_RFWAKEUP - |RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USART1 - |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_CLK48SEL - |RCC_PERIPHCLK_USB|RCC_PERIPHCLK_RNG - |RCC_PERIPHCLK_ADC; - PeriphClkInitStruct.PLLSAI1.PLLN = 6; - PeriphClkInitStruct.PLLSAI1.PLLP = RCC_PLLP_DIV2; - PeriphClkInitStruct.PLLSAI1.PLLQ = RCC_PLLQ_DIV2; - PeriphClkInitStruct.PLLSAI1.PLLR = RCC_PLLR_DIV2; - PeriphClkInitStruct.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_USBCLK|RCC_PLLSAI1_ADCCLK; - PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2; - PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1; - PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLLSAI1; - PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_CLK48; - PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1; - PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; - PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_LSE; - PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE; - PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { - Error_Handler(); - } - - // CSS for HSE - HAL_RCC_EnableCSS(); - // CSS for LSE - HAL_RCCEx_EnableLSECSS(); - HAL_RCCEx_EnableLSECSS_IT(); -} - void Error_Handler(void) { asm("bkpt 1"); while(1) {} diff --git a/firmware/targets/f6/Src/stm32wbxx_it.c b/firmware/targets/f6/Src/stm32wbxx_it.c index d0cf15ba..0645b2f0 100644 --- a/firmware/targets/f6/Src/stm32wbxx_it.c +++ b/firmware/targets/f6/Src/stm32wbxx_it.c @@ -17,7 +17,10 @@ extern void HW_IPCC_Tx_Handler(); extern void HW_IPCC_Rx_Handler(); void NMI_Handler(void) { - HAL_RCC_NMI_IRQHandler(); + if (LL_RCC_IsActiveFlag_HSECSS()) { + LL_RCC_ClearFlag_HSECSS(); + NVIC_SystemReset(); + } } void HardFault_Handler(void) { @@ -50,11 +53,14 @@ void SysTick_Handler(void) { } void TAMP_STAMP_LSECSS_IRQHandler(void) { - if (!LL_RCC_LSE_IsReady()) { - // TODO: notify user about issue with LSE - LL_RCC_ForceBackupDomainReset(); - LL_RCC_ReleaseBackupDomainReset(); - NVIC_SystemReset(); + if (LL_RCC_IsActiveFlag_LSECSS()) { + LL_RCC_ClearFlag_LSECSS(); + if (!LL_RCC_LSE_IsReady()) { + // TODO: notify user about issue with LSE + LL_RCC_ForceBackupDomainReset(); + LL_RCC_ReleaseBackupDomainReset(); + NVIC_SystemReset(); + } } } diff --git a/firmware/targets/f6/Src/usart.c b/firmware/targets/f6/Src/usart.c deleted file mode 100644 index ccf0ab17..00000000 --- a/firmware/targets/f6/Src/usart.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "usart.h" - -UART_HandleTypeDef huart1; - -void MX_USART1_UART_Init(void) { - huart1.Instance = USART1; - huart1.Init.BaudRate = 115200; - huart1.Init.WordLength = UART_WORDLENGTH_8B; - huart1.Init.StopBits = UART_STOPBITS_1; - huart1.Init.Parity = UART_PARITY_NONE; - huart1.Init.Mode = UART_MODE_TX_RX; - huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; - huart1.Init.OverSampling = UART_OVERSAMPLING_16; - huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; - huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1; - huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; - - if (HAL_UART_Init(&huart1) != HAL_OK) { - Error_Handler(); - } - - if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK) { - Error_Handler(); - } - - if (HAL_UARTEx_SetRxFifoThreshold(&huart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK) { - Error_Handler(); - } - - if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK) { - Error_Handler(); - } -} - -void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) { - GPIO_InitTypeDef GPIO_InitStruct = {0}; - if(uartHandle->Instance==USART1) { - - __HAL_RCC_USART1_CLK_ENABLE(); - __HAL_RCC_GPIOB_CLK_ENABLE(); - GPIO_InitStruct.Pin = USART1_TX_Pin|USART1_RX_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF7_USART1; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - } -} - -void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) { - if(uartHandle->Instance==USART1) { - __HAL_RCC_USART1_CLK_DISABLE(); - HAL_GPIO_DeInit(GPIOB, USART1_TX_Pin|USART1_RX_Pin); - } -} diff --git a/firmware/targets/f6/Src/usbd_conf.c b/firmware/targets/f6/Src/usbd_conf.c index 757ef43b..e3744a3b 100644 --- a/firmware/targets/f6/Src/usbd_conf.c +++ b/firmware/targets/f6/Src/usbd_conf.c @@ -60,7 +60,6 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status); static void SystemClockConfig_Resume(void); /* USER CODE END 1 */ -extern void SystemClock_Config(void); /******************************************************************************* LL Driver Callbacks (PCD -> USB Device Library) @@ -774,7 +773,6 @@ void USBD_static_free(void *p) */ static void SystemClockConfig_Resume(void) { - SystemClock_Config(); } /* USER CODE END 5 */ diff --git a/firmware/targets/f6/api-hal/api-hal-clock.c b/firmware/targets/f6/api-hal/api-hal-clock.c index d07d0d95..411144b3 100644 --- a/firmware/targets/f6/api-hal/api-hal-clock.c +++ b/firmware/targets/f6/api-hal/api-hal-clock.c @@ -1,14 +1,112 @@ #include +#include +#include #include +#include void api_hal_clock_init() { - // AHB + LL_FLASH_SetLatency(LL_FLASH_LATENCY_3); + while(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_3); + + /* HSE configuration and activation */ + LL_RCC_HSE_SetCapacitorTuning(0x18); + LL_RCC_HSE_Enable(); + while(LL_RCC_HSE_IsReady() != 1) ; + + /* HSI configuration and activation */ + LL_RCC_HSI_Enable(); + while(LL_RCC_HSI_IsReady() != 1) + + /* LSE configuration and activation */ + LL_PWR_EnableBkUpAccess(); + LL_RCC_LSE_SetDriveCapability(LL_RCC_LSEDRIVE_MEDIUMLOW); + LL_RCC_LSE_Enable(); + while(LL_RCC_LSE_IsReady() != 1) ; + + LL_RCC_HSE_EnableCSS(); + LL_RCC_EnableIT_LSECSS(); + LL_RCC_LSE_EnableCSS(); + + /* Main PLL configuration and activation */ + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 8, LL_RCC_PLLR_DIV_2); + LL_RCC_PLL_Enable(); + LL_RCC_PLL_EnableDomain_SYS(); + while(LL_RCC_PLL_IsReady() != 1); + + LL_RCC_PLLSAI1_ConfigDomain_48M(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 6, LL_RCC_PLLSAI1Q_DIV_2); + LL_RCC_PLLSAI1_ConfigDomain_ADC(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 6, LL_RCC_PLLSAI1R_DIV_2); + LL_RCC_PLLSAI1_Enable(); + LL_RCC_PLLSAI1_EnableDomain_48M(); + LL_RCC_PLLSAI1_EnableDomain_ADC(); + while(LL_RCC_PLLSAI1_IsReady() != 1); + + /* Sysclk activation on the main PLL */ + /* Set CPU1 prescaler*/ + LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + + /* Set CPU2 prescaler*/ + LL_C2_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2); + + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); + while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL); + + /* Set AHB SHARED prescaler*/ + LL_RCC_SetAHB4Prescaler(LL_RCC_SYSCLK_DIV_1); + + /* Set APB1 prescaler*/ + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); + + /* Set APB2 prescaler*/ + LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); + + /* Disable MSI */ + LL_RCC_MSI_Disable(); + while(LL_RCC_MSI_IsReady() != 0); + + /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */ + LL_SetSystemCoreClock(64000000); + + /* Update the time base */ + if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK) + { + Error_Handler(); + } + + if(LL_RCC_GetRTCClockSource() != LL_RCC_RTC_CLKSOURCE_LSE) { + LL_RCC_ForceBackupDomainReset(); + LL_RCC_ReleaseBackupDomainReset(); + LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE); + } + + LL_RCC_EnableRTC(); + + LL_RCC_SetUSARTClockSource(LL_RCC_USART1_CLKSOURCE_PCLK2); + LL_RCC_SetADCClockSource(LL_RCC_ADC_CLKSOURCE_PLLSAI1); + LL_RCC_SetI2CClockSource(LL_RCC_I2C1_CLKSOURCE_PCLK1); + LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_CLK48); + LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLLSAI1); + LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSE); + LL_RCC_SetSMPSPrescaler(LL_RCC_SMPS_DIV_1); + LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE); + + // AHB1 LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMAMUX1); LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1); - // APB + // AHB2 + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA); + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB); + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC); + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOD); + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOE); + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOH); + + // APB1 LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM2); + + // APB2 + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); } void api_hal_clock_switch_to_hsi() { diff --git a/firmware/targets/f6/api-hal/api-hal-console.c b/firmware/targets/f6/api-hal/api-hal-console.c new file mode 100644 index 00000000..6438e673 --- /dev/null +++ b/firmware/targets/f6/api-hal/api-hal-console.c @@ -0,0 +1,54 @@ +#include + +#include +#include +#include + +volatile bool api_hal_console_alive = false; + +void api_hal_console_init() { + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_7; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + LL_USART_InitTypeDef USART_InitStruct = {0}; + USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1; + USART_InitStruct.BaudRate = 230400; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART1, &USART_InitStruct); + LL_USART_SetTXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_2); + LL_USART_EnableFIFO(USART1); + LL_USART_ConfigAsyncMode(USART1); + + LL_USART_Enable(USART1); + + while(!LL_USART_IsActiveFlag_TEACK(USART1)) ; + api_hal_console_alive = true; +} + +void api_hal_console_tx(const uint8_t* buffer, size_t buffer_size) { + if (!api_hal_console_alive) + return; + + while(buffer_size > 0) { + while (!LL_USART_IsActiveFlag_TXE(USART1)); + + LL_USART_TransmitData8(USART1, *buffer); + + buffer++; + buffer_size--; + } + + /* Wait for TC flag to be raised for last char */ + while (!LL_USART_IsActiveFlag_TC(USART1)); +} \ No newline at end of file diff --git a/firmware/targets/f6/api-hal/api-hal-console.h b/firmware/targets/f6/api-hal/api-hal-console.h new file mode 100644 index 00000000..b15cf913 --- /dev/null +++ b/firmware/targets/f6/api-hal/api-hal-console.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void api_hal_console_init(); + +void api_hal_console_tx(const uint8_t* buffer, size_t buffer_size); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/targets/f6/api-hal/api-hal-power.c b/firmware/targets/f6/api-hal/api-hal-power.c index 2012d00d..90e5af8a 100644 --- a/firmware/targets/f6/api-hal/api-hal-power.c +++ b/firmware/targets/f6/api-hal/api-hal-power.c @@ -66,6 +66,7 @@ void HAL_RCC_CSSCallback(void) { } void api_hal_power_init() { + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); LL_PWR_SMPS_SetMode(LL_PWR_SMPS_STEP_DOWN); bq27220_init(&cedv); bq25896_init(); diff --git a/firmware/targets/f6/api-hal/api-hal-resources.c b/firmware/targets/f6/api-hal/api-hal-resources.c index 0c8aeac9..29974876 100644 --- a/firmware/targets/f6/api-hal/api-hal-resources.c +++ b/firmware/targets/f6/api-hal/api-hal-resources.c @@ -52,3 +52,5 @@ const GpioPin gpio_rfid_data_in = {.port = RFID_RF_IN_GPIO_Port, .pin = RFID_RF_ const GpioPin gpio_irda_rx = {.port = IR_RX_GPIO_Port, .pin = IR_RX_Pin}; const GpioPin gpio_irda_tx = {.port = IR_TX_GPIO_Port, .pin = IR_TX_Pin}; +const GpioPin gpio_usart_tx = {.port = USART1_TX_Port, .pin = USART1_TX_Pin}; +const GpioPin gpio_usart_rx = {.port = USART1_RX_Port, .pin = USART1_RX_Pin}; diff --git a/firmware/targets/f6/api-hal/api-hal-resources.h b/firmware/targets/f6/api-hal/api-hal-resources.h index f3fd51ac..5381005d 100644 --- a/firmware/targets/f6/api-hal/api-hal-resources.h +++ b/firmware/targets/f6/api-hal/api-hal-resources.h @@ -89,6 +89,9 @@ extern const GpioPin gpio_rfid_data_in; extern const GpioPin gpio_irda_rx; extern const GpioPin gpio_irda_tx; +extern const GpioPin gpio_usart_tx; +extern const GpioPin gpio_usart_rx; + #ifdef __cplusplus } #endif diff --git a/firmware/targets/f6/api-hal/api-hal.c b/firmware/targets/f6/api-hal/api-hal.c index 05e47bed..98836881 100644 --- a/firmware/targets/f6/api-hal/api-hal.c +++ b/firmware/targets/f6/api-hal/api-hal.c @@ -1,24 +1,78 @@ #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + void api_hal_init() { - api_hal_boot_init(); - FURI_LOG_I("FURI_HAL", "BOOT OK"); + api_hal_clock_init(); + api_hal_console_init(); + FURI_LOG_I("FURI_HAL", "CLOCK and CONSOLE OK"); api_hal_interrupt_init(); FURI_LOG_I("FURI_HAL", "INTERRUPT OK"); - api_hal_clock_init(); - FURI_LOG_I("FURI_HAL", "CLOCK OK"); - api_hal_version_init(); - FURI_LOG_I("FURI_HAL", "VERSION OK"); api_hal_delay_init(); FURI_LOG_I("FURI_HAL", "DELAY OK"); - api_hal_os_init(); - FURI_LOG_I("FURI_HAL", "OS OK"); - api_hal_vcp_init(); - FURI_LOG_I("FURI_HAL", "VCP OK"); + + MX_GPIO_Init(); + FURI_LOG_I("HAL", "GPIO OK"); + + MX_RTC_Init(); + FURI_LOG_I("HAL", "RTC OK"); + api_hal_boot_init(); + FURI_LOG_I("FURI_HAL", "BOOT OK"); + api_hal_version_init(); + FURI_LOG_I("FURI_HAL", "VERSION OK"); + + MX_ADC1_Init(); + FURI_LOG_I("HAL", "ADC1 OK"); + + MX_SPI1_Init(); + FURI_LOG_I("HAL", "SPI1 OK"); + MX_SPI2_Init(); + FURI_LOG_I("HAL", "SPI2 OK"); api_hal_spi_init(); FURI_LOG_I("FURI_HAL", "SPI OK"); + + MX_TIM1_Init(); + FURI_LOG_I("HAL", "TIM1 OK"); + MX_TIM2_Init(); + FURI_LOG_I("HAL", "TIM2 OK"); + MX_TIM16_Init(); + FURI_LOG_I("HAL", "TIM16 OK"); + MX_COMP1_Init(); + FURI_LOG_I("HAL", "COMP1 OK"); + MX_RF_Init(); + FURI_LOG_I("HAL", "RF OK"); + MX_PKA_Init(); + FURI_LOG_I("HAL", "PKA OK"); + MX_RNG_Init(); + FURI_LOG_I("HAL", "RNG OK"); + MX_AES1_Init(); + FURI_LOG_I("HAL", "AES1 OK"); + MX_AES2_Init(); + FURI_LOG_I("HAL", "AES2 OK"); + MX_CRC_Init(); + FURI_LOG_I("HAL", "CRC OK"); + + // VCP + USB + api_hal_vcp_init(); + FURI_LOG_I("FURI_HAL", "VCP OK"); + MX_USB_Device_Init(); + FURI_LOG_I("HAL", "USB OK"); + api_hal_i2c_init(); FURI_LOG_I("FURI_HAL", "I2C OK"); + + // High Level api_hal_power_init(); FURI_LOG_I("FURI_HAL", "POWER OK"); api_hal_light_init(); @@ -27,4 +81,8 @@ void api_hal_init() { FURI_LOG_I("FURI_HAL", "VIBRO OK"); api_hal_subghz_init(); FURI_LOG_I("FURI_HAL", "SUBGHZ OK"); + + // FreeRTOS glue + api_hal_os_init(); + FURI_LOG_I("FURI_HAL", "OS OK"); } diff --git a/firmware/targets/f6/ble-glue/app_debug.c b/firmware/targets/f6/ble-glue/app_debug.c index c982447e..f5b2036d 100644 --- a/firmware/targets/f6/ble-glue/app_debug.c +++ b/firmware/targets/f6/ble-glue/app_debug.c @@ -27,6 +27,7 @@ #include "shci.h" #include "tl.h" #include "dbg_trace.h" +#include /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -53,24 +54,11 @@ typedef PACKED_STRUCT #define BLE_DTB_CFG 0 /* USER CODE END PD */ -/* Private macros ------------------------------------------------------------*/ -/* USER CODE BEGIN PM */ -/* USER CODE END PM */ - /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN PV */ PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static SHCI_C2_DEBUG_TracesConfig_t APPD_TracesConfig={0, 0, 0, 0}; PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig={BLE_DTB_CFG, {0, 0, 0}}; -#ifdef CFG_DEBUG_TRACE_UART -#if(CFG_HW_LPUART1_ENABLED == 1) -extern void MX_LPUART1_UART_Init(void); -#endif -#if(CFG_HW_USART1_ENABLED == 1) -extern void MX_USART1_UART_Init(void); -#endif -#endif - /** * THE DEBUG ON GPIO FOR CPU2 IS INTENDED TO BE USED ONLY ON REQUEST FROM ST SUPPORT * It provides timing information on the CPU2 activity. @@ -366,36 +354,12 @@ static void APPD_BleDtbCfg( void ) #if(CFG_DEBUG_TRACE != 0) void DbgOutputInit( void ) { -/* USER CODE BEGIN DbgOutputInit */ -#ifdef CFG_DEBUG_TRACE_UART -if (CFG_DEBUG_TRACE_UART == hw_lpuart1) -{ -#if(CFG_HW_LPUART1_ENABLED == 1) - MX_LPUART1_UART_Init(); -#endif } -else if (CFG_DEBUG_TRACE_UART == hw_uart1) -{ -#if(CFG_HW_USART1_ENABLED == 1) - MX_USART1_UART_Init(); -#endif -} -#endif - -/* USER CODE END DbgOutputInit */ - return; -} - -extern UART_HandleTypeDef DEBUG_UART; void DbgOutputTraces( uint8_t *p_data, uint16_t size, void (*cb)(void) ) { -/* USER CODE END DbgOutputTraces */ - // HW_UART_Transmit_DMA(CFG_DEBUG_TRACE_UART, p_data, size, cb); - HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)p_data, (uint16_t)size, HAL_MAX_DELAY); + api_hal_console_tx(p_data, size); cb(); -/* USER CODE END DbgOutputTraces */ - return; } #endif diff --git a/firmware/targets/f6/ble-glue/tl_dbg_conf.h b/firmware/targets/f6/ble-glue/tl_dbg_conf.h index 8f705e61..81d924e3 100644 --- a/firmware/targets/f6/ble-glue/tl_dbg_conf.h +++ b/firmware/targets/f6/ble-glue/tl_dbg_conf.h @@ -34,8 +34,6 @@ extern "C" { #include "dbg_trace.h" #include "hw_if.h" -extern UART_HandleTypeDef DEBUG_UART; - /** * Enable or Disable traces * The raw data output is the hci binary packet format as specified by the BT specification * @@ -68,7 +66,7 @@ extern UART_HandleTypeDef DEBUG_UART; #endif #if (TL_SHCI_CMD_DBG_RAW_EN != 0) -#define TL_SHCI_CMD_DBG_RAW(_PDATA_, _SIZE_) HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)_PDATA_, _SIZE_, (~0)) +#define TL_SHCI_CMD_DBG_RAW(_PDATA_, _SIZE_) api_hal_console_tx(_PDATA_, _SIZE_) #else #define TL_SHCI_CMD_DBG_RAW(...) #endif @@ -82,7 +80,7 @@ extern UART_HandleTypeDef DEBUG_UART; #endif #if (TL_SHCI_EVT_DBG_RAW_EN != 0) -#define TL_SHCI_EVT_DBG_RAW(_PDATA_, _SIZE_) HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)_PDATA_, _SIZE_, (~0)) +#define TL_SHCI_EVT_DBG_RAW(_PDATA_, _SIZE_) api_hal_console_tx(_PDATA_, _SIZE_) #else #define TL_SHCI_EVT_DBG_RAW(...) #endif @@ -99,7 +97,7 @@ extern UART_HandleTypeDef DEBUG_UART; #endif #if (TL_HCI_CMD_DBG_RAW_EN != 0) -#define TL_HCI_CMD_DBG_RAW(_PDATA_, _SIZE_) HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)_PDATA_, _SIZE_, (~0)) +#define TL_HCI_CMD_DBG_RAW(_PDATA_, _SIZE_) api_hal_console_tx(_PDATA_, _SIZE_) #else #define TL_HCI_CMD_DBG_RAW(...) #endif @@ -113,7 +111,7 @@ extern UART_HandleTypeDef DEBUG_UART; #endif #if (TL_HCI_EVT_DBG_RAW_EN != 0) -#define TL_HCI_EVT_DBG_RAW(_PDATA_, _SIZE_) HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)_PDATA_, _SIZE_, (~0)) +#define TL_HCI_EVT_DBG_RAW(_PDATA_, _SIZE_) api_hal_console_tx(_PDATA_, _SIZE_) #else #define TL_HCI_EVT_DBG_RAW(...) #endif diff --git a/firmware/targets/f6/cube/Inc/main.h b/firmware/targets/f6/cube/Inc/main.h index 161a4963..4e159c5d 100644 --- a/firmware/targets/f6/cube/Inc/main.h +++ b/firmware/targets/f6/cube/Inc/main.h @@ -31,16 +31,17 @@ extern "C" { #include "stm32wbxx_hal.h" #include "stm32wbxx.h" #include "stm32wbxx_ll_i2c.h" -#include "stm32wbxx_ll_bus.h" -#include "stm32wbxx_ll_cortex.h" +#include "stm32wbxx_ll_crs.h" #include "stm32wbxx_ll_rcc.h" +#include "stm32wbxx_ll_bus.h" #include "stm32wbxx_ll_system.h" +#include "stm32wbxx_ll_exti.h" +#include "stm32wbxx_ll_cortex.h" #include "stm32wbxx_ll_utils.h" #include "stm32wbxx_ll_pwr.h" -#include "stm32wbxx_ll_gpio.h" #include "stm32wbxx_ll_dma.h" - -#include "stm32wbxx_ll_exti.h" +#include "stm32wbxx_ll_usart.h" +#include "stm32wbxx_ll_gpio.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ diff --git a/firmware/targets/f6/cube/Inc/stm32wbxx_hal_conf.h b/firmware/targets/f6/cube/Inc/stm32wbxx_hal_conf.h index c58d051d..cab30f03 100644 --- a/firmware/targets/f6/cube/Inc/stm32wbxx_hal_conf.h +++ b/firmware/targets/f6/cube/Inc/stm32wbxx_hal_conf.h @@ -55,7 +55,7 @@ #define HAL_SPI_MODULE_ENABLED #define HAL_TIM_MODULE_ENABLED /*#define HAL_TSC_MODULE_ENABLED */ -#define HAL_UART_MODULE_ENABLED +/*#define HAL_UART_MODULE_ENABLED */ /*#define HAL_USART_MODULE_ENABLED */ /*#define HAL_WWDG_MODULE_ENABLED */ #define HAL_EXTI_MODULE_ENABLED diff --git a/firmware/targets/f6/cube/Inc/usart.h b/firmware/targets/f6/cube/Inc/usart.h index 7a4d7465..506e8972 100644 --- a/firmware/targets/f6/cube/Inc/usart.h +++ b/firmware/targets/f6/cube/Inc/usart.h @@ -31,8 +31,6 @@ extern "C" { /* USER CODE END Includes */ -extern UART_HandleTypeDef huart1; - /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ diff --git a/firmware/targets/f6/cube/Makefile b/firmware/targets/f6/cube/Makefile index 1c50f6bc..21254942 100644 --- a/firmware/targets/f6/cube/Makefile +++ b/firmware/targets/f6/cube/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.11.2] date: [Sun May 16 12:24:45 MSK 2021] +# File automatically-generated by tool: [projectgenerator] version: [3.13.0-B3] date: [Tue Jul 20 02:23:07 MSK 2021] ########################################################################################################################## # ------------------------------------------------ @@ -94,8 +94,8 @@ Src/stm32wbxx_hal_msp.c \ /Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c \ /Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \ /Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \ -/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \ -/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \ +/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usart.c \ +/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_rcc.c \ Src/system_stm32wbxx.c \ /Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \ /Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \ @@ -178,7 +178,6 @@ C_INCLUDES = \ -I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \ -I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \ -I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/CMSIS/Device/ST/STM32WBxx/Include \ --I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/CMSIS/Include \ -I/Users/aku/STM32Cube/Repository/STM32Cube_FW_WB_V1.10.1/Drivers/CMSIS/Include diff --git a/firmware/targets/f6/cube/Src/main.c b/firmware/targets/f6/cube/Src/main.c index 6eece750..d4bfe02f 100644 --- a/firmware/targets/f6/cube/Src/main.c +++ b/firmware/targets/f6/cube/Src/main.c @@ -105,7 +105,6 @@ int main(void) MX_RTC_Init(); MX_SPI1_Init(); MX_SPI2_Init(); - MX_USART1_UART_Init(); MX_USB_Device_Init(); MX_TIM1_Init(); MX_TIM2_Init(); @@ -117,6 +116,7 @@ int main(void) MX_AES1_Init(); MX_AES2_Init(); MX_CRC_Init(); + MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ @@ -145,87 +145,106 @@ int main(void) */ void SystemClock_Config(void) { - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; + LL_FLASH_SetLatency(LL_FLASH_LATENCY_3); + while(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_3) + { + } - /** Configure LSE Drive Capability - */ - HAL_PWR_EnableBkUpAccess(); - __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMLOW); - /** Configure the main internal regulator output voltage - */ - __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /** Initializes the RCC Oscillators according to the specified parameters - * in the RCC_OscInitTypeDef structure. - */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE - |RCC_OSCILLATORTYPE_LSE; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.LSEState = RCC_LSE_ON; - RCC_OscInitStruct.HSIState = RCC_HSI_ON; - RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV2; - RCC_OscInitStruct.PLL.PLLN = 8; - RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; - RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; - RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; - if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + /* HSE configuration and activation */ + LL_RCC_HSE_Enable(); + while(LL_RCC_HSE_IsReady() != 1) { - Error_Handler(); } - /** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4|RCC_CLOCKTYPE_HCLK2 - |RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK - |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; - RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; - RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; - RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; - RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV2; - RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1; - if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK) + /* HSI configuration and activation */ + LL_RCC_HSI_Enable(); + while(LL_RCC_HSI_IsReady() != 1) + { + } + + LL_PWR_EnableBkUpAccess(); + LL_RCC_LSE_SetDriveCapability(LL_RCC_LSEDRIVE_MEDIUMLOW); + LL_RCC_LSE_Enable(); + + /* Wait till LSE is ready */ + while(LL_RCC_LSE_IsReady() != 1) + { + } + + LL_RCC_HSE_EnableCSS(); + LL_RCC_LSE_EnableCSS(); + /* Main PLL configuration and activation */ + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 8, LL_RCC_PLLR_DIV_2); + LL_RCC_PLL_Enable(); + LL_RCC_PLL_EnableDomain_SYS(); + while(LL_RCC_PLL_IsReady() != 1) + { + } + + LL_RCC_PLLSAI1_ConfigDomain_48M(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 6, LL_RCC_PLLSAI1Q_DIV_2); + LL_RCC_PLLSAI1_ConfigDomain_ADC(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 6, LL_RCC_PLLSAI1R_DIV_2); + LL_RCC_PLLSAI1_Enable(); + LL_RCC_PLLSAI1_EnableDomain_48M(); + LL_RCC_PLLSAI1_EnableDomain_ADC(); + + /* Wait till PLLSAI1 is ready */ + while(LL_RCC_PLLSAI1_IsReady() != 1) + { + } + + /* Sysclk activation on the main PLL */ + /* Set CPU1 prescaler*/ + LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + + /* Set CPU2 prescaler*/ + LL_C2_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2); + + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); + while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + { + } + + /* Set AHB SHARED prescaler*/ + LL_RCC_SetAHB4Prescaler(LL_RCC_SYSCLK_DIV_1); + + /* Set APB1 prescaler*/ + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); + + /* Set APB2 prescaler*/ + LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); + + /* Disable MSI */ + LL_RCC_MSI_Disable(); + while(LL_RCC_MSI_IsReady() != 0) + { + } + + /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */ + LL_SetSystemCoreClock(64000000); + + /* Update the time base */ + if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK) { Error_Handler(); } - /** Initializes the peripherals clocks - */ - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS|RCC_PERIPHCLK_RFWAKEUP - |RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USART1 - |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_CLK48SEL - |RCC_PERIPHCLK_USB|RCC_PERIPHCLK_RNG - |RCC_PERIPHCLK_ADC; - PeriphClkInitStruct.PLLSAI1.PLLN = 6; - PeriphClkInitStruct.PLLSAI1.PLLP = RCC_PLLP_DIV2; - PeriphClkInitStruct.PLLSAI1.PLLQ = RCC_PLLQ_DIV2; - PeriphClkInitStruct.PLLSAI1.PLLR = RCC_PLLR_DIV2; - PeriphClkInitStruct.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_USBCLK|RCC_PLLSAI1_ADCCLK; - PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2; - PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1; - PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLLSAI1; - PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_CLK48; - PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1; - PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; - PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_LSE; - PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE; - PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1; - if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) + if(LL_RCC_GetRTCClockSource() != LL_RCC_RTC_CLKSOURCE_LSE) { - Error_Handler(); + LL_RCC_ForceBackupDomainReset(); + LL_RCC_ReleaseBackupDomainReset(); + LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE); } + LL_RCC_EnableRTC(); + LL_RCC_SetUSARTClockSource(LL_RCC_USART1_CLKSOURCE_PCLK2); + LL_RCC_SetADCClockSource(LL_RCC_ADC_CLKSOURCE_PLLSAI1); + LL_RCC_SetI2CClockSource(LL_RCC_I2C1_CLKSOURCE_PCLK1); + LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_CLK48); + LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLLSAI1); + LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSE); + LL_RCC_SetSMPSPrescaler(LL_RCC_SMPS_DIV_1); + LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE); /* USER CODE BEGIN Smps */ /* USER CODE END Smps */ - /** Enables the Clock Security System - */ - HAL_RCC_EnableCSS(); - /** Enables the Clock Security System - */ - HAL_RCCEx_EnableLSECSS(); } /* USER CODE BEGIN 4 */ diff --git a/firmware/targets/f6/cube/Src/stm32wbxx_it.c b/firmware/targets/f6/cube/Src/stm32wbxx_it.c index ebb1f938..707f5e06 100644 --- a/firmware/targets/f6/cube/Src/stm32wbxx_it.c +++ b/firmware/targets/f6/cube/Src/stm32wbxx_it.c @@ -79,7 +79,6 @@ void NMI_Handler(void) /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ /* USER CODE END NonMaskableInt_IRQn 0 */ - HAL_RCC_NMI_IRQHandler(); /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ while (1) { diff --git a/firmware/targets/f6/cube/Src/usart.c b/firmware/targets/f6/cube/Src/usart.c index 3acecbb3..51a8298c 100644 --- a/firmware/targets/f6/cube/Src/usart.c +++ b/firmware/targets/f6/cube/Src/usart.c @@ -24,96 +24,59 @@ /* USER CODE END 0 */ -UART_HandleTypeDef huart1; - /* USART1 init function */ void MX_USART1_UART_Init(void) { + LL_USART_InitTypeDef USART_InitStruct = {0}; - huart1.Instance = USART1; - huart1.Init.BaudRate = 115200; - huart1.Init.WordLength = UART_WORDLENGTH_8B; - huart1.Init.StopBits = UART_STOPBITS_1; - huart1.Init.Parity = UART_PARITY_NONE; - huart1.Init.Mode = UART_MODE_TX_RX; - huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; - huart1.Init.OverSampling = UART_OVERSAMPLING_16; - huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; - huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1; - huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; - if (HAL_UART_Init(&huart1) != HAL_OK) + LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Peripheral clock enable */ + LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1); + + LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB); + /**USART1 GPIO Configuration + PB6 ------> USART1_TX + PB7 ------> USART1_RX + */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7; + GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; + GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; + GPIO_InitStruct.Alternate = LL_GPIO_AF_7; + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1; + USART_InitStruct.BaudRate = 115200; + USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; + USART_InitStruct.StopBits = LL_USART_STOPBITS_1; + USART_InitStruct.Parity = LL_USART_PARITY_NONE; + USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX; + USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; + USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; + LL_USART_Init(USART1, &USART_InitStruct); + LL_USART_SetTXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_8); + LL_USART_SetRXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_8); + LL_USART_DisableFIFO(USART1); + LL_USART_EnableAutoBaudRate(USART1); + LL_USART_SetAutoBaudRateMode(USART1, LL_USART_AUTOBAUD_DETECT_ON_STARTBIT); + LL_USART_ConfigAsyncMode(USART1); + + /* USER CODE BEGIN WKUPType USART1 */ + + /* USER CODE END WKUPType USART1 */ + + LL_USART_Enable(USART1); + + /* Polling USART1 initialisation */ + while((!(LL_USART_IsActiveFlag_TEACK(USART1))) || (!(LL_USART_IsActiveFlag_REACK(USART1)))) { - Error_Handler(); - } - if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK) - { - Error_Handler(); - } - if (HAL_UARTEx_SetRxFifoThreshold(&huart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK) - { - Error_Handler(); - } - if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK) - { - Error_Handler(); } } -void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) -{ - - GPIO_InitTypeDef GPIO_InitStruct = {0}; - if(uartHandle->Instance==USART1) - { - /* USER CODE BEGIN USART1_MspInit 0 */ - - /* USER CODE END USART1_MspInit 0 */ - /* USART1 clock enable */ - __HAL_RCC_USART1_CLK_ENABLE(); - - __HAL_RCC_GPIOB_CLK_ENABLE(); - /**USART1 GPIO Configuration - PB6 ------> USART1_TX - PB7 ------> USART1_RX - */ - GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF7_USART1; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - - /* USER CODE BEGIN USART1_MspInit 1 */ - - /* USER CODE END USART1_MspInit 1 */ - } -} - -void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) -{ - - if(uartHandle->Instance==USART1) - { - /* USER CODE BEGIN USART1_MspDeInit 0 */ - - /* USER CODE END USART1_MspDeInit 0 */ - /* Peripheral clock disable */ - __HAL_RCC_USART1_CLK_DISABLE(); - - /**USART1 GPIO Configuration - PB6 ------> USART1_TX - PB7 ------> USART1_RX - */ - HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7); - - /* USER CODE BEGIN USART1_MspDeInit 1 */ - - /* USER CODE END USART1_MspDeInit 1 */ - } -} - /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ diff --git a/firmware/targets/f6/cube/f6.ioc b/firmware/targets/f6/cube/f6.ioc index 438701e3..fcf156c7 100644 --- a/firmware/targets/f6/cube/f6.ioc +++ b/firmware/targets/f6/cube/f6.ioc @@ -1,585 +1,589 @@ #MicroXplorer Configuration settings - do not modify -PA11.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -PB13.GPIOParameters=GPIO_Label -RCC.USART1Freq_Value=64000000 -RF1.Locked=true -SPI1.VirtualType=VM_MASTER -PB10.GPIO_PuPd=GPIO_PULLUP -RF1.Signal=RF_RF1 -SPI2.VirtualType=VM_MASTER -VP_ADC1_TempSens_Input.Mode=IN-TempSens -VP_AES1_VS_AES.Signal=AES1_VS_AES -PC12.Locked=true -TIM1.IPParameters=Channel-Output Compare1 CH1N,Channel-PWM Generation3 CH3N -PC12.Signal=GPIO_Output -PB14.GPIO_Label=iBTN -I2C1.I2C_Rise_Time=0 -PC6.GPIO_Label=BUTTON_DOWN -VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled -RCC.RTCFreq_Value=32768 -PA3.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP -PA6.GPIO_Label=PA6 -COMP1.Hysteresis=COMP_HYSTERESIS_HIGH -PD0.Locked=true -VP_COMP1_VS_VREFINT14.Signal=COMP1_VS_VREFINT14 -USART1.IPParameters=VirtualMode-Asynchronous -PA3.GPIO_Speed=GPIO_SPEED_FREQ_LOW -PB13.Signal=TIM1_CH1N -PA2.GPIOParameters=GPIO_Label -PC15-OSC32_OUT.GPIO_Label=QUARTZ_32MHZ_OUT -PinOutPanel.RotationAngle=0 -RCC.MCO1PinFreq_Value=64000000 -RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK -SH.GPXTI13.0=GPIO_EXTI13 -RCC.LPTIM1Freq_Value=32768 -NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false -FREERTOS.configENABLE_FPU=1 -SH.GPXTI3.ConfNb=1 -NVIC.ADC1_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true -SH.S_TIM16_CH1.ConfNb=1 -SPI1.Direction=SPI_DIRECTION_2LINES -TIM2.IPParameters=Channel-Input_Capture1_from_TI1,ICPolarity_CH1,AutoReloadPreload,Prescaler,Channel-Input_Capture2_from_TI1 -RCC.APB2TimFreq_Value=64000000 -PCC.Ble.PowerLevel=Min -COMP1.Mode=COMP_POWERMODE_MEDIUMSPEED -PB6.Signal=USART1_TX -PB6.Mode=Asynchronous -NVIC.TAMP_STAMP_LSECSS_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true -SPI1.CalculateBaudRate=4.0 MBits/s -PC3.Signal=GPIO_Analog -PD0.Signal=GPIO_Output -VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT -RCC.PREFETCH_ENABLE=1 -PB13.Locked=true -VP_AES2_VS_AES.Signal=AES2_VS_AES -NVIC.EXTI15_10_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true -ProjectManager.ProjectBuild=false -NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false -PB2.Signal=GPIO_Analog -PH3-BOOT0.Locked=true -PA8.Locked=true -PD1.GPIOParameters=GPIO_Label -RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE -SH.GPXTI12.0=GPIO_EXTI12 -PD1.GPIO_Label=SPI_D_SCK -PB12.GPIO_Label=BUTTON_RIGHT -ProjectManager.FirmwarePackage=STM32Cube FW_WB V1.10.1 -VP_ADC1_Vref_Input.Mode=IN-Vrefint -MxDb.Version=DB.6.0.10 -PB0.GPIOParameters=GPIO_Label -PA1.GPIOParameters=GPIO_Label -ProjectManager.BackupPrevious=false -PC4.GPIO_Label=RF_SW_0 -FREERTOS.HEAP_NUMBER=4 -RCC.LSE_Drive_Capability=RCC_LSEDRIVE_MEDIUMLOW -PB1.GPIO_Label=DISPLAY_DI -NVIC.TIM2_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true -SPI1.DataSize=SPI_DATASIZE_8BIT -PE4.GPIO_Label=NFC_CS -SPI2.CalculateBaudRate=4.0 MBits/s -PA8.Signal=GPIO_Output -RCC.PLLRCLKFreq_Value=64000000 -SH.GPXTI11.ConfNb=1 -PB6.Locked=true -NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false -ProjectManager.HalAssertFull=false -ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_2CYCLES_5 -VP_TIM1_VS_ClockSourceINT.Mode=Internal -TIM16.Pulse=145 -PA0.Signal=S_TIM2_CH1 -PH3-BOOT0.Signal=GPXTI3 -NVIC.HSEM_IRQn=true\:5\:0\:true\:false\:true\:false\:false\:true -PB9.Signal=TIM1_CH3N -Mcu.Package=VFQFPN68 -TIM2.Prescaler=64-1 -PB1.Signal=GPIO_Output -PA5.Locked=true -SPI2.Mode=SPI_MODE_MASTER -SH.GPXTI11.0=GPIO_EXTI11 -VP_PKA_VS_PKA.Mode=PKA_Activate -PA14.Locked=true -VP_SYS_VS_Systick.Signal=SYS_VS_Systick -RCC.LSCOPinFreq_Value=32000 -PA10.Signal=I2C1_SDA -VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar -FREERTOS.FootprintOK=true -PA5.GPIOParameters=GPIO_Label -NVIC.USB_LP_IRQn=true\:5\:0\:true\:false\:true\:false\:false\:true -PB14.GPIOParameters=GPIO_Label -VP_HSEM_VS_HSEM.Mode=HSEM_Activate -RCC.PLLPoutputFreq_Value=64000000 -RCC.APB1TimFreq_Value=64000000 -FREERTOS.configGENERATE_RUN_TIME_STATS=1 -NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false -RCC.LPUART1Freq_Value=64000000 -PB10.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI -PB13.Mode=Output Compare1 CH1N -TIM16.Prescaler=500 - 1 -PC15-OSC32_OUT.GPIOParameters=GPIO_Label -I2C1.CustomTiming=Disabled -RCC.SMPSDivider=4 -PA4.GPIO_Label=PA4 -ProjectManager.CustomerFirmwarePackage= -PC4.GPIOParameters=GPIO_Label -NVIC.RCC_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:false -RCC.HSI48_VALUE=48000000 -PA5.Mode=Full_Duplex_Master -PA6.GPIOParameters=GPIO_Label -SH.GPXTI10.0=GPIO_EXTI10 -PCC.Ble.Mode=NOT_SELECTED -RCC.PLLQoutputFreq_Value=64000000 -ProjectManager.ProjectFileName=f6.ioc -RCC.SMPSFreq_Value=4000000 -PA3.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD -FREERTOS.Tasks01=app_main,24,1024,app,As weak,NULL,Dynamic,NULL,NULL -ADC1.Rank-0\#ChannelRegularConversion=1 -PA15.GPIOParameters=GPIO_Label -Mcu.PinsNb=69 -PC11.Locked=true -I2C1.I2C_Fall_Time=0 -ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,NbrOfConversionFlag,master,EnableAnalogWatchDog1,ContinuousConvMode -PC13.Locked=true -ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE -RCC.HCLK3Freq_Value=64000000 -PA9.GPIO_Label=I2C_SCL -PC13.Signal=GPXTI13 -FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1 -PC2.Signal=SPI2_MISO -PC6.Signal=GPIO_Input -PB11.GPIO_Label=BUTTON_LEFT -PD1.Signal=SPI2_SCK -SH.S_TIM16_CH1.0=TIM16_CH1,PWM Generation1 CH1 -VP_TIM16_VS_ClockSourceINT.Mode=Enable_Timer -SPI1.CLKPhase=SPI_PHASE_2EDGE -OSC_IN.Locked=true -Mcu.Pin68=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS -RCC.HCLK2Freq_Value=32000000 -PC0.Signal=GPIO_Analog -PC14-OSC32_IN.Signal=RCC_OSC32_IN -PC11.GPIOParameters=PinState,GPIO_Label -Mcu.Pin62=VP_RTC_VS_RTC_Activate -Mcu.Pin63=VP_RTC_VS_RTC_Calendar -Mcu.Pin60=VP_PKA_VS_PKA -Mcu.Pin61=VP_RNG_VS_RNG -Mcu.Pin66=VP_TIM2_VS_ClockSourceINT -Mcu.Pin67=VP_TIM16_VS_ClockSourceINT -Mcu.Pin64=VP_SYS_VS_Systick -Mcu.Pin65=VP_TIM1_VS_ClockSourceINT -PD0.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -PC3.GPIOParameters=GPIO_Label -PB8.GPIO_Label=SPEAKER -PA11.Locked=true -PA15.Locked=true -PA8.GPIO_Label=RFID_TUNE -PC15-OSC32_OUT.Locked=true -Mcu.Pin59=VP_HSEM_VS_HSEM -Mcu.Pin57=VP_CRC_VS_CRC -Mcu.Pin58=VP_FREERTOS_VS_CMSIS_V2 -PC12.PinState=GPIO_PIN_SET -USB_DEVICE.PRODUCT_STRING_CDC_FS=Flipper Control Virtual ComPort -Mcu.Pin51=PB7 -Mcu.Pin52=VP_ADC1_TempSens_Input -Mcu.Pin50=PB6 -VP_CRC_VS_CRC.Signal=CRC_VS_CRC -Mcu.Pin55=VP_AES2_VS_AES -Mcu.Pin56=VP_COMP1_VS_VREFINT14 -Mcu.Pin53=VP_ADC1_Vref_Input -Mcu.Pin54=VP_AES1_VS_AES -PC6.Locked=true -PA9.Signal=I2C1_SCL -VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT -I2C1.Timing=0x10707DBC -PB11.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI -PB9.Locked=true -PB5.Locked=true -OSC_IN.Signal=RCC_OSC_IN -Mcu.Pin48=PB4 -Mcu.Pin49=PB5 -RCC.PLLSAI1PoutputFreq_Value=48000000 -Mcu.Pin46=PD1 -Mcu.Pin47=PB3 -PB10.Signal=GPXTI10 -PB14.Signal=GPIO_Analog -PA5.Signal=SPI1_SCK -Mcu.Pin40=PA14 -Mcu.Pin41=PA15 -Mcu.Pin44=PC12 -Mcu.Pin45=PD0 -Mcu.Pin42=PC10 -Mcu.Pin43=PC11 -VP_PKA_VS_PKA.Signal=PKA_VS_PKA -RCC.Cortex2Freq_Value=32000000 -ProjectManager.LastFirmware=false -PD1.Mode=Full_Duplex_Master -RCC.RNGCLockSelection=RCC_RNGCLKSOURCE_CLK48 -Mcu.Pin37=PA11 -PB4.GPIO_Label=SPI_R_MISO -PCC.Ble.DataLength=6 -Mcu.Pin38=PA12 -Mcu.Pin35=PC6 -PB15.GPIO_Label=SPI_D_MOSI -RCC.I2C1Freq_Value=64000000 -Mcu.Pin36=PA10 -SPI1.Mode=SPI_MODE_MASTER -Mcu.Pin39=PA13 -RCC.LCDFreq_Value=32768 -RCC.RNGFreq_Value=16000000 -PC2.GPIOParameters=GPIO_Label -VP_ADC1_TempSens_Input.Signal=ADC1_TempSens_Input -Mcu.Pin30=PE4 -NVIC.COMP_IRQn=true\:5\:0\:true\:false\:true\:false\:false\:true -PA1.GPIO_Label=CC1101_G0 -Mcu.Pin33=PB14 -Mcu.Pin34=PB15 -Mcu.Pin31=PB12 -Mcu.Pin32=PB13 -PA9.Locked=true -VP_TIM16_VS_ClockSourceINT.Signal=TIM16_VS_ClockSourceINT -NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true -PC10.GPIOParameters=GPIO_Label -PA13.Mode=Serial_Wire -ProjectManager.FreePins=false -PB10.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING -RCC.LPTIM2Freq_Value=64000000 -Mcu.Pin26=OSC_OUT -Mcu.Pin27=OSC_IN -Mcu.Pin24=PB11 -ProjectManager.UnderRoot=false -Mcu.Pin25=RF1 -Mcu.Pin28=PB0 -Mcu.Pin29=PB1 -PB4.Locked=true -PA4.Signal=GPIO_Analog -Mcu.Pin22=PB2 -PB5.Signal=SPI1_MOSI -Mcu.Pin23=PB10 -Mcu.Pin20=PC4 -ADC1.master=1 -PA3.Locked=true -Mcu.Pin21=PC5 -PA5.GPIO_Label=SPI_R_SCK -PA10.Locked=true -NVIC.ForceEnableDMAVector=true -OSC_IN.Mode=HSE-External-Oscillator -NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false -PC12.GPIO_Label=SD_CS -ProjectManager.CompilerOptimize=6 -PA11.Signal=USB_DM -ProjectManager.HeapSize=0x400 -PA0.GPIOParameters=GPIO_Label -Mcu.Pin15=PA5 -NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false -Mcu.Pin16=PA6 -Mcu.Pin13=PA3 -Mcu.Pin14=PA4 -Mcu.Pin19=PA9 -ProjectManager.ComputerToolchain=false -Mcu.Pin17=PA7 -Mcu.Pin18=PA8 -NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 -Mcu.Pin11=PA1 -Mcu.Pin12=PA2 -PD0.GPIOParameters=GPIO_Speed,PinState,GPIO_Label -Mcu.Pin10=PA0 -SH.GPXTI10.ConfNb=1 -USB_DEVICE.APP_RX_DATA_SIZE=512 -TIM2.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE -PC3.GPIO_Label=PC3 -PA3.PinState=GPIO_PIN_SET -PE4.PinState=GPIO_PIN_SET -RCC.PWRFreq_Value=64000000 -SPI2.DataSize=SPI_DATASIZE_8BIT -VP_AES1_VS_AES.Mode=AES_Activate -SH.SharedAnalog_PC5.ConfNb=2 -PB12.GPIO_PuPd=GPIO_PULLUP -PD1.Locked=true -PB0.Signal=GPIO_Output -PA7.GPIOParameters=GPIO_Label -PC1.Signal=GPIO_Analog -PB12.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI -Mcu.Family=STM32WB -ProjectManager.MainLocation=Src -OSC_OUT.GPIO_Label=QUARTZ_32KHZ_OUT -USB_DEVICE.CLASS_NAME_FS=CDC -RCC.SAI1Freq_Value=48000000 -RCC.CortexFreq_Value=64000000 -TIM2.Channel-Input_Capture1_from_TI1=TIM_CHANNEL_1 -ProjectManager.KeepUserCode=true -Mcu.UserName=STM32WB55RGVx +ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_14 ADC1.ContinuousConvMode=DISABLE -RCC.RFWKPFreq_Value=32768 -PC10.Locked=true -PC10.Signal=GPIO_Input -RCC.PLLSAI1RoutputFreq_Value=48000000 -PC5.Locked=true -PA0.GPIO_Label=IR_RX -PA12.GPIOParameters=GPIO_Speed -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_I2C1_Init-I2C1-false-LL-true,5-MX_RTC_Init-RTC-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_SPI2_Init-SPI2-false-HAL-true,8-MX_USART1_UART_Init-USART1-false-HAL-true,9-MX_USB_Device_Init-USB_DEVICE-false-HAL-false,10-MX_TIM1_Init-TIM1-false-HAL-true,11-MX_TIM2_Init-TIM2-false-HAL-true,12-MX_TIM16_Init-TIM16-false-HAL-true,13-MX_COMP1_Init-COMP1-false-HAL-true,14-MX_RF_Init-RF-false-HAL-true,15-MX_PKA_Init-PKA-false-HAL-true,16-MX_RNG_Init-RNG-false-HAL-true,17-MX_AES1_Init-AES1-false-HAL-true,18-MX_AES2_Init-AES2-false-HAL-true,19-MX_CRC_Init-CRC-false-HAL-true,0-MX_HSEM_Init-HSEM-false-HAL-true -PC0.GPIOParameters=GPIO_Label -PA9.GPIOParameters=GPIO_Speed,GPIO_Label -PH3-BOOT0.GPIO_Label=BUTTON_OK -PA11.GPIOParameters=GPIO_Speed -NVIC.EXTI3_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true -PD0.GPIO_Label=CC1101_CS -PC0.GPIO_Label=PC0 -PA11.Mode=Device -PB0.GPIO_Label=DISPLAY_RST +ADC1.EnableAnalogWatchDog1=false +ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,NbrOfConversionFlag,master,EnableAnalogWatchDog1,ContinuousConvMode +ADC1.NbrOfConversionFlag=1 +ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE +ADC1.Rank-0\#ChannelRegularConversion=1 +ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_2CYCLES_5 +ADC1.master=1 +COMP1.Hysteresis=COMP_HYSTERESIS_HIGH +COMP1.IPParameters=TriggerMode,Hysteresis,Mode +COMP1.Mode=COMP_POWERMODE_MEDIUMSPEED +COMP1.TriggerMode=COMP_TRIGGERMODE_IT_RISING_FALLING +FREERTOS.FootprintOK=true +FREERTOS.HEAP_NUMBER=4 +FREERTOS.INCLUDE_vTaskCleanUpResources=1 +FREERTOS.IPParameters=Tasks01,configTOTAL_HEAP_SIZE,HEAP_NUMBER,configUSE_TIMERS,configUSE_IDLE_HOOK,FootprintOK,configCHECK_FOR_STACK_OVERFLOW,configRECORD_STACK_HIGH_ADDRESS,configGENERATE_RUN_TIME_STATS,configENABLE_FPU,configUSE_TICKLESS_IDLE,configENABLE_BACKWARD_COMPATIBILITY,INCLUDE_vTaskCleanUpResources,configTICK_RATE_HZ +FREERTOS.Tasks01=app_main,24,1024,app,As weak,NULL,Dynamic,NULL,NULL +FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1 +FREERTOS.configENABLE_BACKWARD_COMPATIBILITY=0 +FREERTOS.configENABLE_FPU=1 +FREERTOS.configGENERATE_RUN_TIME_STATS=1 +FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1 FREERTOS.configTICK_RATE_HZ=1000 -VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar -PB11.GPIO_PuPd=GPIO_PULLUP -PC13.GPIO_Label=BUTTON_BACK -PB13.GPIO_Label=RFID_OUT -PB11.Signal=GPXTI11 -PB15.Signal=SPI2_MOSI -OSC_OUT.GPIOParameters=GPIO_Label -ProjectManager.StackSize=0x1000 -PB5.GPIOParameters=GPIO_Label -VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2 -RCC.I2C3Freq_Value=64000000 +FREERTOS.configTOTAL_HEAP_SIZE=40960 +FREERTOS.configUSE_IDLE_HOOK=1 +FREERTOS.configUSE_TICKLESS_IDLE=2 +FREERTOS.configUSE_TIMERS=1 +File.Version=6 +GPIO.groupedBy=Show All +I2C1.CustomTiming=Disabled +I2C1.I2C_Fall_Time=0 +I2C1.I2C_Rise_Time=0 +I2C1.IPParameters=Timing,CustomTiming,I2C_Rise_Time,I2C_Fall_Time +I2C1.Timing=0x10707DBC +KeepUserPlacement=false +Mcu.Family=STM32WB +Mcu.IP0=ADC1 +Mcu.IP1=AES1 +Mcu.IP10=RCC +Mcu.IP11=RF +Mcu.IP12=RNG +Mcu.IP13=RTC +Mcu.IP14=SPI1 +Mcu.IP15=SPI2 +Mcu.IP16=SYS +Mcu.IP17=TIM1 +Mcu.IP18=TIM2 +Mcu.IP19=TIM16 +Mcu.IP2=AES2 +Mcu.IP20=USART1 +Mcu.IP21=USB +Mcu.IP22=USB_DEVICE +Mcu.IP3=COMP1 Mcu.IP4=CRC Mcu.IP5=FREERTOS -RCC.FCLKCortexFreq_Value=64000000 -USB_DEVICE.MANUFACTURER_STRING=Flipper -Mcu.IP2=AES2 -I2C1.IPParameters=Timing,CustomTiming,I2C_Rise_Time,I2C_Fall_Time -Mcu.IP3=COMP1 -PA15.GPIO_Label=VIBRO -PB4.GPIOParameters=GPIO_Label -Mcu.IP0=ADC1 -PA12.Locked=true -Mcu.IP1=AES1 -PA12.Signal=USB_DP -PE4.GPIOParameters=GPIO_Speed,PinState,GPIO_Label -Mcu.UserConstants= -RCC.VCOSAI1OutputFreq_Value=96000000 -TIM2.ICPolarity_CH1=TIM_INPUTCHANNELPOLARITY_FALLING -PC1.GPIOParameters=GPIO_Label -SH.GPXTI13.ConfNb=1 -Mcu.ThirdPartyNb=0 -RCC.HCLKFreq_Value=64000000 +Mcu.IP6=HSEM +Mcu.IP7=I2C1 +Mcu.IP8=NVIC +Mcu.IP9=PKA Mcu.IPNb=23 -ProjectManager.PreviousToolchain= -PA8.GPIOParameters=GPIO_Label +Mcu.Name=STM32WB55RGVx +Mcu.Package=VFQFPN68 +Mcu.Pin0=PC13 +Mcu.Pin1=PC14-OSC32_IN +Mcu.Pin10=PA0 +Mcu.Pin11=PA1 +Mcu.Pin12=PA2 +Mcu.Pin13=PA3 +Mcu.Pin14=PA4 +Mcu.Pin15=PA5 +Mcu.Pin16=PA6 +Mcu.Pin17=PA7 +Mcu.Pin18=PA8 +Mcu.Pin19=PA9 +Mcu.Pin2=PC15-OSC32_OUT +Mcu.Pin20=PC4 +Mcu.Pin21=PC5 +Mcu.Pin22=PB2 +Mcu.Pin23=PB10 +Mcu.Pin24=PB11 +Mcu.Pin25=RF1 +Mcu.Pin26=OSC_OUT +Mcu.Pin27=OSC_IN +Mcu.Pin28=PB0 +Mcu.Pin29=PB1 +Mcu.Pin3=PH3-BOOT0 +Mcu.Pin30=PE4 +Mcu.Pin31=PB12 +Mcu.Pin32=PB13 +Mcu.Pin33=PB14 +Mcu.Pin34=PB15 +Mcu.Pin35=PC6 +Mcu.Pin36=PA10 +Mcu.Pin37=PA11 +Mcu.Pin38=PA12 +Mcu.Pin39=PA13 +Mcu.Pin4=PB8 +Mcu.Pin40=PA14 +Mcu.Pin41=PA15 +Mcu.Pin42=PC10 +Mcu.Pin43=PC11 +Mcu.Pin44=PC12 +Mcu.Pin45=PD0 +Mcu.Pin46=PD1 +Mcu.Pin47=PB3 +Mcu.Pin48=PB4 +Mcu.Pin49=PB5 +Mcu.Pin5=PB9 +Mcu.Pin50=PB6 +Mcu.Pin51=PB7 +Mcu.Pin52=VP_ADC1_TempSens_Input +Mcu.Pin53=VP_ADC1_Vref_Input +Mcu.Pin54=VP_AES1_VS_AES +Mcu.Pin55=VP_AES2_VS_AES +Mcu.Pin56=VP_COMP1_VS_VREFINT14 +Mcu.Pin57=VP_CRC_VS_CRC +Mcu.Pin58=VP_FREERTOS_VS_CMSIS_V2 +Mcu.Pin59=VP_HSEM_VS_HSEM Mcu.Pin6=PC0 +Mcu.Pin60=VP_PKA_VS_PKA +Mcu.Pin61=VP_RNG_VS_RNG +Mcu.Pin62=VP_RTC_VS_RTC_Activate +Mcu.Pin63=VP_RTC_VS_RTC_Calendar +Mcu.Pin64=VP_SYS_VS_Systick +Mcu.Pin65=VP_TIM1_VS_ClockSourceINT +Mcu.Pin66=VP_TIM2_VS_ClockSourceINT +Mcu.Pin67=VP_TIM16_VS_ClockSourceINT +Mcu.Pin68=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS Mcu.Pin7=PC1 Mcu.Pin8=PC2 Mcu.Pin9=PC3 -OSC_OUT.Mode=HSE-External-Oscillator -FREERTOS.IPParameters=Tasks01,configTOTAL_HEAP_SIZE,HEAP_NUMBER,configUSE_TIMERS,configUSE_IDLE_HOOK,FootprintOK,configCHECK_FOR_STACK_OVERFLOW,configRECORD_STACK_HIGH_ADDRESS,configGENERATE_RUN_TIME_STATS,configENABLE_FPU,configUSE_TICKLESS_IDLE,configENABLE_BACKWARD_COMPATIBILITY,INCLUDE_vTaskCleanUpResources,configTICK_RATE_HZ -OSC_OUT.Signal=RCC_OSC_OUT -RCC.AHBFreq_Value=64000000 -SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16 -Mcu.Pin0=PC13 -Mcu.Pin1=PC14-OSC32_IN -GPIO.groupedBy=Show All -Mcu.Pin2=PC15-OSC32_OUT -Mcu.Pin3=PH3-BOOT0 -Mcu.Pin4=PB8 -Mcu.Pin5=PB9 -ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_14 -RCC.HSE_VALUE=32000000 -RCC.FCLK2Freq_Value=32000000 -FREERTOS.configUSE_TIMERS=1 -NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false -PH3-BOOT0.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI -Mcu.IP10=RCC -NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false\:false -Mcu.IP12=RNG -Mcu.IP11=RF -FREERTOS.configENABLE_BACKWARD_COMPATIBILITY=0 -Mcu.IP18=TIM2 -Mcu.IP17=TIM1 -NVIC.TIM1_TRG_COM_TIM17_IRQn=true\:5\:0\:false\:false\:true\:false\:false\:true -Mcu.IP19=TIM16 -Mcu.IP14=SPI1 -PB4.Mode=Full_Duplex_Master -Mcu.IP13=RTC -Mcu.IP16=SYS -RCC.LSE_Timout=1000 -Mcu.IP15=SPI2 -PC14-OSC32_IN.Mode=LSE-External-Oscillator -RCC.VCOInputFreq_Value=16000000 -PD0.PinState=GPIO_PIN_SET -PA14.Mode=Serial_Wire -PE4.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -PC11.GPIO_Label=DISPLAY_CS -PB5.Mode=Full_Duplex_Master -File.Version=6 -PA10.GPIO_Label=I2C_SDA -PC13.GPIO_PuPd=GPIO_PULLUP -PB3.GPIOParameters=GPIO_Label -SH.S_TIM2_CH1.ConfNb=2 -PB7.Signal=USART1_RX -Mcu.IP21=USB -PB8.Locked=true -Mcu.IP20=USART1 -FREERTOS.INCLUDE_vTaskCleanUpResources=1 -Mcu.IP22=USB_DEVICE -PE4.Signal=GPIO_Output -PB0.Locked=true -FREERTOS.configTOTAL_HEAP_SIZE=40960 -PC14-OSC32_IN.GPIOParameters=GPIO_Label -ProjectManager.ProjectName=f6 -RCC.APB3Freq_Value=16000000 -PA6.Signal=GPIO_Analog -TIM2.Channel-Input_Capture2_from_TI1=TIM_CHANNEL_2 -RCC.EnbaleCSS=true -ProjectManager.ToolChainLocation= -PA2.GPIO_Label=RFID_PULL -RCC.LSI_VALUE=32000 -PB11.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING -PA15.Signal=GPIO_Output -VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS -RCC.MSIOscState=DISABLED -SPI2.CLKPhase=SPI_PHASE_1EDGE -PA10.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -PB5.GPIO_Label=SPI_R_MOSI -PC4.Locked=true -VP_AES2_VS_AES.Mode=AES_Activate -PC14-OSC32_IN.GPIO_Label=QUARTZ_32MHZ_IN -SPI2.Direction=SPI_DIRECTION_2LINES -PC5.Signal=SharedAnalog_PC5 -SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16 -OSC_IN.GPIO_Label=QUARTZ_32KHZ_IN -PC2.GPIO_Label=SPI_D_MISO -PC14-OSC32_IN.Locked=true -PA12.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -COMP1.TriggerMode=COMP_TRIGGERMODE_IT_RISING_FALLING -PB15.Locked=true -PB3.Locked=true -PB4.Signal=SPI1_MISO -RCC.PLLSAI1N=6 -PA3.Signal=GPIO_Output -PA2.Locked=true -PB3.GPIO_Label=PB3 -VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate -RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE -PC15-OSC32_OUT.Mode=LSE-External-Oscillator -SH.S_TIM2_CH1.1=TIM2_CH1,Input_Capture2_from_TI1 -SH.S_TIM2_CH1.0=TIM2_CH1,Input_Capture1_from_TI1 -PB8.GPIOParameters=GPIO_Label -PB9.GPIO_Label=IR_TX -PC10.GPIO_Label=SD_CD -PA10.Mode=I2C -ProjectManager.NoMain=false -SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,CLKPhase,BaudRatePrescaler -USB_DEVICE.VirtualModeFS=Cdc_FS -NVIC.SavedSvcallIrqHandlerGenerated=false -PC11.Signal=GPIO_Output -FREERTOS.configUSE_TICKLESS_IDLE=2 -PC4.Signal=GPIO_Output -ProjectManager.DefaultFWLocation=true -PC2.Mode=Full_Duplex_Master -VP_HSEM_VS_HSEM.Signal=HSEM_VS_HSEM -OSC_IN.GPIOParameters=GPIO_Label -PB12.Locked=true -ProjectManager.DeletePrevious=true -VP_RNG_VS_RNG.Mode=RNG_Activate -PB10.Locked=true -USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,CLASS_NAME_FS,MANUFACTURER_STRING,PRODUCT_STRING_CDC_FS,APP_RX_DATA_SIZE,APP_TX_DATA_SIZE -TIM16.Channel=TIM_CHANNEL_1 -RCC.AHB2CLKDivider=RCC_SYSCLK_DIV2 -RCC.FamilyName=M -PB9.GPIOParameters=GPIO_Label -PC12.GPIOParameters=GPIO_Speed,PinState,GPIO_Label -USART1.VirtualMode-Asynchronous=VM_ASYNC -PA13.Signal=SYS_JTMS-SWDIO -FREERTOS.configUSE_IDLE_HOOK=1 -VP_COMP1_VS_VREFINT14.Mode=VREFINT_14 -PA9.Mode=I2C -TIM1.Channel-Output\ Compare1\ CH1N=TIM_CHANNEL_1 -FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1 -ProjectManager.TargetToolchain=Makefile -PB10.GPIO_Label=BUTTON_UP -VP_RNG_VS_RNG.Signal=RNG_VS_RNG -VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS -RCC.HCLKRFFreq_Value=16000000 -PC5.GPIOParameters=GPIO_Label -PB9.Mode=PWM Generation3 CH3N -PB2.GPIOParameters=GPIO_Label -RCC.LPTIM1CLockSelection=RCC_LPTIM1CLKSOURCE_LSE -SH.GPXTI12.ConfNb=1 -PE4.Locked=true -SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,BaudRatePrescaler,CLKPhase -ADC1.EnableAnalogWatchDog1=false -PC2.Locked=true -ProjectManager.RegisterCallBack= -RCC.USBFreq_Value=48000000 -TIM1.Channel-PWM\ Generation3\ CH3N=TIM_CHANNEL_3 -PC15-OSC32_OUT.Signal=RCC_OSC32_OUT -PA1.Signal=GPIO_Analog -PB1.Locked=true -RCC.SMPSCLockSelectionVirtual=RCC_SMPSCLKSOURCE_HSE -board=custom -SH.GPXTI3.0=GPIO_EXTI3 -RCC.VCOOutputFreq_Value=128000000 -RCC.SMPS1Freq_Value=8000000 -PB15.Mode=Full_Duplex_Master -TIM16.Period=291 -NVIC.SavedSystickIrqHandlerGenerated=true -RCC.APB2Freq_Value=64000000 -PC11.PinState=GPIO_PIN_SET -COMP1.IPParameters=TriggerMode,Hysteresis,Mode +Mcu.PinsNb=69 +Mcu.ThirdPartyNb=0 +Mcu.UserConstants= +Mcu.UserName=STM32WB55RGVx MxCube.Version=6.1.2 -VP_TIM2_VS_ClockSourceINT.Mode=Internal -PC13.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI -SH.SharedAnalog_PC5.0=COMP1_INP,INP -RCC.PLLSAI1QoutputFreq_Value=48000000 -RCC.ADCFreq_Value=48000000 -PC1.GPIO_Label=PC1 -PA10.GPIOParameters=GPIO_Speed,GPIO_Label -VP_SYS_VS_Systick.Mode=SysTick -VP_ADC1_Vref_Input.Signal=ADC1_Vref_Input -SH.SharedAnalog_PC5.1=ADC1_IN14,IN14-Single-Ended -OSC_OUT.Locked=true -PA4.GPIOParameters=GPIO_Label -PH3-BOOT0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING -PB15.GPIOParameters=GPIO_Label -RCC.IPParameters=ADCFreq_Value,AHB2CLKDivider,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,APB3Freq_Value,Cortex2Freq_Value,CortexFreq_Value,EnableCSSLSE,EnbaleCSS,FCLK2Freq_Value,FCLKCortexFreq_Value,FamilyName,HCLK2Freq_Value,HCLK3Freq_Value,HCLKFreq_Value,HCLKRFFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C3Freq_Value,LCDFreq_Value,LPTIM1CLockSelection,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_Drive_Capability,LSE_Timout,LSI_VALUE,MCO1PinFreq_Value,MSIOscState,PLLM,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSAI1N,PLLSAI1PoutputFreq_Value,PLLSAI1QoutputFreq_Value,PLLSAI1RoutputFreq_Value,PLLSourceVirtual,PREFETCH_ENABLE,PWRFreq_Value,RFWKPClockSelection,RFWKPFreq_Value,RNGCLockSelection,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SMPS1Freq_Value,SMPSCLockSelectionVirtual,SMPSDivider,SMPSFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,USART1Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAI1OutputFreq_Value -ProjectManager.AskForMigrate=true -Mcu.Name=STM32WB55RGVx +MxDb.Version=DB.6.0.10 +NVIC.ADC1_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.COMP_IRQn=true\:5\:0\:true\:false\:true\:false\:false\:true +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.EXTI15_10_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true +NVIC.EXTI3_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true +NVIC.ForceEnableDMAVector=true +NVIC.HSEM_IRQn=true\:5\:0\:true\:false\:true\:false\:false\:true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true +NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false +NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 +NVIC.RCC_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:false +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false NVIC.SavedPendsvIrqHandlerGenerated=false -RCC.EnableCSSLSE=true -PA2.Signal=GPIO_Output -Mcu.IP8=NVIC -VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2 -Mcu.IP9=PKA -Mcu.IP6=HSEM -Mcu.IP7=I2C1 -ProjectManager.CoupleFile=true -PB3.Signal=GPIO_Analog -RCC.SYSCLKFreq_VALUE=64000000 -PA7.GPIO_Label=PA7 +NVIC.SavedSvcallIrqHandlerGenerated=false +NVIC.SavedSystickIrqHandlerGenerated=true +NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false\:false +NVIC.TAMP_STAMP_LSECSS_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true +NVIC.TIM1_TRG_COM_TIM17_IRQn=true\:5\:0\:false\:false\:true\:false\:false\:true +NVIC.TIM2_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true +NVIC.USB_LP_IRQn=true\:5\:0\:true\:false\:true\:false\:false\:true +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +OSC_IN.GPIOParameters=GPIO_Label +OSC_IN.GPIO_Label=QUARTZ_32KHZ_IN +OSC_IN.Locked=true +OSC_IN.Mode=HSE-External-Oscillator +OSC_IN.Signal=RCC_OSC_IN +OSC_OUT.GPIOParameters=GPIO_Label +OSC_OUT.GPIO_Label=QUARTZ_32KHZ_OUT +OSC_OUT.Locked=true +OSC_OUT.Mode=HSE-External-Oscillator +OSC_OUT.Signal=RCC_OSC_OUT +PA0.GPIOParameters=GPIO_Label +PA0.GPIO_Label=IR_RX +PA0.Signal=S_TIM2_CH1 +PA1.GPIOParameters=GPIO_Label +PA1.GPIO_Label=CC1101_G0 PA1.Locked=true +PA1.Signal=GPIO_Analog +PA10.GPIOParameters=GPIO_Speed,GPIO_Label +PA10.GPIO_Label=I2C_SDA +PA10.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PA10.Locked=true +PA10.Mode=I2C +PA10.Signal=I2C1_SDA +PA11.GPIOParameters=GPIO_Speed +PA11.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PA11.Locked=true +PA11.Mode=Device +PA11.Signal=USB_DM +PA12.GPIOParameters=GPIO_Speed +PA12.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PA12.Locked=true PA12.Mode=Device -PCC.Ble.ConnectionInterval=1000.0 -KeepUserPlacement=false -PC13.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING -PC5.GPIO_Label=RFID_RF_IN +PA12.Signal=USB_DP PA13.Locked=true -RF1.Mode=RF1_Activate -PB7.Mode=Asynchronous -USB_DEVICE.APP_TX_DATA_SIZE=512 +PA13.Mode=Serial_Wire +PA13.Signal=SYS_JTMS-SWDIO +PA14.Locked=true +PA14.Mode=Serial_Wire PA14.Signal=SYS_JTCK-SWCLK -PB2.GPIO_Label=PB2 -PC6.GPIOParameters=GPIO_Label -PB12.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING -RCC.HSI_VALUE=16000000 -ADC1.NbrOfConversionFlag=1 -RCC.PLLM=RCC_PLLM_DIV2 -PB7.Locked=true -PB8.Signal=S_TIM16_CH1 -PA9.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -TIM16.IPParameters=Channel,Pulse,Prescaler,Period -RCC.APB1Freq_Value=64000000 -RCC.RFWKPClockSelection=RCC_RFWKPCLKSOURCE_LSE -PC12.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH -VP_CRC_VS_CRC.Mode=CRC_Activate -USB_DEVICE.VirtualMode=Cdc -PB11.Locked=true -ProjectManager.DeviceId=STM32WB55RGVx -PB12.Signal=GPXTI12 -ProjectManager.LibraryCopy=2 +PA15.GPIOParameters=GPIO_Label +PA15.GPIO_Label=VIBRO +PA15.Locked=true +PA15.Signal=GPIO_Output +PA2.GPIOParameters=GPIO_Label +PA2.GPIO_Label=RFID_PULL +PA2.Locked=true +PA2.Signal=GPIO_Output +PA3.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP PA3.GPIO_Label=PERIPH_POWER -PB1.GPIOParameters=GPIO_Label +PA3.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PA3.GPIO_Speed=GPIO_SPEED_FREQ_LOW +PA3.Locked=true +PA3.PinState=GPIO_PIN_SET +PA3.Signal=GPIO_Output +PA4.GPIOParameters=GPIO_Label +PA4.GPIO_Label=PA4 +PA4.Signal=GPIO_Analog +PA5.GPIOParameters=GPIO_Label +PA5.GPIO_Label=SPI_R_SCK +PA5.Locked=true +PA5.Mode=Full_Duplex_Master +PA5.Signal=SPI1_SCK +PA6.GPIOParameters=GPIO_Label +PA6.GPIO_Label=PA6 +PA6.Signal=GPIO_Analog +PA7.GPIOParameters=GPIO_Label +PA7.GPIO_Label=PA7 PA7.Signal=GPIO_Analog +PA8.GPIOParameters=GPIO_Label +PA8.GPIO_Label=RFID_TUNE +PA8.Locked=true +PA8.Signal=GPIO_Output +PA9.GPIOParameters=GPIO_Speed,GPIO_Label +PA9.GPIO_Label=I2C_SCL +PA9.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PA9.Locked=true +PA9.Mode=I2C +PA9.Signal=I2C1_SCL +PB0.GPIOParameters=GPIO_Label +PB0.GPIO_Label=DISPLAY_RST +PB0.Locked=true +PB0.Signal=GPIO_Output +PB1.GPIOParameters=GPIO_Label +PB1.GPIO_Label=DISPLAY_DI +PB1.Locked=true +PB1.Signal=GPIO_Output +PB10.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PB10.GPIO_Label=BUTTON_UP +PB10.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PB10.GPIO_PuPd=GPIO_PULLUP +PB10.Locked=true +PB10.Signal=GPXTI10 +PB11.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PB11.GPIO_Label=BUTTON_LEFT +PB11.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PB11.GPIO_PuPd=GPIO_PULLUP +PB11.Locked=true +PB11.Signal=GPXTI11 +PB12.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PB12.GPIO_Label=BUTTON_RIGHT +PB12.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PB12.GPIO_PuPd=GPIO_PULLUP +PB12.Locked=true +PB12.Signal=GPXTI12 +PB13.GPIOParameters=GPIO_Label +PB13.GPIO_Label=RFID_OUT +PB13.Locked=true +PB13.Mode=Output Compare1 CH1N +PB13.Signal=TIM1_CH1N +PB14.GPIOParameters=GPIO_Label +PB14.GPIO_Label=iBTN +PB14.Signal=GPIO_Analog +PB15.GPIOParameters=GPIO_Label +PB15.GPIO_Label=SPI_D_MOSI +PB15.Locked=true +PB15.Mode=Full_Duplex_Master +PB15.Signal=SPI2_MOSI +PB2.GPIOParameters=GPIO_Label +PB2.GPIO_Label=PB2 +PB2.Signal=GPIO_Analog +PB3.GPIOParameters=GPIO_Label +PB3.GPIO_Label=PB3 +PB3.Locked=true +PB3.Signal=GPIO_Analog +PB4.GPIOParameters=GPIO_Label +PB4.GPIO_Label=SPI_R_MISO +PB4.Locked=true +PB4.Mode=Full_Duplex_Master +PB4.Signal=SPI1_MISO +PB5.GPIOParameters=GPIO_Label +PB5.GPIO_Label=SPI_R_MOSI +PB5.Locked=true +PB5.Mode=Full_Duplex_Master +PB5.Signal=SPI1_MOSI +PB6.Locked=true +PB6.Mode=Asynchronous +PB6.Signal=USART1_TX +PB7.Locked=true +PB7.Mode=Asynchronous +PB7.Signal=USART1_RX +PB8.GPIOParameters=GPIO_Label +PB8.GPIO_Label=SPEAKER +PB8.Locked=true +PB8.Signal=S_TIM16_CH1 +PB9.GPIOParameters=GPIO_Label +PB9.GPIO_Label=IR_TX +PB9.Locked=true +PB9.Mode=PWM Generation3 CH3N +PB9.Signal=TIM1_CH3N +PC0.GPIOParameters=GPIO_Label +PC0.GPIO_Label=PC0 +PC0.Locked=true +PC0.Signal=GPIO_Analog +PC1.GPIOParameters=GPIO_Label +PC1.GPIO_Label=PC1 +PC1.Locked=true +PC1.Signal=GPIO_Analog +PC10.GPIOParameters=GPIO_Label +PC10.GPIO_Label=SD_CD +PC10.Locked=true +PC10.Signal=GPIO_Input +PC11.GPIOParameters=PinState,GPIO_Label +PC11.GPIO_Label=DISPLAY_CS +PC11.Locked=true +PC11.PinState=GPIO_PIN_SET +PC11.Signal=GPIO_Output +PC12.GPIOParameters=GPIO_Speed,PinState,GPIO_Label +PC12.GPIO_Label=SD_CS +PC12.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PC12.Locked=true +PC12.PinState=GPIO_PIN_SET +PC12.Signal=GPIO_Output +PC13.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PC13.GPIO_Label=BUTTON_BACK +PC13.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PC13.GPIO_PuPd=GPIO_PULLUP +PC13.Locked=true +PC13.Signal=GPXTI13 +PC14-OSC32_IN.GPIOParameters=GPIO_Label +PC14-OSC32_IN.GPIO_Label=QUARTZ_32MHZ_IN +PC14-OSC32_IN.Locked=true +PC14-OSC32_IN.Mode=LSE-External-Oscillator +PC14-OSC32_IN.Signal=RCC_OSC32_IN +PC15-OSC32_OUT.GPIOParameters=GPIO_Label +PC15-OSC32_OUT.GPIO_Label=QUARTZ_32MHZ_OUT +PC15-OSC32_OUT.Locked=true +PC15-OSC32_OUT.Mode=LSE-External-Oscillator +PC15-OSC32_OUT.Signal=RCC_OSC32_OUT +PC2.GPIOParameters=GPIO_Label +PC2.GPIO_Label=SPI_D_MISO +PC2.Locked=true +PC2.Mode=Full_Duplex_Master +PC2.Signal=SPI2_MISO +PC3.GPIOParameters=GPIO_Label +PC3.GPIO_Label=PC3 +PC3.Signal=GPIO_Analog +PC4.GPIOParameters=GPIO_Label +PC4.GPIO_Label=RF_SW_0 +PC4.Locked=true +PC4.Signal=GPIO_Output +PC5.GPIOParameters=GPIO_Label +PC5.GPIO_Label=RFID_RF_IN +PC5.Locked=true +PC5.Signal=SharedAnalog_PC5 +PC6.GPIOParameters=GPIO_Label +PC6.GPIO_Label=BUTTON_DOWN +PC6.Locked=true +PC6.Signal=GPIO_Input +PCC.Ble.ConnectionInterval=1000.0 +PCC.Ble.DataLength=6 +PCC.Ble.Mode=NOT_SELECTED +PCC.Ble.PowerLevel=Min +PD0.GPIOParameters=GPIO_Speed,PinState,GPIO_Label +PD0.GPIO_Label=CC1101_CS +PD0.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PD0.Locked=true +PD0.PinState=GPIO_PIN_SET +PD0.Signal=GPIO_Output +PD1.GPIOParameters=GPIO_Label +PD1.GPIO_Label=SPI_D_SCK +PD1.Locked=true +PD1.Mode=Full_Duplex_Master +PD1.Signal=SPI2_SCK +PE4.GPIOParameters=GPIO_Speed,PinState,GPIO_Label +PE4.GPIO_Label=NFC_CS +PE4.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH +PE4.Locked=true +PE4.PinState=GPIO_PIN_SET +PE4.Signal=GPIO_Output +PH3-BOOT0.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI +PH3-BOOT0.GPIO_Label=BUTTON_OK +PH3-BOOT0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING +PH3-BOOT0.Locked=true +PH3-BOOT0.Signal=GPXTI3 +PinOutPanel.RotationAngle=0 +ProjectManager.AskForMigrate=true +ProjectManager.BackupPrevious=false +ProjectManager.CompilerOptimize=6 +ProjectManager.ComputerToolchain=false +ProjectManager.CoupleFile=true +ProjectManager.CustomerFirmwarePackage= +ProjectManager.DefaultFWLocation=true +ProjectManager.DeletePrevious=true +ProjectManager.DeviceId=STM32WB55RGVx +ProjectManager.FirmwarePackage=STM32Cube FW_WB V1.10.1 +ProjectManager.FreePins=false +ProjectManager.HalAssertFull=false +ProjectManager.HeapSize=0x400 +ProjectManager.KeepUserCode=true +ProjectManager.LastFirmware=true +ProjectManager.LibraryCopy=2 +ProjectManager.MainLocation=Src +ProjectManager.NoMain=false +ProjectManager.PreviousToolchain= +ProjectManager.ProjectBuild=false +ProjectManager.ProjectFileName=f6.ioc +ProjectManager.ProjectName=f6 +ProjectManager.RegisterCallBack= +ProjectManager.StackSize=0x1000 +ProjectManager.TargetToolchain=Makefile +ProjectManager.ToolChainLocation= +ProjectManager.UnderRoot=false +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-LL-false,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_I2C1_Init-I2C1-false-LL-true,5-MX_RTC_Init-RTC-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_SPI2_Init-SPI2-false-HAL-true,8-MX_USB_Device_Init-USB_DEVICE-false-HAL-false,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM16_Init-TIM16-false-HAL-true,12-MX_COMP1_Init-COMP1-false-HAL-true,13-MX_RF_Init-RF-false-HAL-true,14-MX_PKA_Init-PKA-false-HAL-true,15-MX_RNG_Init-RNG-false-HAL-true,16-MX_AES1_Init-AES1-false-HAL-true,17-MX_AES2_Init-AES2-false-HAL-true,18-MX_CRC_Init-CRC-false-HAL-true,19-MX_USART1_UART_Init-USART1-false-LL-true,0-MX_HSEM_Init-HSEM-false-HAL-true +RCC.ADCFreq_Value=48000000 +RCC.AHB2CLKDivider=RCC_SYSCLK_DIV2 +RCC.AHBFreq_Value=64000000 +RCC.APB1Freq_Value=64000000 +RCC.APB1TimFreq_Value=64000000 +RCC.APB2Freq_Value=64000000 +RCC.APB2TimFreq_Value=64000000 +RCC.APB3Freq_Value=16000000 +RCC.Cortex2Freq_Value=32000000 +RCC.CortexFreq_Value=64000000 +RCC.EnableCSSLSE=true +RCC.EnbaleCSS=true +RCC.FCLK2Freq_Value=32000000 +RCC.FCLKCortexFreq_Value=64000000 +RCC.FamilyName=M +RCC.HCLK2Freq_Value=32000000 +RCC.HCLK3Freq_Value=64000000 +RCC.HCLKFreq_Value=64000000 +RCC.HCLKRFFreq_Value=16000000 +RCC.HSE_VALUE=32000000 +RCC.HSI48_VALUE=48000000 +RCC.HSI_VALUE=16000000 +RCC.I2C1Freq_Value=64000000 +RCC.I2C3Freq_Value=64000000 +RCC.IPParameters=ADCFreq_Value,AHB2CLKDivider,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,APB3Freq_Value,Cortex2Freq_Value,CortexFreq_Value,EnableCSSLSE,EnbaleCSS,FCLK2Freq_Value,FCLKCortexFreq_Value,FamilyName,HCLK2Freq_Value,HCLK3Freq_Value,HCLKFreq_Value,HCLKRFFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C3Freq_Value,LCDFreq_Value,LPTIM1CLockSelection,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_Drive_Capability,LSE_Timout,LSI_VALUE,MCO1PinFreq_Value,MSIOscState,PLLM,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSAI1N,PLLSAI1PoutputFreq_Value,PLLSAI1QoutputFreq_Value,PLLSAI1RoutputFreq_Value,PLLSourceVirtual,PREFETCH_ENABLE,PWRFreq_Value,RFWKPClockSelection,RFWKPFreq_Value,RNGCLockSelection,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SMPS1Freq_Value,SMPSCLockSelectionVirtual,SMPSDivider,SMPSFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,USART1Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAI1OutputFreq_Value +RCC.LCDFreq_Value=32768 +RCC.LPTIM1CLockSelection=RCC_LPTIM1CLKSOURCE_LSE +RCC.LPTIM1Freq_Value=32768 +RCC.LPTIM2Freq_Value=64000000 +RCC.LPUART1Freq_Value=64000000 +RCC.LSCOPinFreq_Value=32000 +RCC.LSE_Drive_Capability=RCC_LSEDRIVE_MEDIUMLOW +RCC.LSE_Timout=1000 +RCC.LSI_VALUE=32000 +RCC.MCO1PinFreq_Value=64000000 +RCC.MSIOscState=DISABLED +RCC.PLLM=RCC_PLLM_DIV2 +RCC.PLLPoutputFreq_Value=64000000 +RCC.PLLQoutputFreq_Value=64000000 +RCC.PLLRCLKFreq_Value=64000000 +RCC.PLLSAI1N=6 +RCC.PLLSAI1PoutputFreq_Value=48000000 +RCC.PLLSAI1QoutputFreq_Value=48000000 +RCC.PLLSAI1RoutputFreq_Value=48000000 +RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.PREFETCH_ENABLE=1 +RCC.PWRFreq_Value=64000000 +RCC.RFWKPClockSelection=RCC_RFWKPCLKSOURCE_LSE +RCC.RFWKPFreq_Value=32768 +RCC.RNGCLockSelection=RCC_RNGCLKSOURCE_CLK48 +RCC.RNGFreq_Value=16000000 +RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE +RCC.RTCFreq_Value=32768 +RCC.SAI1Freq_Value=48000000 +RCC.SMPS1Freq_Value=8000000 +RCC.SMPSCLockSelectionVirtual=RCC_SMPSCLKSOURCE_HSE +RCC.SMPSDivider=4 +RCC.SMPSFreq_Value=4000000 +RCC.SYSCLKFreq_VALUE=64000000 +RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK +RCC.USART1Freq_Value=64000000 +RCC.USBFreq_Value=48000000 +RCC.VCOInputFreq_Value=16000000 +RCC.VCOOutputFreq_Value=128000000 +RCC.VCOSAI1OutputFreq_Value=96000000 +RF1.Locked=true +RF1.Mode=RF1_Activate +RF1.Signal=RF_RF1 +SH.GPXTI10.0=GPIO_EXTI10 +SH.GPXTI10.ConfNb=1 +SH.GPXTI11.0=GPIO_EXTI11 +SH.GPXTI11.ConfNb=1 +SH.GPXTI12.0=GPIO_EXTI12 +SH.GPXTI12.ConfNb=1 +SH.GPXTI13.0=GPIO_EXTI13 +SH.GPXTI13.ConfNb=1 +SH.GPXTI3.0=GPIO_EXTI3 +SH.GPXTI3.ConfNb=1 +SH.S_TIM16_CH1.0=TIM16_CH1,PWM Generation1 CH1 +SH.S_TIM16_CH1.ConfNb=1 +SH.S_TIM2_CH1.0=TIM2_CH1,Input_Capture1_from_TI1 +SH.S_TIM2_CH1.1=TIM2_CH1,Input_Capture2_from_TI1 +SH.S_TIM2_CH1.ConfNb=2 +SH.SharedAnalog_PC5.0=COMP1_INP,INP +SH.SharedAnalog_PC5.1=ADC1_IN14,IN14-Single-Ended +SH.SharedAnalog_PC5.ConfNb=2 +SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16 +SPI1.CLKPhase=SPI_PHASE_2EDGE +SPI1.CalculateBaudRate=4.0 MBits/s +SPI1.DataSize=SPI_DATASIZE_8BIT +SPI1.Direction=SPI_DIRECTION_2LINES +SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,CLKPhase,BaudRatePrescaler +SPI1.Mode=SPI_MODE_MASTER +SPI1.VirtualType=VM_MASTER +SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16 +SPI2.CLKPhase=SPI_PHASE_1EDGE +SPI2.CalculateBaudRate=4.0 MBits/s +SPI2.DataSize=SPI_DATASIZE_8BIT +SPI2.Direction=SPI_DIRECTION_2LINES +SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,BaudRatePrescaler,CLKPhase +SPI2.Mode=SPI_MODE_MASTER +SPI2.VirtualType=VM_MASTER +TIM1.Channel-Output\ Compare1\ CH1N=TIM_CHANNEL_1 +TIM1.Channel-PWM\ Generation3\ CH3N=TIM_CHANNEL_3 +TIM1.IPParameters=Channel-Output Compare1 CH1N,Channel-PWM Generation3 CH3N +TIM16.Channel=TIM_CHANNEL_1 +TIM16.IPParameters=Channel,Pulse,Prescaler,Period +TIM16.Period=291 +TIM16.Prescaler=500 - 1 +TIM16.Pulse=145 +TIM2.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE +TIM2.Channel-Input_Capture1_from_TI1=TIM_CHANNEL_1 +TIM2.Channel-Input_Capture2_from_TI1=TIM_CHANNEL_2 +TIM2.ICPolarity_CH1=TIM_INPUTCHANNELPOLARITY_FALLING +TIM2.IPParameters=Channel-Input_Capture1_from_TI1,ICPolarity_CH1,AutoReloadPreload,Prescaler,Channel-Input_Capture2_from_TI1 +TIM2.Prescaler=64-1 +USART1.AutoBaudRateEnableParam=UART_ADVFEATURE_AUTOBAUDRATE_ENABLE +USART1.IPParameters=VirtualMode-Asynchronous,Mode,AutoBaudRateEnableParam +USART1.Mode=MODE_TX +USART1.VirtualMode-Asynchronous=VM_ASYNC +USB_DEVICE.APP_RX_DATA_SIZE=512 +USB_DEVICE.APP_TX_DATA_SIZE=512 +USB_DEVICE.CLASS_NAME_FS=CDC +USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,CLASS_NAME_FS,MANUFACTURER_STRING,PRODUCT_STRING_CDC_FS,APP_RX_DATA_SIZE,APP_TX_DATA_SIZE +USB_DEVICE.MANUFACTURER_STRING=Flipper +USB_DEVICE.PRODUCT_STRING_CDC_FS=Flipper Control Virtual ComPort +USB_DEVICE.VirtualMode=Cdc +USB_DEVICE.VirtualModeFS=Cdc_FS +VP_ADC1_TempSens_Input.Mode=IN-TempSens +VP_ADC1_TempSens_Input.Signal=ADC1_TempSens_Input +VP_ADC1_Vref_Input.Mode=IN-Vrefint +VP_ADC1_Vref_Input.Signal=ADC1_Vref_Input +VP_AES1_VS_AES.Mode=AES_Activate +VP_AES1_VS_AES.Signal=AES1_VS_AES +VP_AES2_VS_AES.Mode=AES_Activate +VP_AES2_VS_AES.Signal=AES2_VS_AES +VP_COMP1_VS_VREFINT14.Mode=VREFINT_14 +VP_COMP1_VS_VREFINT14.Signal=COMP1_VS_VREFINT14 +VP_CRC_VS_CRC.Mode=CRC_Activate +VP_CRC_VS_CRC.Signal=CRC_VS_CRC +VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2 +VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2 +VP_HSEM_VS_HSEM.Mode=HSEM_Activate +VP_HSEM_VS_HSEM.Signal=HSEM_VS_HSEM +VP_PKA_VS_PKA.Mode=PKA_Activate +VP_PKA_VS_PKA.Signal=PKA_VS_PKA +VP_RNG_VS_RNG.Mode=RNG_Activate +VP_RNG_VS_RNG.Signal=RNG_VS_RNG +VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled +VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate +VP_RTC_VS_RTC_Calendar.Mode=RTC_Calendar +VP_RTC_VS_RTC_Calendar.Signal=RTC_VS_RTC_Calendar +VP_SYS_VS_Systick.Mode=SysTick +VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM16_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM16_VS_ClockSourceINT.Signal=TIM16_VS_ClockSourceINT +VP_TIM1_VS_ClockSourceINT.Mode=Internal +VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT +VP_TIM2_VS_ClockSourceINT.Mode=Internal +VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT +VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS +VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS +board=custom diff --git a/firmware/targets/f6/target.mk b/firmware/targets/f6/target.mk index fca7981a..44df8fe7 100644 --- a/firmware/targets/f6/target.mk +++ b/firmware/targets/f6/target.mk @@ -71,9 +71,6 @@ C_SOURCES += \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \ - $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \ - $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \ - $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_lptim.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_adc.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_dma.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_gpio.c \ @@ -81,6 +78,8 @@ C_SOURCES += \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_rcc.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_tim.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_lptim.c \ + $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usart.c \ + $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_utils.c \ $(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c \ $(CUBE_DIR)/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \ $(CUBE_DIR)/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \ @@ -105,8 +104,7 @@ ASM_SOURCES += $(MXPROJECT_DIR)/startup_stm32wb55xx_cm4.s CFLAGS += \ -DUSE_FULL_LL_DRIVER \ -DUSE_HAL_DRIVER \ - -DHAVE_FREERTOS \ - -DDEBUG_UART=huart1 + -DHAVE_FREERTOS ifeq ($(NO_BOOTLOADER), 1) LDFLAGS += -T$(MXPROJECT_DIR)/stm32wb55xx_flash_cm4_no_boot.ld