Skip to content

Commit

Permalink
🚧 feat(NFC) add client-server protocol idea doc, FSM draft doc
Browse files Browse the repository at this point in the history
  • Loading branch information
polesskiy-dev committed Oct 10, 2024
1 parent 2b6547b commit 72a765c
Show file tree
Hide file tree
Showing 33 changed files with 2,394 additions and 353 deletions.
55 changes: 32 additions & 23 deletions firmware/iot-risk-logger-stm32l4/.mxproject
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,42 @@ LibFiles=Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pcd.h;Drivers/STM32L4xx_

[PreviousUsedMakefileFiles]
SourceFiles=Core/Src/main.c;Core/Src/gpio.c;Core/Src/freertos.c;Core/Src/crc.c;Core/Src/lptim.c;Core/Src/quadspi.c;Core/Src/rng.c;Core/Src/rtc.c;USB_DEVICE/App/usb_device.c;USB_DEVICE/Target/usbd_conf.c;USB_DEVICE/App/usbd_desc.c;USB_DEVICE/App/usbd_storage_if.c;Core/Src/custom_bus.c;Core/Src/stm32l4xx_it.c;Core/Src/stm32l4xx_hal_msp.c;Core/Src/stm32l4xx_hal_timebase_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usb.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_lptim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_qspi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rng.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_bot.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_data.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c;Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;Core/Src/system_stm32l4xx.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usb.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_lptim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_qspi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rng.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_bot.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_data.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c;Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;Core/Src/system_stm32l4xx.c;;;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_bot.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_data.c;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c;
HeaderPath=Drivers/STM32L4xx_HAL_Driver/Inc;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy;Middlewares/Third_Party/FreeRTOS/Source/include;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F;Middlewares/ST/STM32_USB_Device_Library/Core/Inc;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc;Drivers/CMSIS/Device/ST/STM32L4xx/Include;Drivers/CMSIS/Include;Drivers/BSP/Components/lis2dw12;Drivers/BSP/Components/ST25DV;Core/Inc;X-CUBE-MEMS1/Target;USB_DEVICE/App;USB_DEVICE/Target;
HeaderPath=Drivers/STM32L4xx_HAL_Driver/Inc;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy;Middlewares/Third_Party/FreeRTOS/Source/include;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F;Middlewares/ST/STM32_USB_Device_Library/Core/Inc;Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc;Drivers/CMSIS/Device/ST/STM32L4xx/Include;Drivers/CMSIS/Include;Middlewares/ST/ST25FTM/Inc;Drivers/BSP/Components/lis2dw12;Drivers/BSP/Components/ST25DV;Core/Inc;ST25FTM/App;ST25FTM/Target;X-CUBE-MEMS1/Target;USB_DEVICE/App;USB_DEVICE/Target;
CDefines=USE_HAL_DRIVER;STM32L412xx;USE_HAL_DRIVER;USE_HAL_DRIVER;

[PreviousGenFiles]
AdvancedFolderStructure=true
HeaderFileListSize=21
HeaderFileListSize=23
HeaderFiles#0=../Core/Inc/gpio.h
HeaderFiles#1=../Core/Inc/FreeRTOSConfig.h
HeaderFiles#2=../Core/Inc/crc.h
HeaderFiles#3=../Core/Inc/lptim.h
HeaderFiles#4=../Core/Inc/quadspi.h
HeaderFiles#5=../Core/Inc/rng.h
HeaderFiles#6=../Core/Inc/rtc.h
HeaderFiles#7=../X-CUBE-MEMS1/Target/sensor_unicleo_id.h
HeaderFiles#8=../X-CUBE-MEMS1/Target/custom_mems_conf_app.h
HeaderFiles#9=../X-CUBE-MEMS1/Target/custom_mems_conf.h
HeaderFiles#10=../USB_DEVICE/App/usb_device.h
HeaderFiles#11=../USB_DEVICE/Target/usbd_conf.h
HeaderFiles#12=../USB_DEVICE/App/usbd_desc.h
HeaderFiles#13=../USB_DEVICE/App/usbd_storage_if.h
HeaderFiles#14=../Core/Inc/custom_bus.h
HeaderFiles#15=../Core/Inc/custom_errno.h
HeaderFiles#16=../Core/Inc/custom_conf.h
HeaderFiles#17=../Core/Inc/stm32l4xx_it.h
HeaderFiles#18=../Core/Inc/RTE_Components.h
HeaderFiles#19=../Core/Inc/stm32l4xx_hal_conf.h
HeaderFiles#20=../Core/Inc/main.h
HeaderFolderListSize=4
HeaderFiles#7=../ST25FTM/App/st25ftm_config.h
HeaderFiles#8=../ST25FTM/Target/logger.h
HeaderFiles#9=../X-CUBE-MEMS1/Target/sensor_unicleo_id.h
HeaderFiles#10=../X-CUBE-MEMS1/Target/custom_mems_conf_app.h
HeaderFiles#11=../X-CUBE-MEMS1/Target/custom_mems_conf.h
HeaderFiles#12=../USB_DEVICE/App/usb_device.h
HeaderFiles#13=../USB_DEVICE/Target/usbd_conf.h
HeaderFiles#14=../USB_DEVICE/App/usbd_desc.h
HeaderFiles#15=../USB_DEVICE/App/usbd_storage_if.h
HeaderFiles#16=../Core/Inc/custom_bus.h
HeaderFiles#17=../Core/Inc/custom_errno.h
HeaderFiles#18=../Core/Inc/custom_conf.h
HeaderFiles#19=../Core/Inc/stm32l4xx_it.h
HeaderFiles#20=../Core/Inc/RTE_Components.h
HeaderFiles#21=../Core/Inc/stm32l4xx_hal_conf.h
HeaderFiles#22=../Core/Inc/main.h
HeaderFolderListSize=6
HeaderPath#0=../Core/Inc
HeaderPath#1=../X-CUBE-MEMS1/Target
HeaderPath#2=../USB_DEVICE/App
HeaderPath#3=../USB_DEVICE/Target
HeaderPath#1=../ST25FTM/App
HeaderPath#2=../ST25FTM/Target
HeaderPath#3=../X-CUBE-MEMS1/Target
HeaderPath#4=../USB_DEVICE/App
HeaderPath#5=../USB_DEVICE/Target
HeaderFiles=;
SourceFileListSize=16
SourceFiles#0=../Core/Src/gpio.c
Expand All @@ -60,9 +64,14 @@ SourcePath#2=../USB_DEVICE/Target
SourceFiles=;

[ThirdPartyIp]
ThirdPartyIpNumber=2
ThirdPartyIpName#0=STMicroelectronics.X-CUBE-MEMS1.10.0.0
ThirdPartyIpName#1=STMicroelectronics.X-CUBE-NFC4.3.0.0
ThirdPartyIpNumber=3
ThirdPartyIpName#0=STMicroelectronics.FP-SNS-STBOX1.2.0.0
ThirdPartyIpName#1=STMicroelectronics.X-CUBE-MEMS1.10.0.0
ThirdPartyIpName#2=STMicroelectronics.X-CUBE-NFC4.3.0.0

[ThirdPartyIp#STMicroelectronics.FP-SNS-STBOX1.2.0.0]
header=../Middlewares/ST/ST25FTM/Inc/st25ftm_common.h;../Middlewares/ST/ST25FTM/Inc/st25ftm_protocol.h;
source=../Middlewares/ST/ST25FTM/Src/st25ftm_common.c;../Middlewares/ST/ST25FTM/Src/st25ftm_protocol.c;../Middlewares/ST/ST25FTM/Src/st25ftm_rx.c;../Middlewares/ST/ST25FTM/Src/st25ftm_tx.c;

[ThirdPartyIp#STMicroelectronics.X-CUBE-MEMS1.10.0.0]
header=../Drivers/BSP/Components/lis2dw12/lis2dw12_reg.h;../Drivers/BSP/Components/lis2dw12/lis2dw12.h;
Expand Down
3 changes: 0 additions & 3 deletions firmware/iot-risk-logger-stm32l4/Core/Inc/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,4 @@ standard names. */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
/* USER CODE END Defines */

// @note Include SEGGER_SYSVIEW_FreeRTOS.h at the end of the file FreeRTOSConfig.h to override some RTOS definitions of tracing functions.
#include "SEGGER_SYSVIEW_FreeRTOS.h"

#endif /* FREERTOS_CONFIG_H */
11 changes: 1 addition & 10 deletions firmware/iot-risk-logger-stm32l4/Core/Src/freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,9 @@ osMutexId_t i2cMutexHandle;
/* USER CODE END Variables */
/* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
uint32_t defaultTaskBuffer[ 128 ];
osStaticThreadDef_t defaultTaskControlBlock;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.cb_mem = &defaultTaskControlBlock,
.cb_size = sizeof(defaultTaskControlBlock),
.stack_mem = &defaultTaskBuffer[0],
.stack_size = sizeof(defaultTaskBuffer),
.stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityNormal,
};

Expand All @@ -70,10 +65,6 @@ void StartDefaultTask(void *argument);
extern void MX_USB_DEVICE_Init(void);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */

/* USER CODE BEGIN PREPOSTSLEEP */
/** @see sleep.c */
/* USER CODE END PREPOSTSLEEP */

/**
* @brief FreeRTOS initialization
* @param None
Expand Down
4 changes: 0 additions & 4 deletions firmware/iot-risk-logger-stm32l4/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "rtc.h"
#include "usb_device.h"
#include "gpio.h"
#include "SEGGER_RTT.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
Expand Down Expand Up @@ -120,9 +119,6 @@ int main(void)
/* Call init function for freertos objects (in cmsis_os2.c) */
MX_FREERTOS_Init();

/* Init SystemView */
SEGGER_SYSVIEW_Conf();

/* Start scheduler */
osKernelStart();

Expand Down
6 changes: 3 additions & 3 deletions firmware/iot-risk-logger-stm32l4/Core/Src/quadspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ void MX_QUADSPI_Init(void)

/* USER CODE END QUADSPI_Init 1 */
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 4; // half of the system clock e.g. = 2: 48MHz/2 = 24MHz
hqspi.Init.FifoThreshold = 1; // 1 byte minimum to send or receive
hqspi.Init.ClockPrescaler = 1;
hqspi.Init.FifoThreshold = 1;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = W25Q64JV_FLASH_ADDR_SIZE_BITS;
hqspi.Init.FlashSize = 24;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.FlashID = QSPI_FLASH_ID_1;
Expand Down
Loading

0 comments on commit 72a765c

Please sign in to comment.