├── .gitmodules ├── README.md └── docs ├── 0001_Ubuntu_Modbus_TCP.md ├── 0002_Baidu_iot-edge-sdk-for-iot-parser.md ├── 0003_Baidu_Parser_ARCH.md ├── 0004_libmodbus_Server_hacking.md ├── 0005_libmodbus_modbus_mapping_new_start_address_hacking.md ├── 0006_libmodbus_modbus_reply_hacking.md ├── 0007_libmodbus_modbus_new_tcp_pi_hacking.md ├── 0008_B-L475E-IOT01A_Schematic_Analysis.md ├── 0009_SW4STM32_Learning.md ├── 0010_SW4STM32_B-L475E-IOT01A_Printf_Hacking.md ├── 0011_SW4STM32_B-L475E-IOT01A_WiFi_Settings.md ├── 0012_SW4STM32_B-L475E-IOT01A_Sensors_Init.md ├── 0013_SW4STM32_B-L475E-IOT01A_Compile_Download.md ├── 0014_SW4STM32_B-L475E-IOT01A_Enter_Twice_Enter_Key.md ├── 0015_SW4STM32_B-L475E-IOT01A_MQTT_Code_Hacking.md ├── 0016_SW4STM32_B-L475E-IOT01A_Gyroscope_Hacking.md ├── 0017_SW4STM32_B-L475E-IOT01A_Global_Define.md ├── 0018_SW4STM32_B-L475E-IOT01A_WiFi_Username_Password_Firmware_Info.md ├── 0019_SW4STM32_B-L475E-IOT01A_LED.md ├── 0020_SW4STM32_B-L475E-IOT01A_Push_Button.md ├── 0021_SW4STM32_B-L475E-IOT01A_SysTick.md ├── 0022_FreeModbus_Demo_LINUXTCP_Function_Hacking.md ├── 0023_iot-edge-sdk-for-iot-parser_Config.md ├── 0024_iot-edge-sdk-for-iot-parser_ringbuffer.md ├── 0025_iot-edge-sdk-for-iot-parser_DeviceManager.md ├── code ├── STM32F103C8T6 │ ├── .cproject │ ├── .gitignore │ ├── .mxproject │ ├── .project │ ├── .settings │ │ └── language.settings.xml │ ├── Drivers │ │ ├── CMSIS │ │ │ ├── Device │ │ │ │ └── ST │ │ │ │ │ └── STM32F1xx │ │ │ │ │ └── Include │ │ │ │ │ ├── stm32f103xb.h │ │ │ │ │ ├── stm32f1xx.h │ │ │ │ │ └── system_stm32f1xx.h │ │ │ └── Include │ │ │ │ ├── arm_common_tables.h │ │ │ │ ├── arm_const_structs.h │ │ │ │ ├── arm_math.h │ │ │ │ ├── cmsis_armcc.h │ │ │ │ ├── cmsis_armcc_V6.h │ │ │ │ ├── cmsis_gcc.h │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cm3.h │ │ │ │ ├── core_cm4.h │ │ │ │ ├── core_cm7.h │ │ │ │ ├── core_cmFunc.h │ │ │ │ ├── core_cmInstr.h │ │ │ │ ├── core_cmSimd.h │ │ │ │ ├── core_sc000.h │ │ │ │ └── core_sc300.h │ │ └── STM32F1xx_HAL_Driver │ │ │ ├── Inc │ │ │ ├── Legacy │ │ │ │ └── stm32_hal_legacy.h │ │ │ ├── stm32f1xx_hal.h │ │ │ ├── stm32f1xx_hal_cortex.h │ │ │ ├── stm32f1xx_hal_def.h │ │ │ ├── stm32f1xx_hal_dma.h │ │ │ ├── stm32f1xx_hal_dma_ex.h │ │ │ ├── stm32f1xx_hal_flash.h │ │ │ ├── stm32f1xx_hal_flash_ex.h │ │ │ ├── stm32f1xx_hal_gpio.h │ │ │ ├── stm32f1xx_hal_gpio_ex.h │ │ │ ├── stm32f1xx_hal_pwr.h │ │ │ ├── stm32f1xx_hal_rcc.h │ │ │ ├── stm32f1xx_hal_rcc_ex.h │ │ │ ├── stm32f1xx_hal_tim.h │ │ │ └── stm32f1xx_hal_tim_ex.h │ │ │ └── Src │ │ │ ├── stm32f1xx_hal.c │ │ │ ├── stm32f1xx_hal_cortex.c │ │ │ ├── stm32f1xx_hal_dma.c │ │ │ ├── stm32f1xx_hal_flash.c │ │ │ ├── stm32f1xx_hal_flash_ex.c │ │ │ ├── stm32f1xx_hal_gpio.c │ │ │ ├── stm32f1xx_hal_gpio_ex.c │ │ │ ├── stm32f1xx_hal_pwr.c │ │ │ ├── stm32f1xx_hal_rcc.c │ │ │ ├── stm32f1xx_hal_rcc_ex.c │ │ │ ├── stm32f1xx_hal_tim.c │ │ │ └── stm32f1xx_hal_tim_ex.c │ ├── Inc │ │ ├── FreeRTOSConfig.h │ │ ├── main.h │ │ ├── stm32f1xx_hal_conf.h │ │ └── stm32f1xx_it.h │ ├── Middlewares │ │ └── Third_Party │ │ │ └── FreeRTOS │ │ │ └── Source │ │ │ ├── CMSIS_RTOS │ │ │ ├── cmsis_os.c │ │ │ └── cmsis_os.h │ │ │ ├── croutine.c │ │ │ ├── event_groups.c │ │ │ ├── include │ │ │ ├── FreeRTOS.h │ │ │ ├── FreeRTOSConfig_template.h │ │ │ ├── StackMacros.h │ │ │ ├── croutine.h │ │ │ ├── deprecated_definitions.h │ │ │ ├── event_groups.h │ │ │ ├── list.h │ │ │ ├── mpu_prototypes.h │ │ │ ├── mpu_wrappers.h │ │ │ ├── portable.h │ │ │ ├── projdefs.h │ │ │ ├── queue.h │ │ │ ├── semphr.h │ │ │ ├── task.h │ │ │ └── timers.h │ │ │ ├── list.c │ │ │ ├── portable │ │ │ ├── GCC │ │ │ │ └── ARM_CM3 │ │ │ │ │ ├── port.c │ │ │ │ │ └── portmacro.h │ │ │ └── MemMang │ │ │ │ └── heap_4.c │ │ │ ├── queue.c │ │ │ ├── tasks.c │ │ │ └── timers.c │ ├── STM32F103C8T6 Run.cfg │ ├── STM32F103C8T6.ioc │ ├── STM32F103C8T6.xml │ ├── STM32F103C8Tx_FLASH.ld │ ├── Src │ │ ├── freertos.c │ │ ├── main.c │ │ ├── stm32f1xx_hal_msp.c │ │ ├── stm32f1xx_it.c │ │ └── system_stm32f1xx.c │ └── startup │ │ └── startup_stm32f103xb.s ├── TCP │ ├── asynchronous-client.py │ └── asynchronous-server.py ├── html │ └── index.html ├── iot-edge-sdk-for-iot-parser │ └── asynchronous-server.py └── syscalls.c ├── img ├── Baidu_IoT_Parser_Modbus_TCP_Arch.png ├── Baidu_IoT_Parser_Modbus_Verify.png ├── Baidu_IoT_Parser_iot_edge-sdk-for-iot-parser.png ├── Baidu_IoT_Parser_modbus_gateway.png ├── Baidu_IoT_Parser_modbus_key.png ├── Modbus_Poll_Raw_Data.png ├── STM32CubeMX_STM32F103C8Tx_Clock_config.png ├── STM32CubeMX_STM32F103C8Tx_Pinout_config.png ├── STM32CubeMX_STM32F103C8Tx_Project_config.png ├── SW4STM32_B-L475E-IOT01_Compile_Download.png ├── SW4STM32_B-L475E-IOT01_Define.png ├── SW4STM32_GPIO_LED.JPG ├── SW4STM32_GPIO_While.png ├── Uno_R3_pin_functions.png ├── WireShark_Capture_Modbus_Data.png ├── WireShark_Modbus_Data_Analysis.png ├── WireShark_Support_ModBus_Protocol.png ├── b-l475e-iot01a1_Arduino_Connector.png ├── b-l475e-iot01a1_Arduino_Connector_Pinout.png ├── b-l475e-iot01a1_PMOD_Interface.png ├── b-l475e-iot01a1_PMOD_Interface_Type2A_SPI.png ├── b-l475e-iot01a1_PMOD_Interface_Type4A_UART.png ├── b-l475e-iot01a1_Power_Select.png ├── b-l475e-iot01a1_Power_Supply.png ├── b-l475e-iot01a1_ST-Link_Debug.png ├── b-l475e-iot01a1_ST-Link_MCU.png ├── b-l475e-iot01a1_ST-Link_Power3V3.png ├── b-l475e-iot01a1_ST-Link_SWD_Interface.png ├── b-l475e-iot01a1_ST-Link_USB_Connector.png └── b-l475e-iot01a1_ST-Link_USB_Power_Switch.png └── refers ├── B-L475E-IOT01A ├── Digilent-Pmod_Interface_Specification.pdf ├── Product Specifications_en.DM00347837.pdf ├── Technical Notes & Articles_en.DM00290229.pdf ├── User_Manuals_en.DM00285842.pdf ├── User_Manuals_en.DM00347848.pdf ├── en.b-l475e-iot01ax_sch.zip ├── en.b-l475e-iot01ax_sch │ ├── b-l475e-iot01a1_assembly drawings_revC.pdf │ ├── b-l475e-iot01a1_assembly drawings_revD.pdf │ ├── b-l475e-iot01a1_sch_revC.pdf │ ├── b-l475e-iot01a1_sch_revD-01.pdf │ └── readme.txt └── en.b_l475e_iot01a.jpg ├── IOT_STuino_v2.1.pdf ├── MiCOKit-EXT+V1.1.pdf ├── Modbus_Application_Protocol_V1_1b.pdf ├── Modbus_Messaging_Implementation_Guide_V1_0b.pdf ├── Modbus_TCP_Parser.xml └── freemodbus-v1.5.0.zip /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "iot-edge-sdk-samples"] 2 | path = iot-edge-sdk-samples 3 | url = https://github.com/ZengjfOS/iot-edge-sdk-samples 4 | [submodule "iot-edge-sdk-for-iot-parser"] 5 | path = iot-edge-sdk-for-iot-parser 6 | url = https://github.com/baidu/iot-edge-sdk-for-iot-parser 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Modbus TCP 2 | 3 | * [Baidu modbus gateway](https://github.com/baidu/iot-edge-sdk-for-iot-parser/tree/master/modbus) 4 | * [stephane/libmodbus](https://github.com/stephane/libmodbus) 5 | * [STM32_HAL_FREEMODBUS_RTU](https://github.com/eziya/STM32_HAL_FREEMODBUS_RTU) 6 | 7 | # B-L475E-IOT01A 8 | 9 | * [B-L475E-IOT01A](http://www.st.com/zh/evaluation-tools/b-l475e-iot01a.html) 10 | * [baidu/iot-edge-sdk-samples](https://github.com/ZengjfOS/iot-edge-sdk-samples/tree/master/STM32/B-L475E-IOT01) 11 | 12 | ## Docs 13 | 14 | * [docs/0025_iot-edge-sdk-for-iot-parser_DeviceManager.md](docs/0025_iot-edge-sdk-for-iot-parser_DeviceManager.md) 15 | * [iot-edge-sdk-for-iot-parser port for Buildroot](https://github.com/ZengjfOS/Buildroot/blob/master/docs/0005_iot-edge-sdk-for-iot-parser_porting.md) 16 | * [docs/0024_iot-edge-sdk-for-iot-parser_ringbuffer.md](docs/0024_iot-edge-sdk-for-iot-parser_ringbuffer.md) 17 | * [docs/0023_iot-edge-sdk-for-iot-parser_Config.md](docs/0023_iot-edge-sdk-for-iot-parser_Config.md) 18 | * [docs/0022_FreeModbus_Demo_LINUXTCP_Function_Hacking.md](docs/0022_FreeModbus_Demo_LINUXTCP_Function_Hacking.md) 19 | * [docs/0021_SW4STM32_B-L475E-IOT01A_SysTick.md](docs/0021_SW4STM32_B-L475E-IOT01A_SysTick.md) 20 | * [docs/0020_SW4STM32_B-L475E-IOT01A_Push_Button.md](docs/0020_SW4STM32_B-L475E-IOT01A_Push_Button.md) 21 | * [docs/0019_SW4STM32_B-L475E-IOT01A_LED.md](docs/0019_SW4STM32_B-L475E-IOT01A_LED.md) 22 | * [docs/0018_SW4STM32_B-L475E-IOT01A_WiFi_Username_Password_Firmware_Info.md](docs/0018_SW4STM32_B-L475E-IOT01A_WiFi_Username_Password_Firmware_Info.md) 23 | * [docs/0017_SW4STM32_B-L475E-IOT01A_Global_Define.md](docs/0017_SW4STM32_B-L475E-IOT01A_Global_Define.md) 24 | * [docs/0016_SW4STM32_B-L475E-IOT01A_Gyroscope_Hacking.md](docs/0016_SW4STM32_B-L475E-IOT01A_Gyroscope_Hacking.md) 25 | * [docs/0015_SW4STM32_B-L475E-IOT01A_MQTT_Code_Hacking.md](docs/0015_SW4STM32_B-L475E-IOT01A_MQTT_Code_Hacking.md) 26 | * [docs/0014_SW4STM32_B-L475E-IOT01A_Enter_Twice_Enter_Key.md](docs/0014_SW4STM32_B-L475E-IOT01A_Enter_Twice_Enter_Key.md) 27 | * [docs/0013_SW4STM32_B-L475E-IOT01A_Compile_Download.md](docs/0013_SW4STM32_B-L475E-IOT01A_Compile_Download.md) 28 | * [docs/0012_SW4STM32_B-L475E-IOT01A_Sensors_Init.md](docs/0012_SW4STM32_B-L475E-IOT01A_Sensors_Init.md) 29 | * [docs/0011_SW4STM32_B-L475E-IOT01A_WiFi_Settings.md](docs/0011_SW4STM32_B-L475E-IOT01A_WiFi_Settings.md) 30 | * [docs/0010_SW4STM32_B-L475E-IOT01A_Printf_Hacking.md](docs/0010_SW4STM32_B-L475E-IOT01A_Printf_Hacking.md) 31 | * [docs/0009_SW4STM32_Learning.md](docs/0009_SW4STM32_Learning.md) 32 | * [docs/0008_B-L475E-IOT01A_Schematic_Analysis.md](docs/0008_B-L475E-IOT01A_Schematic_Analysis.md) 33 | * [docs/0007_libmodbus_modbus_new_tcp_pi_hacking.md](docs/0007_libmodbus_modbus_new_tcp_pi_hacking.md) 34 | * [docs/0006_libmodbus_modbus_reply_hacking.md](docs/0006_libmodbus_modbus_reply_hacking.md) 35 | * [docs/0005_libmodbus_modbus_mapping_new_start_address_hacking.md](docs/0005_libmodbus_modbus_mapping_new_start_address_hacking.md) 36 | * [docs/0004_libmodbus_Server_hacking.md](docs/0004_libmodbus_Server_hacking.md) 37 | * [docs/0003_Baidu_Parser_ARCH.md](docs/0003_Baidu_Parser_ARCH.md) 38 | * [docs/0002_Baidu_iot-edge-sdk-for-iot-parser.md](docs/0002_Baidu_iot-edge-sdk-for-iot-parser.md) 39 | * [docs/0001_Ubuntu_Modbus_TCP.md](docs/0001_Ubuntu_Modbus_TCP.md) 40 | -------------------------------------------------------------------------------- /docs/0001_Ubuntu_Modbus_TCP.md: -------------------------------------------------------------------------------- 1 | # Ubuntu Modbus TCP 2 | 3 | * `Master`是`Client`,`Slave`是`Server`。 4 | 5 | ## Refers 6 | 7 | * [pymodbus Source Code](http://pydoc.net/pymodbus/1.2.0/pymodbus/) 8 | * [client.common — Twisted Async Modbus Client](http://pymodbus.readthedocs.io/en/latest/library/client-common.html) 9 | * [store — Datastore for Modbus Server Context](http://pymodbus.readthedocs.io/en/latest/library/datastore/store.html) 10 | * [pymodbus 試寫 Modbus TCP 程式](http://pymapi.blogspot.jp/2013/11/pymodbus-modbus-tcp.html) 11 | * [Modbus TCP流量分析](http://www.freebuf.com/articles/web/88944.html) 12 | * [Pymodbus Library Examples](http://pymodbus.readthedocs.io/en/latest/examples/index.html) 13 | 14 | ## Install Plugin 15 | 16 | ``` 17 | sudo apt-get install python3-pymodbus 18 | sudo apt-get install python3-twisted 19 | ``` 20 | 21 | ## Code 22 | 23 | * [code/TCP/asynchronous-client.py](code/TCP/asynchronous-client.py) 24 | * [code/TCP/asynchronous-server.py](code/TCP/asynchronous-server.py) 25 | 26 | ## Server Output 27 | 28 | ``` 29 | root@localhost:/home/zengjf/Modbus_TCP/docs/code# ./asynchronous-server.py 30 | INFO:pymodbus.server.async:Starting Modbus TCP Server on localhost:5020 31 | DEBUG:pymodbus.server.async:Client Connected [IPv4Address(TCP, '127.0.0.1', 5020)] 32 | DEBUG:pymodbus.server.async:0x0 0x1 0x0 0x0 0x0 0x6 0x0 0x5 0x0 0x1 0xff 0x0 0x0 0x2 0x0 0x0 0x0 0x6 0x0 0x1 0x0 0x1 0x0 0x1 0x0 0x3 0x0 0x0 0x0 0x8 0x0 0xf 0x0 0x1 0x0 0x8 0x1 0xff 0x0 0x4 0x0 0x0 0x0 0x6 0x0 0x1 0x0 0x1 0x0 0x8 0x0 0x5 0x0 0x0 0x0 0x8 0x0 0xf 0x0 0x1 0x0 0x8 0x1 0x0 0x0 0x6 0x0 0x0 0x0 0x6 0x0 0x2 0x0 0x1 0x0 0x8 0x0 0x7 0x0 0x0 0x0 0x6 0x0 0x6 0x0 0x1 0x0 0xa 0x0 0x8 0x0 0x0 0x0 0x6 0x0 0x3 0x0 0x1 0x0 0x1 0x0 0x9 0x0 0x0 0x0 0x17 0x0 0x10 0x0 0x1 0x0 0x8 0x10 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0xa 0x0 0x0 0x0 0x6 0x0 0x4 0x0 0x1 0x0 0x8 0x0 0xb 0x0 0x0 0x0 0x1b 0x0 0x17 0x0 0x1 0x0 0x8 0x0 0x1 0x0 0x8 0x10 0x0 0x14 0x0 0x14 0x0 0x14 0x0 0x14 0x0 0x14 0x0 0x14 0x0 0x14 0x0 0x14 0x0 0xc 0x0 0x0 0x0 0x6 0x0 0x4 0x0 0x1 0x0 0x8 33 | DEBUG:pymodbus.factory:Factory Request[5] 34 | DEBUG:pymodbus.datastore.context:validate[5] 2:1 35 | DEBUG:pymodbus.datastore.context:setValues[5] 2:1 36 | DEBUG:pymodbus.datastore.context:getValues[5] 2:1 37 | DEBUG:pymodbus.server.async:send: 00010000000600050001ff00 38 | DEBUG:pymodbus.factory:Factory Request[1] 39 | DEBUG:pymodbus.datastore.context:validate[1] 2:1 40 | DEBUG:pymodbus.datastore.context:getValues[1] 2:1 41 | DEBUG:pymodbus.server.async:send: 00020000000400010101 42 | DEBUG:pymodbus.factory:Factory Request[15] 43 | DEBUG:pymodbus.datastore.context:validate[15] 2:8 44 | DEBUG:pymodbus.datastore.context:setValues[15] 2:8 45 | DEBUG:pymodbus.server.async:send: 000300000006000f00010008 46 | DEBUG:pymodbus.factory:Factory Request[1] 47 | DEBUG:pymodbus.datastore.context:validate[1] 2:8 48 | DEBUG:pymodbus.datastore.context:getValues[1] 2:8 49 | DEBUG:pymodbus.server.async:send: 000400000004000101ff 50 | DEBUG:pymodbus.factory:Factory Request[15] 51 | DEBUG:pymodbus.datastore.context:validate[15] 2:8 52 | DEBUG:pymodbus.datastore.context:setValues[15] 2:8 53 | DEBUG:pymodbus.server.async:send: 000500000006000f00010008 54 | DEBUG:pymodbus.factory:Factory Request[2] 55 | DEBUG:pymodbus.datastore.context:validate[2] 2:8 56 | DEBUG:pymodbus.datastore.context:getValues[2] 2:8 57 | DEBUG:pymodbus.server.async:send: 000600000004000201ff 58 | DEBUG:pymodbus.factory:Factory Request[6] 59 | DEBUG:pymodbus.datastore.context:validate[6] 2:1 60 | DEBUG:pymodbus.datastore.context:setValues[6] 2:1 61 | DEBUG:pymodbus.datastore.context:getValues[6] 2:1 62 | DEBUG:pymodbus.server.async:send: 00070000000600060001000a 63 | DEBUG:pymodbus.factory:Factory Request[3] 64 | DEBUG:pymodbus.datastore.context:validate[3] 2:1 65 | DEBUG:pymodbus.datastore.context:getValues[3] 2:1 66 | DEBUG:pymodbus.server.async:send: 000800000005000302000a 67 | DEBUG:pymodbus.factory:Factory Request[16] 68 | DEBUG:pymodbus.datastore.context:validate[16] 2:8 69 | DEBUG:pymodbus.datastore.context:setValues[16] 2:8 70 | DEBUG:pymodbus.server.async:send: 000900000006001000010008 71 | DEBUG:pymodbus.factory:Factory Request[4] 72 | DEBUG:pymodbus.datastore.context:validate[4] 2:8 73 | DEBUG:pymodbus.datastore.context:getValues[4] 2:8 74 | DEBUG:pymodbus.server.async:send: 000a0000001300041000110011001100110011001100110011 75 | DEBUG:pymodbus.factory:Factory Request[23] 76 | DEBUG:pymodbus.datastore.context:validate[23] 2:8 77 | DEBUG:pymodbus.datastore.context:validate[23] 2:8 78 | DEBUG:pymodbus.datastore.context:setValues[23] 2:8 79 | DEBUG:pymodbus.datastore.context:getValues[23] 2:8 80 | DEBUG:pymodbus.server.async:send: 000b0000001300171000140014001400140014001400140014 81 | DEBUG:pymodbus.factory:Factory Request[4] 82 | DEBUG:pymodbus.datastore.context:validate[4] 2:8 83 | DEBUG:pymodbus.datastore.context:getValues[4] 2:8 84 | DEBUG:pymodbus.server.async:send: 000c0000001300041000110011001100110011001100110011 85 | DEBUG:pymodbus.server.async:Client Disconnected: [Failure instance: Traceback (failure with no frames): : Connection was closed cleanly. 86 | ] 87 | ``` 88 | 89 | ## Client Output 90 | 91 | ``` 92 | root@localhost:/home/zengjf/Modbus_TCP/docs/code# ./asynchronous-client.py 93 | DEBUG:pymodbus.client.async:Client connected to modbus server 94 | DEBUG:pymodbus.transaction:adding transaction 1 95 | DEBUG:pymodbus.transaction:adding transaction 2 96 | DEBUG:pymodbus.transaction:adding transaction 3 97 | DEBUG:pymodbus.transaction:adding transaction 4 98 | DEBUG:pymodbus.transaction:adding transaction 5 99 | DEBUG:pymodbus.transaction:adding transaction 6 100 | DEBUG:pymodbus.transaction:adding transaction 7 101 | DEBUG:pymodbus.transaction:adding transaction 8 102 | DEBUG:pymodbus.transaction:adding transaction 9 103 | DEBUG:pymodbus.transaction:adding transaction 10 104 | DEBUG:pymodbus.transaction:adding transaction 11 105 | DEBUG:pymodbus.transaction:adding transaction 12 106 | DEBUG:pymodbus.factory:Factory Response[5] 107 | DEBUG:pymodbus.transaction:getting transaction 1 108 | DEBUG:pymodbus.factory:Factory Response[1] 109 | DEBUG:pymodbus.transaction:getting transaction 2 110 | DEBUG:pymodbus.factory:Factory Response[15] 111 | DEBUG:pymodbus.transaction:getting transaction 3 112 | DEBUG:pymodbus.factory:Factory Response[1] 113 | DEBUG:pymodbus.transaction:getting transaction 4 114 | DEBUG:pymodbus.factory:Factory Response[15] 115 | DEBUG:pymodbus.transaction:getting transaction 5 116 | DEBUG:pymodbus.factory:Factory Response[2] 117 | DEBUG:pymodbus.transaction:getting transaction 6 118 | DEBUG:pymodbus.factory:Factory Response[6] 119 | DEBUG:pymodbus.transaction:getting transaction 7 120 | DEBUG:pymodbus.factory:Factory Response[3] 121 | DEBUG:pymodbus.transaction:getting transaction 8 122 | DEBUG:pymodbus.factory:Factory Response[16] 123 | DEBUG:pymodbus.transaction:getting transaction 9 124 | DEBUG:pymodbus.factory:Factory Response[4] 125 | DEBUG:pymodbus.transaction:getting transaction 10 126 | DEBUG:pymodbus.factory:Factory Response[23] 127 | DEBUG:pymodbus.transaction:getting transaction 11 128 | DEBUG:pymodbus.factory:Factory Response[4] 129 | DEBUG:pymodbus.transaction:getting transaction 12 130 | DEBUG:pymodbus.client.async:Client disconnected from modbus server: [Failure instance: Traceback (failure with no frames): : Connection was closed cleanly. 131 | ] 132 | root@localhost:/home/zengjf/Modbus_TCP/docs/code# 133 | ``` 134 | 135 | ## Analysis 136 | 137 | ### WireShark 138 | 139 | * 获取TCP包: 140 | ![img/WireShark_Capture_Modbus_Data.png](img/WireShark_Capture_Modbus_Data.png) 141 | * 设置端口号: 142 | ![img/WireShark_Support_ModBus_Protocol.png](img/WireShark_Support_ModBus_Protocol.png) 143 | * 分析数据: 144 | ![img/WireShark_Modbus_Data_Analysis.png](img/WireShark_Modbus_Data_Analysis.png) 145 | * 数据解析: 146 | * `00 01 00 00 00 06 00 05 00 01 ff 00` 147 | * Transaction Identifier: `1` (00 01) 148 | * Protocol Identifier: `0` (00 00) 149 | * Length: `6` (00 06) 150 | * Unit Identifier: `0` (00) 151 | * .000 0101 = Function Code: Write Single Coil (`5`) (05) 152 | * Reference Number: `1` (00 01) 153 | * Data: `ff00` (ff 00) 154 | * Data: `0xff` (ff) 155 | * Padding: `0x00` (00) 156 | * `00 02 00 00 00 04 00 01 01 01` 157 | * Transaction Identifier: `2` (00 02) 158 | * Protocol Identifier: `0` (00 00) 159 | * Length: `4` (00 04) 160 | * Unit Identifier: `0` (00) 161 | * .000 0001 = Function Code: Read Coil (`1`) (01) 162 | * Byte Count: `1` (01) 163 | * Data: `01` (01) 164 | * Transaction Identifier 165 | The transaction identifier is used to associate the future response with the request. So, at a time, on a TCP connection, this identifier must be unique. There are several manners to use the transaction identifier: 166 | * For example, it can be used as a simple "TCP sequence number" with a counter which is incremented at each request. 167 | * It can also be judiciously used as a smart index or pointer to identify a transaction context in order to memorize the current remote server and the pending MODBUS request. 168 | 169 | ### 代码疑惑 170 | 171 | * `def beginAsynchronousTest(client):`中的client是什么: 172 | `` 173 | 174 | -------------------------------------------------------------------------------- /docs/0003_Baidu_Parser_ARCH.md: -------------------------------------------------------------------------------- 1 | # Baidu Parser ARCH 2 | 3 | [Draw.io xml file](refers/Modbus_TCP_Parser.xml) 4 | 5 | ## Baidu Parser 6 | 7 | ![img/Baidu_IoT_Parser_Modbus_TCP_Arch.png](img/Baidu_IoT_Parser_Modbus_TCP_Arch.png) 8 | -------------------------------------------------------------------------------- /docs/0005_libmodbus_modbus_mapping_new_start_address_hacking.md: -------------------------------------------------------------------------------- 1 | # libmodbus modbus_mapping_new_start_address hacking 2 | 3 | ``` 4 | /* Allocates 4 arrays to store bits, input bits, registers and inputs 5 | registers. The pointers are stored in modbus_mapping structure. 6 | The modbus_mapping_new_start_address() function shall return the new allocated 7 | structure if successful. Otherwise it shall return NULL and set errno to 8 | ENOMEM. */ 9 | modbus_mapping_t* modbus_mapping_new_start_address( 10 | unsigned int start_bits, unsigned int nb_bits, 11 | unsigned int start_input_bits, unsigned int nb_input_bits, 12 | unsigned int start_registers, unsigned int nb_registers, 13 | unsigned int start_input_registers, unsigned int nb_input_registers) 14 | { 15 | /** 16 | * typedef struct { 17 | * int nb_bits; 18 | * int start_bits; 19 | * int nb_input_bits; 20 | * int start_input_bits; 21 | * int nb_input_registers; 22 | * int start_input_registers; 23 | * int nb_registers; 24 | * int start_registers; 25 | * uint8_t *tab_bits; 26 | * uint8_t *tab_input_bits; 27 | * uint16_t *tab_input_registers; 28 | * uint16_t *tab_registers; 29 | * } modbus_mapping_t; 30 | */ 31 | modbus_mapping_t *mb_mapping; 32 | 33 | mb_mapping = (modbus_mapping_t *)malloc(sizeof(modbus_mapping_t)); 34 | if (mb_mapping == NULL) { 35 | return NULL; 36 | } 37 | 38 | /* 0X */ 39 | mb_mapping->nb_bits = nb_bits; 40 | mb_mapping->start_bits = start_bits; 41 | if (nb_bits == 0) { // 当number bits为0的时候,也就没必要分配空间了 42 | mb_mapping->tab_bits = NULL; 43 | } else { 44 | /* Negative number raises a POSIX error */ 45 | mb_mapping->tab_bits = 46 | (uint8_t *) malloc(nb_bits * sizeof(uint8_t)); // 获取nb_bits个uint8_t类型的空间 47 | if (mb_mapping->tab_bits == NULL) { 48 | free(mb_mapping); 49 | return NULL; 50 | } 51 | memset(mb_mapping->tab_bits, 0, nb_bits * sizeof(uint8_t)); 52 | } 53 | 54 | /* 1X */ 55 | mb_mapping->nb_input_bits = nb_input_bits; 56 | mb_mapping->start_input_bits = start_input_bits; 57 | if (nb_input_bits == 0) { 58 | mb_mapping->tab_input_bits = NULL; 59 | } else { 60 | mb_mapping->tab_input_bits = 61 | (uint8_t *) malloc(nb_input_bits * sizeof(uint8_t)); 62 | if (mb_mapping->tab_input_bits == NULL) { 63 | free(mb_mapping->tab_bits); 64 | free(mb_mapping); 65 | return NULL; 66 | } 67 | memset(mb_mapping->tab_input_bits, 0, nb_input_bits * sizeof(uint8_t)); 68 | } 69 | 70 | /* 4X */ 71 | mb_mapping->nb_registers = nb_registers; 72 | mb_mapping->start_registers = start_registers; 73 | if (nb_registers == 0) { 74 | mb_mapping->tab_registers = NULL; 75 | } else { 76 | mb_mapping->tab_registers = 77 | (uint16_t *) malloc(nb_registers * sizeof(uint16_t)); // 注意这里是16bit的 78 | if (mb_mapping->tab_registers == NULL) { 79 | free(mb_mapping->tab_input_bits); 80 | free(mb_mapping->tab_bits); 81 | free(mb_mapping); 82 | return NULL; 83 | } 84 | memset(mb_mapping->tab_registers, 0, nb_registers * sizeof(uint16_t)); 85 | } 86 | 87 | /* 3X */ 88 | mb_mapping->nb_input_registers = nb_input_registers; 89 | mb_mapping->start_input_registers = start_input_registers; 90 | if (nb_input_registers == 0) { 91 | mb_mapping->tab_input_registers = NULL; 92 | } else { 93 | mb_mapping->tab_input_registers = 94 | (uint16_t *) malloc(nb_input_registers * sizeof(uint16_t)); // 注意这里是16bit的 95 | if (mb_mapping->tab_input_registers == NULL) { 96 | free(mb_mapping->tab_registers); 97 | free(mb_mapping->tab_input_bits); 98 | free(mb_mapping->tab_bits); 99 | free(mb_mapping); 100 | return NULL; 101 | } 102 | memset(mb_mapping->tab_input_registers, 0, 103 | nb_input_registers * sizeof(uint16_t)); 104 | } 105 | 106 | return mb_mapping; 107 | } 108 | ``` 109 | -------------------------------------------------------------------------------- /docs/0007_libmodbus_modbus_new_tcp_pi_hacking.md: -------------------------------------------------------------------------------- 1 | # libmodbus modbus_new_tcp_pi hacking 2 | 3 | ```C 4 | modbus_t* modbus_new_tcp_pi(const char *node, const char *service) 5 | { 6 | modbus_t *ctx; 7 | modbus_tcp_pi_t *ctx_tcp_pi; 8 | size_t dest_size; 9 | size_t ret_size; 10 | 11 | ctx = (modbus_t *)malloc(sizeof(modbus_t)); 12 | if (ctx == NULL) { 13 | return NULL; 14 | } 15 | _modbus_init_common(ctx); 16 | 17 | /* Could be changed after to reach a remote serial Modbus device */ 18 | // #define MODBUS_TCP_SLAVE 0xFF 19 | ctx->slave = MODBUS_TCP_SLAVE; 20 | 21 | /** 22 | * const modbus_backend_t _modbus_tcp_pi_backend = { 23 | * _MODBUS_BACKEND_TYPE_TCP, 24 | * _MODBUS_TCP_HEADER_LENGTH, 25 | * _MODBUS_TCP_CHECKSUM_LENGTH, 26 | * MODBUS_TCP_MAX_ADU_LENGTH, 27 | * _modbus_set_slave, 28 | * _modbus_tcp_build_request_basis, 29 | * _modbus_tcp_build_response_basis, 30 | * _modbus_tcp_prepare_response_tid, 31 | * _modbus_tcp_send_msg_pre, 32 | * _modbus_tcp_send, 33 | * _modbus_tcp_receive, 34 | * _modbus_tcp_recv, 35 | * _modbus_tcp_check_integrity, 36 | * _modbus_tcp_pre_check_confirmation, 37 | * _modbus_tcp_pi_connect, 38 | * _modbus_tcp_close, 39 | * _modbus_tcp_flush, 40 | * _modbus_tcp_select, 41 | * _modbus_tcp_free 42 | * }; 43 | * 44 | * typedef struct _modbus_backend { 45 | * unsigned int backend_type; 46 | * unsigned int header_length; 47 | * unsigned int checksum_length; 48 | * unsigned int max_adu_length; 49 | * int (*set_slave) (modbus_t *ctx, int slave); 50 | * int (*build_request_basis) (modbus_t *ctx, int function, int addr, 51 | * int nb, uint8_t *req); 52 | * int (*build_response_basis) (sft_t *sft, uint8_t *rsp); 53 | * int (*prepare_response_tid) (const uint8_t *req, int *req_length); 54 | * int (*send_msg_pre) (uint8_t *req, int req_length); 55 | * ssize_t (*send) (modbus_t *ctx, const uint8_t *req, int req_length); 56 | * int (*receive) (modbus_t *ctx, uint8_t *req); 57 | * ssize_t (*recv) (modbus_t *ctx, uint8_t *rsp, int rsp_length); 58 | * int (*check_integrity) (modbus_t *ctx, uint8_t *msg, 59 | * const int msg_length); 60 | * int (*pre_check_confirmation) (modbus_t *ctx, const uint8_t *req, 61 | * const uint8_t *rsp, int rsp_length); 62 | * int (*connect) (modbus_t *ctx); 63 | * void (*close) (modbus_t *ctx); 64 | * int (*flush) (modbus_t *ctx); 65 | * int (*select) (modbus_t *ctx, fd_set *rset, struct timeval *tv, int msg_length); 66 | * void (*free) (modbus_t *ctx); 67 | * } modbus_backend_t; 68 | */ 69 | ctx->backend = &_modbus_tcp_pi_backend; 70 | 71 | /** 72 | * typedef struct _modbus_tcp_pi { 73 | * /* Transaction ID */ 74 | * uint16_t t_id; 75 | * /* TCP port */ 76 | * int port; 77 | * /* Node */ 78 | * char node[_MODBUS_TCP_PI_NODE_LENGTH]; 79 | * /* Service */ 80 | * char service[_MODBUS_TCP_PI_SERVICE_LENGTH]; 81 | * } modbus_tcp_pi_t; 82 | */ 83 | ctx->backend_data = (modbus_tcp_pi_t *)malloc(sizeof(modbus_tcp_pi_t)); 84 | if (ctx->backend_data == NULL) { 85 | modbus_free(ctx); 86 | errno = ENOMEM; 87 | return NULL; 88 | } 89 | ctx_tcp_pi = (modbus_tcp_pi_t *)ctx->backend_data; 90 | 91 | if (node == NULL) { 92 | /* The node argument can be empty to indicate any hosts */ 93 | ctx_tcp_pi->node[0] = 0; 94 | } else { 95 | dest_size = sizeof(char) * _MODBUS_TCP_PI_NODE_LENGTH; 96 | ret_size = strlcpy(ctx_tcp_pi->node, node, dest_size); 97 | if (ret_size == 0) { 98 | fprintf(stderr, "The node string is empty\n"); 99 | modbus_free(ctx); 100 | errno = EINVAL; 101 | return NULL; 102 | } 103 | 104 | if (ret_size >= dest_size) { 105 | fprintf(stderr, "The node string has been truncated\n"); 106 | modbus_free(ctx); 107 | errno = EINVAL; 108 | return NULL; 109 | } 110 | } 111 | 112 | if (service != NULL) { 113 | dest_size = sizeof(char) * _MODBUS_TCP_PI_SERVICE_LENGTH; 114 | ret_size = strlcpy(ctx_tcp_pi->service, service, dest_size); 115 | } else { 116 | /* Empty service is not allowed, error catched below. */ 117 | ret_size = 0; 118 | } 119 | 120 | if (ret_size == 0) { 121 | fprintf(stderr, "The service string is empty\n"); 122 | modbus_free(ctx); 123 | errno = EINVAL; 124 | return NULL; 125 | } 126 | 127 | if (ret_size >= dest_size) { 128 | fprintf(stderr, "The service string has been truncated\n"); 129 | modbus_free(ctx); 130 | errno = EINVAL; 131 | return NULL; 132 | } 133 | 134 | ctx_tcp_pi->t_id = 0; 135 | 136 | return ctx; 137 | } 138 | ``` 139 | -------------------------------------------------------------------------------- /docs/0008_B-L475E-IOT01A_Schematic_Analysis.md: -------------------------------------------------------------------------------- 1 | # B-L475E-IOT01A Schematic Analysis 2 | 3 | [B-L475E-IOT01A](http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/b-l475e-iot01a.html) 4 | 5 | ## Power supply 6 | 7 | [refers/B-L475E-IOT01A/User_Manuals_en.DM00347848.pdf](refers/B-L475E-IOT01A/User_Manuals_en.DM00347848.pdf) 8 | 9 | ![img/b-l475e-iot01a1_ST-Link_USB_Connector.png](img/b-l475e-iot01a1_ST-Link_USB_Connector.png) 10 | ![img/b-l475e-iot01a1_ST-Link_USB_Power_Switch.png](img/b-l475e-iot01a1_ST-Link_USB_Power_Switch.png) 11 | ![img/b-l475e-iot01a1_Power_Select.png](img/b-l475e-iot01a1_Power_Select.png) 12 | ![img/b-l475e-iot01a1_Power_Supply.png](img/b-l475e-iot01a1_Power_Supply.png) 13 | 14 | ## ST-Link 15 | 16 | ![img/b-l475e-iot01a1_ST-Link_USB_Connector.png](img/b-l475e-iot01a1_ST-Link_USB_Connector.png) 17 | ![img/b-l475e-iot01a1_ST-Link_Power3V3.png](img/b-l475e-iot01a1_ST-Link_Power3V3.png) 18 | ![img/b-l475e-iot01a1_ST-Link_MCU.png](img/b-l475e-iot01a1_ST-Link_MCU.png) 19 | ![img/b-l475e-iot01a1_ST-Link_SWD_Interface.png](img/b-l475e-iot01a1_ST-Link_SWD_Interface.png) 20 | ![img/b-l475e-iot01a1_ST-Link_Debug.png](img/b-l475e-iot01a1_ST-Link_Debug.png) 21 | 22 | * The EMIF02-USB03F2 is a highly integrated array designed to suppress EMI / RFI noise for USB OTG (on-the-go) ports 23 | * The LD3985M33R is a low drop low noise BICMOS voltage regulator with an output voltage of 3.3 V and an output current up to 150 mA. 24 | * SDW Interface: 25 | * 电源:CN7(Micro USB连接器) --> VBUS(5V信号线) --> 5V_USB_ST_LINK(5V信号线重命名) --> LD3985M33R(3V3稳压管) --> 3V3_ST_LINK(3V3信号线名); 26 | * 烧录信号:USB信号 --> STM32F103CBT6(ST-Link主控芯片) --> SWD Interface --> CN5(留有Pin脚,可直接从这里烧录) --> STM32L475VGTx; 27 | * ST-Link Debug:不是调试STM32L475VGTx的接口,是调试STM-Link的STM32F103CBT6的,可当做固件升级接口; 28 | 29 | ## Debug Port 30 | 31 | Virtual COM Port(STM32F103CBT6左下角的 UART1转换成VCP): 32 | 33 | * ST-LINK-UART1_RX 34 | * ST-LINK-UART1_TX 35 | 36 | ## Board expansion connectors -- PMOD Interface 37 | 38 | [refers/B-L475E-IOT01A/Digilent-Pmod_Interface_Specification.pdf](refers/B-L475E-IOT01A/Digilent-Pmod_Interface_Specification.pdf) 39 | 40 | ![img/b-l475e-iot01a1_PMOD_Interface.png](img/b-l475e-iot01a1_PMOD_Interface.png) 41 | ![img/b-l475e-iot01a1_PMOD_Interface_Type2A_SPI.png](img/b-l475e-iot01a1_PMOD_Interface_Type2A_SPI.png) 42 | ![img/b-l475e-iot01a1_PMOD_Interface_Type4A_UART.png](img/b-l475e-iot01a1_PMOD_Interface_Type4A_UART.png) 43 | 44 | ## Arduino Uno V3 connectors 45 | 46 | ![img/Uno_R3_pin_functions.png](img/Uno_R3_pin_functions.png) 47 | ![img/b-l475e-iot01a1_Arduino_Connector.png](img/b-l475e-iot01a1_Arduino_Connector.png) 48 | ![img/b-l475e-iot01a1_Arduino_Connector_Pinout.png](img/b-l475e-iot01a1_Arduino_Connector_Pinout.png) 49 | 50 | -------------------------------------------------------------------------------- /docs/0009_SW4STM32_Learning.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 Learning 2 | 3 | ## 参考文档 4 | 5 | [STM32CubeMX Learning](https://github.com/ZengjfOS/MiCONotes/blob/master/src/0008_STM32F103ZET6/src/019_STM32CubeMX_Learning.md) 6 | 7 | ## 原理图 8 | 9 | GOKIT3原理图: [refers/IOT_STuino_v2.1.pdf](refers/IOT_STuino_v2.1.pdf) 10 | 11 | ## STM32CubeMX Setting 12 | 13 | * 引脚配置: 14 | ![img/STM32CubeMX_STM32F103C8Tx_Pinout_config.png](img/STM32CubeMX_STM32F103C8Tx_Pinout_config.png) 15 | * 时钟配置: 16 | ![img/STM32CubeMX_STM32F103C8Tx_Clock_config.png](img/STM32CubeMX_STM32F103C8Tx_Clock_config.png) 17 | * 生成项目代码配置: 18 | ![img/STM32CubeMX_STM32F103C8Tx_Project_config.png](img/STM32CubeMX_STM32F103C8Tx_Project_config.png) 19 | 20 | 接下来就是生成代码就行了。 21 | 22 | ## SW4STM32 23 | 24 | [Source Code](code/STM32F103C8T6) 25 | 26 | ![img/SW4STM32_GPIO_While.png](img/SW4STM32_GPIO_While.png) 27 | 28 | ## 测试效果 29 | 30 | ![img/SW4STM32_GPIO_LED.JPG](img/SW4STM32_GPIO_LED.JPG) 31 | 32 | -------------------------------------------------------------------------------- /docs/0010_SW4STM32_B-L475E-IOT01A_Printf_Hacking.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A Printf Hacking 2 | 3 | [code/syscalls.c](code/syscalls.c) 4 | 5 | ```C 6 | static UART_HandleTypeDef console_uart; ---------------------------------+ 7 | | 8 | int main(void) | 9 | { | 10 | ... | 11 | Console_UART_Init(); --------------------------+ | 12 | ... | | 13 | } | | 14 | | | 15 | /** | | 16 | * @brief UART console init function | | 17 | */ | | 18 | static void Console_UART_Init(void) <-----------------+ | 19 | { | 20 | console_uart.Instance = USART1; | 21 | console_uart.Init.BaudRate = 115200; | 22 | console_uart.Init.WordLength = UART_WORDLENGTH_8B; | 23 | console_uart.Init.StopBits = UART_STOPBITS_1; | 24 | console_uart.Init.Parity = UART_PARITY_NONE; | 25 | console_uart.Init.Mode = UART_MODE_TX_RX; | 26 | console_uart.Init.HwFlowCtl = UART_HWCONTROL_NONE; | 27 | console_uart.Init.OverSampling = UART_OVERSAMPLING_16; | 28 | console_uart.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; | 29 | console_uart.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; | 30 | /** | 31 | * typedef enum | 32 | * { | 33 | * COM1 = 0, | 34 | * COM2 = 0, | 35 | * }COM_TypeDef; | 36 | */ | 37 | BSP_COM_Init(COM1,&console_uart); <-------------------------------------+ 38 | } 39 | 40 | #if (defined(__GNUC__) && !defined(__CC_ARM)) 41 | /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf 42 | set to 'Yes') calls __io_putchar() */ 43 | #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) --------------+ code/syscalls.c 44 | #define GETCHAR_PROTOTYPE int __io_getchar(void) --------------*--------------------+ 45 | #else | | 46 | #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) --------------+ | 47 | #define GETCHAR_PROTOTYPE int fgetc(FILE *f) --------------*--------------------+ 48 | #endif /* __GNUC__ */ | | 49 | | | 50 | /** | | 51 | * @brief Retargets the C library printf function to the USART. | | 52 | * @param None | | 53 | * @retval None | | 54 | */ | | 55 | PUTCHAR_PROTOTYPE <-----------------------------------------------+ | 56 | { | 57 | /* Place your implementation of fputc here */ | 58 | /* e.g. write a character to the USART2 and Loop until the end of transmission */ | 59 | while (HAL_OK != HAL_UART_Transmit(&console_uart, (uint8_t *) &ch, 1, 30000)) | 60 | { | 61 | ; | 62 | } | 63 | return ch; | 64 | } | 65 | | 66 | /** | 67 | * @brief Retargets the C library scanf function to the USART. | 68 | * @param None | 69 | * @retval None | 70 | */ | 71 | GETCHAR_PROTOTYPE <---------------------------------------------------------------------+ 72 | { 73 | /* Place your implementation of fgetc here */ 74 | /* e.g. readwrite a character to the USART2 and Loop until the end of transmission */ 75 | uint8_t ch = 0; 76 | while (HAL_OK != HAL_UART_Receive(&console_uart, (uint8_t *)&ch, 1, 30000)) 77 | { 78 | ; 79 | } 80 | return ch; 81 | } 82 | ``` 83 | -------------------------------------------------------------------------------- /docs/0011_SW4STM32_B-L475E-IOT01A_WiFi_Settings.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A WiFi Settings 2 | 3 | ```C 4 | int main(void) 5 | { 6 | ... 7 | 8 | /* Working application */ 9 | iothub_mqtt_client_run(); ------------+ 10 | | 11 | return 0; | 12 | } | 13 | | 14 | int iothub_mqtt_client_run(void) <---------+ 15 | { 16 | if (platform_init() != 0) ----------------------+ 17 | { | 18 | (void)printf("platform_init failed\r\n"); | 19 | return __FAILURE__; | 20 | } | 21 | else | 22 | { | 23 | ... | 24 | } | 25 | } | 26 | | 27 | int platform_init(void) <----------------------------------+ 28 | { 29 | ... v----------------------------+ 30 | if (net_init(&hnet, NET_IF, (net_if_init)) != NET_OK) | 31 | { | 32 | CLOUD_Error_Handler(CLOUD_DEMO_IP_ADDRESS_ERROR); | 33 | return -1; | 34 | } | 35 | ... | 36 | } | 37 | | 38 | int net_if_init(void * if_ctxt) <-----------------------------+ 39 | { 40 | ... 41 | printf("\n*** WIFI connection ***\n\n"); 42 | 43 | while (checkWiFiCredentials(&ssid, &psk, (uint8_t *) &security_mode) != HAL_OK) 44 | { 45 | printf("Your WIFI parameters need to be entered to proceed\n"); 46 | updateWiFiCredentials(&ssid, &psk, (uint8_t *) &security_mode); ---------------+ 47 | } | 48 | ... | 49 | } | 50 | | 51 | /** | 52 | * @brief Write the Wifi parameters to the FLASH memory. | 53 | * @param In: ssid Wifi SSID. | 54 | * @param In: psk Wifi security password. | 55 | * @param In: security_mode See @ref wifi_network_security_t definition. | 56 | * @retval Error code | 57 | * 0 Success | 58 | * <0 Unrecoverable error | 59 | */ v----------------------------------------------------------------------+ 60 | int updateWiFiCredentials(const char ** const ssid, const char ** const psk, uint8_t * const security_mode) 61 | { 62 | wifi_config_t wifi_config; 63 | int ret = 0; 64 | 65 | if ((ssid == NULL) ||(psk == NULL) || (security_mode == NULL)) 66 | { 67 | return -1; 68 | } 69 | 70 | memset(&wifi_config, 0, sizeof(wifi_config_t)); 71 | 72 | msg_info("\nEnter SSID: "); 73 | 74 | getInputString(wifi_config.ssid, USER_CONF_WIFI_SSID_MAX_LENGTH); 75 | msg_info("You have entered %s as the ssid.\n", wifi_config.ssid); 76 | 77 | msg_info("\n"); 78 | char c; 79 | do 80 | { 81 | msg_info("\rEnter Security Mode (0 - Open, 1 - WEP, 2 - WPA, 3 - WPA2): \b"); 82 | c = getchar(); 83 | } 84 | while ( (c < '0') || (c > '3')); 85 | wifi_config.security_mode = c - '0'; 86 | msg_info("\nYou have entered %d as the security mode.\n", wifi_config.security_mode); 87 | 88 | 89 | if (wifi_config.security_mode != 0) 90 | { 91 | msg_info("\nEnter password: "); 92 | getInputString(wifi_config.psk, sizeof(wifi_config.psk)); ---------------------------+ 93 | } | 94 | | 95 | wifi_config.magic = USER_CONF_MAGIC; | 96 | | 97 | | 98 | ret = FLASH_update((uint32_t)&lUserConfig.wifi_config, &wifi_config, sizeof(wifi_config_t)); | 99 | | 100 | if (ret < 0) | 101 | { | 102 | msg_error("Failed updating the wifi configuration in FLASH.\n"); | 103 | } | 104 | | 105 | msg_info("\n"); | 106 | return ret; | 107 | } | 108 | | 109 | /** | 110 | * @brief Get a line from the console (user input). | 111 | * @param Out: inputString Pointer to buffer for input line. | 112 | * @param In: len Max length for line. | 113 | * @retval Number of bytes read from the terminal. | 114 | */ | 115 | int getInputString(char *inputString, size_t len) <--------------------------------------+ 116 | { 117 | size_t currLen = 0; 118 | int c = 0; 119 | 120 | c = getchar(); 121 | 122 | while ((c != EOF) && ((currLen + 1) < len) && (c != '\r') && (c != '\n') ) 123 | { 124 | if (c == '\b') 125 | { 126 | if (currLen != 0) 127 | { 128 | --currLen; 129 | inputString[currLen] = 0; 130 | msg_info(" \b"); 131 | } 132 | } 133 | else 134 | { 135 | if (currLen < (len-1)) 136 | { 137 | inputString[currLen] = c; 138 | } 139 | 140 | ++currLen; 141 | } 142 | c = getchar(); 143 | } 144 | if (currLen != 0) 145 | { /* Close the string in the input buffer... only if a string was written to it. */ 146 | inputString[currLen] = '\0'; 147 | } 148 | if (c == '\r') 149 | { 150 | c = getchar(); /* assume there is '\n' after '\r'. Just discard it. */ 151 | } 152 | 153 | return currLen; 154 | } 155 | ``` 156 | -------------------------------------------------------------------------------- /docs/0012_SW4STM32_B-L475E-IOT01A_Sensors_Init.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A Sensors Init 2 | 3 | ```C 4 | int main(void) 5 | { 6 | ... 7 | 8 | /* Working application */ 9 | iothub_mqtt_client_run(); ---------------+ 10 | | 11 | return 0; | 12 | } | 13 | | 14 | int iothub_mqtt_client_run(void) <----------+ 15 | { 16 | if (platform_init() != 0) ---------------------+ 17 | { | 18 | (void)printf("platform_init failed\r\n"); | 19 | return __FAILURE__; | 20 | } | 21 | else | 22 | { | 23 | ... | 24 | } | 25 | } | 26 | | 27 | int platform_init(void) <-----------------------+ 28 | { 29 | ... 30 | #ifdef SENSOR 31 | int res = init_sensors(); -------------------------------------+ 32 | if(0 != res) | 33 | { | 34 | msg_error("init_sensors returned error : %d\n", res); | 35 | } | 36 | #endif /* SENSOR */ | 37 | | 38 | return 0; | 39 | } | 40 | | 41 | /** | 42 | * @brief init_sensors | 43 | * @param none | 44 | * @retval 0 in case of success | 45 | * -1 in case of failure | 46 | */ | 47 | int init_sensors(void) <-----------------------------------+ 48 | { 49 | int ret = 0; 50 | 51 | if (HSENSOR_OK != BSP_HSENSOR_Init()) 52 | { 53 | msg_error("BSP_HSENSOR_Init() returns %d\n", ret); 54 | ret = -1; 55 | } 56 | 57 | if (TSENSOR_OK != BSP_TSENSOR_Init()) 58 | { 59 | msg_error("BSP_TSENSOR_Init() returns %d\n", ret); 60 | ret = -1; 61 | } 62 | 63 | if (PSENSOR_OK != BSP_PSENSOR_Init()) 64 | { 65 | msg_error("BSP_PSENSOR_Init() returns %d\n", ret); 66 | ret = -1; 67 | } 68 | 69 | if (MAGNETO_OK != BSP_MAGNETO_Init()) 70 | { 71 | msg_error("BSP_MAGNETO_Init() returns %d\n", ret); 72 | ret = -1; 73 | } 74 | 75 | if (GYRO_OK != BSP_GYRO_Init()) 76 | { 77 | msg_error("BSP_GYRO_Init() returns %d\n", ret); 78 | ret = -1; 79 | } 80 | 81 | if (ACCELERO_OK != BSP_ACCELERO_Init()) 82 | { 83 | msg_error("BSP_ACCELERO_Init() returns %d\n", ret); 84 | ret = -1; 85 | } 86 | 87 | VL53L0X_PROXIMITY_Init(); 88 | 89 | return ret; 90 | } 91 | ``` 92 | -------------------------------------------------------------------------------- /docs/0013_SW4STM32_B-L475E-IOT01A_Compile_Download.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A Compile Download 2 | 3 | ## Complie 4 | 5 | ![img/SW4STM32_B-L475E-IOT01_Compile_Download.png](img/SW4STM32_B-L475E-IOT01_Compile_Download.png) 6 | 7 | ## Download Message 8 | 9 | ``` 10 | Open On-Chip Debugger 0.10.0-dev-00005-g4030e1c-dirty (2017-10-24-08:00) 11 | Licensed under GNU GPL v2 12 | For bug reports, read 13 | http://openocd.org/doc/doxygen/bugs.html 14 | srst_only separate srst_nogate srst_open_drain connect_assert_srst 15 | Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD 16 | padded zone erase set to 1 17 | adapter_nsrst_delay: 100 18 | adapter speed: 480 kHz 19 | Info : clock speed 480 kHz 20 | Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED 21 | Info : STLINK v2 JTAG v28 API v2 M v18 VID 0x0483 PID 0x374B 22 | Info : using stlink api v2 23 | Info : Target voltage: 3.213639 24 | Info : Stlink adapter speed set to 480 kHz 25 | Info : STM32L475VGTx.cpu: hardware has 6 breakpoints, 4 watchpoints 26 | Info : Stlink adapter speed set to 480 kHz 27 | adapter speed: 480 kHz 28 | STM32L475VGTx.cpu: target state: halted 29 | target halted due to debug-request, current mode: Thread 30 | xPSR: 0x01000000 pc: 0x08031534 msp: 0x20002878 31 | Info : Stlink adapter speed set to 4000 kHz 32 | adapter speed: 4000 kHz 33 | ** Programming Started ** 34 | auto erase enabled 35 | Info : Device id = 0x10076415 36 | Info : STM32L4xx flash size is 1024kb, base address is 0x8000000 37 | Info : Erase the padded zone before the write 38 | Error: Whole bank access must start at beginning of bank. 39 | Info : Erase the padded zone before the write 40 | Warn : Adding extra erase range, 0x00044800 to 0x00044f17 41 | Info : Padding image section 1 with 127208 bytes 42 | STM32L475VGTx.cpu: target state: halted 43 | target halted due to breakpoint, current mode: Thread 44 | xPSR: 0x61000000 pc: 0x20000050 msp: 0x20002878 45 | Warn : block write succeeded 46 | wrote 411648 bytes from file Debug/B-L475E-IOT01.elf in 11.588074s (34.691 KiB/s) 47 | ** Programming Finished ** 48 | ** Verify Started ** 49 | STM32L475VGTx.cpu: target state: halted 50 | target halted due to breakpoint, current mode: Thread 51 | xPSR: 0x61000000 pc: 0x2000002e msp: 0x20002878 52 | STM32L475VGTx.cpu: target state: halted 53 | target halted due to breakpoint, current mode: Thread 54 | xPSR: 0x61000000 pc: 0x2000002e msp: 0x20002878 55 | STM32L475VGTx.cpu: target state: halted 56 | target halted due to breakpoint, current mode: Thread 57 | xPSR: 0x61000000 pc: 0x2000002e msp: 0x20002878 58 | verified 282440 bytes in 8.123989s (33.951 KiB/s) 59 | ** Verified OK ** 60 | ** Resetting Target ** 61 | Info : Stlink adapter speed set to 480 kHz 62 | adapter speed: 480 kHz 63 | shutdown command invoked 64 | ``` 65 | 66 | ## STM32L475 Terminal 67 | 68 | ``` 69 | ************************************************************************** 70 | *** STM32 IoT Discovery kit for STM32L475 MCU *** 71 | *** X-CUBE-Baidu Cloud Connectivity Demonstration 72 | *** FW version 1.0.1 - Dec 26 2017, 10:06:50 *** 73 | ************************************************************************** 74 | 75 | *** Board personalisation *** 76 | 77 | Press the User button (Blue) within the next 5 seconds if you want to update the configuration 78 | (NetWork or Cloud security credentials) 79 | 80 | Do you want to configure the Wifi credentials ? (y/n) 81 | y 82 | Enter SSID: CCNet 83 | 84 | You have entered CCNet as the ssid. 85 | 86 | Enter Security Mode (0 - Open, 1 - WEP, 2 - WPA, 3 - WPA2):3 87 | You have entered 3 as the security mode. 88 | 89 | Enter password: zengjfos123 90 | 91 | *** WIFI connection *** 92 | 93 | Initializing the WiFi module 94 | Module initialized successfully: Inventek eS-WiFi ISM43362-M3G-L44-SPI C3.5.2.3.BETA9 95 | Retrieving the WiFi module MAC address: c4:7f:51:04:3a:9b 96 | 97 | Connecting to AP: CCNet Attempt 1/3 ... 98 | Connected to AP CCNet 99 | Mac address: c4:7f:51:04:3a:9b 100 | Retrieving the IP address. 101 | IP address: 192.168.23.5 102 | Setting the RTC from the network time. 103 | Error: Time:Sat Jan 1 00:11:13 2000 File:D:/zengjf/SourceCode/STM32/iot-edge-sdk-samples/STM32/B-L475E-IOT01/Middlewares/Third_Party/baidu/iothub_client/src/iothub_mqtt_client.c Func:CreateRetryLogic Line:121 Not implemented chosing default 104 | Incoming Msg: Packet Id: 0 105 | QOS: Deliver_At_Most_Once 106 | Topic Name: test-iot-service 107 | Is Retained: fale 108 | Is Duplicate: fale 109 | App Msg: content is valid UTF8:true message length:25 110 | publish message to topic. 111 | 112 | call publish at least once handle 113 | hub is connected 114 | received publish ack from mqtt server when deliver at least once message 115 | Incoming Msg: Packet Id: 0 116 | QOS: Deliver_At_Most_Once 117 | Topic Name: test-iot-sub 118 | Is Retained: fale 119 | Is Duplicate: fale 120 | App Msg: content is valid UTF8:true message length:25 121 | publish message to topic. 122 | 123 | call publish at least once handle 124 | hub is connected 125 | received publish ack from mqtt server when deliver at least once message 126 | Incoming Msg: Packet Id: 0 127 | QOS: Deliver_At_Most_Once 128 | Topic Name: test-iot-sub 129 | Is Retained: fale 130 | Is Duplicate: fale 131 | App Msg: content is valid UTF8:true message length:217 132 | {"magZ":380, "magY":320, "magX":-291, "gyrZ":0.000000, "gyrY":-3500.000000, "gyrX":280.000000, "accZ":1003, "accY":-6, "accX":-8, "proximity":111, "pressure":1022.539978, "humidity":44.758327, "temperature":26.056074} 133 | 134 | call publish at least once handle 135 | hub is connected 136 | received publish ack from mqtt server when deliver at least once message 137 | Incoming Msg: Packet Id: 0 138 | QOS: Deliver_At_Most_Once 139 | Topic Name: test-iot-sub 140 | Is Retained: fale 141 | Is Duplicate: fale 142 | App Msg: content is valid UTF8:true message length:219 143 | {"magZ":383, "magY":327, "magX":-297, "gyrZ":70.000000, "gyrY":-3570.000000, "gyrX":280.000000, "accZ":1003, "accY":-7, "accX":-11, "proximity":102, "pressure":1022.530029, "humidity":44.733875, "temperature":26.018692} 144 | 145 | call publish at least once handle 146 | hub is connected 147 | received publish ack from mqtt server when deliver at least once message 148 | Incoming Msg: Packet Id: 0 149 | QOS: Deliver_At_Most_Once 150 | Topic Name: test-iot-sub 151 | Is Retained: fale 152 | Is Duplicate: fale 153 | App Msg: content is valid UTF8:true message length:219 154 | {"magZ":381, "magY":321, "magX":-299, "gyrZ":140.000000, "gyrY":-3570.000000, "gyrX":210.000000, "accZ":1003, "accY":-9, "accX":-9, "proximity":111, "pressure":1022.559998, "humidity":44.703316, "temperature":26.018692} 155 | ``` 156 | -------------------------------------------------------------------------------- /docs/0014_SW4STM32_B-L475E-IOT01A_Enter_Twice_Enter_Key.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A Enter Twice Enter Key 2 | 3 | 如下Source Code中,在获取到了`\r`之后,会再读取一个字符,但这个字符不会保存,被认为是`\n`。 4 | 5 | ## Source Code 6 | 7 | ```C 8 | /** 9 | * @brief Get a line from the console (user input). 10 | * @param Out: inputString Pointer to buffer for input line. 11 | * @param In: len Max length for line. 12 | * @retval Number of bytes read from the terminal. 13 | */ 14 | int getInputString(char *inputString, size_t len) 15 | { 16 | size_t currLen = 0; 17 | int c = 0; 18 | 19 | c = getchar(); 20 | 21 | while ((c != EOF) && ((currLen + 1) < len) && (c != '\r') && (c != '\n') ) 22 | { 23 | if (c == '\b') 24 | { 25 | if (currLen != 0) 26 | { 27 | --currLen; 28 | inputString[currLen] = 0; 29 | msg_info(" \b"); 30 | } 31 | } 32 | else 33 | { 34 | if (currLen < (len-1)) 35 | { 36 | inputString[currLen] = c; 37 | } 38 | 39 | ++currLen; 40 | } 41 | c = getchar(); 42 | } 43 | if (currLen != 0) 44 | { /* Close the string in the input buffer... only if a string was written to it. */ 45 | inputString[currLen] = '\0'; 46 | } 47 | if (c == '\r') 48 | { 49 | c = getchar(); /* assume there is '\n' after '\r'. Just discard it. */ 50 | } 51 | 52 | return currLen; 53 | } 54 | ``` 55 | 56 | -------------------------------------------------------------------------------- /docs/0016_SW4STM32_B-L475E-IOT01A_Gyroscope_Hacking.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A Gyroscope Hakcing 2 | 3 | ## Gyroscope Init 4 | 5 | ```C 6 | 7 | /** 8 | * typedef struct 9 | * { 10 | * void (*Init)(uint16_t); 11 | * void (*DeInit)(void); 12 | * uint8_t (*ReadID)(void); 13 | * void (*Reset)(void); 14 | * void (*LowPower)(uint16_t); 15 | * void (*ConfigIT)(uint16_t); 16 | * void (*EnableIT)(uint8_t); 17 | * void (*DisableIT)(uint8_t); 18 | * uint8_t (*ITStatus)(uint16_t, uint16_t); 19 | * void (*ClearIT)(uint16_t, uint16_t); 20 | * void (*FilterConfig)(uint8_t); 21 | * void (*FilterCmd)(uint8_t); 22 | * void (*GetXYZ)(float *); 23 | * }GYRO_DrvTypeDef; 24 | */ 25 | static GYRO_DrvTypeDef *GyroscopeDrv; 26 | 27 | /** 28 | * @brief Initialize Gyroscope. 29 | * @retval GYRO_OK or GYRO_ERROR 30 | */ 31 | uint8_t BSP_GYRO_Init(void) 32 | { 33 | uint8_t ret = GYRO_ERROR; 34 | uint16_t ctrl = 0x0000; 35 | /** 36 | * typedef struct 37 | * { 38 | * uint8_t Power_Mode; /* Power-down/Sleep/Normal Mode */ 39 | * uint8_t Output_DataRate; /* OUT data rate */ 40 | * uint8_t Axes_Enable; /* Axes enable */ 41 | * uint8_t Band_Width; /* Bandwidth selection */ 42 | * uint8_t BlockData_Update; /* Block Data Update */ 43 | * uint8_t Endianness; /* Endian Data selection */ 44 | * uint8_t Full_Scale; /* Full Scale selection */ 45 | * }GYRO_InitTypeDef; 46 | */ 47 | GYRO_InitTypeDef LSM6DSL_InitStructure; 48 | 49 | /** 50 | * GYRO_DrvTypeDef Lsm6dslGyroDrv = 51 | * { 52 | * LSM6DSL_GyroInit, 53 | * LSM6DSL_GyroDeInit, 54 | * LSM6DSL_GyroReadID, 55 | * 0, 56 | * LSM6DSL_GyroLowPower, 57 | * 0, 58 | * 0, 59 | * 0, 60 | * 0, 61 | * 0, 62 | * 0, 63 | * 0, 64 | * LSM6DSL_GyroReadXYZAngRate <----- void (*GetXYZ)(float *); 65 | * }; 66 | */ 67 | if(Lsm6dslGyroDrv.ReadID() != LSM6DSL_ACC_GYRO_WHO_AM_I) 68 | { 69 | ret = GYRO_ERROR; 70 | } 71 | else 72 | { 73 | /* Initialize the gyroscope driver structure */ 74 | GyroscopeDrv = &Lsm6dslGyroDrv; 75 | 76 | /* Configure Mems : data rate, power mode, full scale and axes */ 77 | LSM6DSL_InitStructure.Power_Mode = 0; 78 | LSM6DSL_InitStructure.Output_DataRate = LSM6DSL_ODR_52Hz; 79 | LSM6DSL_InitStructure.Axes_Enable = 0; 80 | LSM6DSL_InitStructure.Band_Width = 0; 81 | LSM6DSL_InitStructure.BlockData_Update = LSM6DSL_BDU_BLOCK_UPDATE; 82 | LSM6DSL_InitStructure.Endianness = 0; 83 | LSM6DSL_InitStructure.Full_Scale = LSM6DSL_GYRO_FS_2000; <----------设置量程 84 | 85 | /* Configure MEMS: data rate, full scale */ 86 | ctrl = (LSM6DSL_InitStructure.Full_Scale | LSM6DSL_InitStructure.Output_DataRate); 87 | 88 | /* Configure MEMS: BDU and Auto-increment for multi read/write */ 89 | ctrl |= ((LSM6DSL_InitStructure.BlockData_Update | LSM6DSL_ACC_GYRO_IF_INC_ENABLED) << 8); 90 | 91 | /* Initialize component */ 92 | /** 93 | * void LSM6DSL_GyroInit(uint16_t InitStruct) 94 | * { 95 | * uint8_t ctrl = 0x00; 96 | * uint8_t tmp; 97 | * 98 | * /* Read CTRL2_G */ 99 | * tmp = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G); 100 | * 101 | * /* Write value to GYRO MEMS CTRL2_G register: FS and Data Rate */ 102 | * ctrl = (uint8_t) InitStruct; 103 | * tmp &= ~(0xFC); 104 | * tmp |= ctrl; 105 | * SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G, tmp); 106 | * 107 | * /* Read CTRL3_C */ 108 | * tmp = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL3_C); 109 | * 110 | * /* Write value to GYRO MEMS CTRL3_C register: BDU and Auto-increment */ 111 | * ctrl = ((uint8_t) (InitStruct >> 8)); 112 | * tmp &= ~(0x44); 113 | * tmp |= ctrl; 114 | * SENSOR_IO_Write(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL3_C, tmp); 115 | * } 116 | */ 117 | GyroscopeDrv->Init(ctrl); 118 | 119 | ret = GYRO_OK; 120 | } 121 | 122 | return ret; 123 | } 124 | ``` 125 | 126 | ## Gyroscope GetXYZ 127 | 128 | ```C 129 | void BSP_GYRO_GetXYZ(float* pfData) 130 | { 131 | if(GyroscopeDrv != NULL) 132 | { 133 | if(GyroscopeDrv->GetXYZ!= NULL) 134 | { 135 | GyroscopeDrv->GetXYZ(pfData); 136 | } | 137 | } | 138 | } | 139 | V 140 | void LSM6DSL_GyroReadXYZAngRate(float *pfData) 141 | { 142 | int16_t pnRawData[3]; 143 | uint8_t ctrlg= 0; 144 | uint8_t buffer[6]; 145 | uint8_t i = 0; 146 | float sensitivity = 0; 147 | 148 | /* Read the gyro control register content */ 149 | ctrlg = SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_CTRL2_G); 150 | 151 | /* Read output register X, Y & Z acceleration */ 152 | SENSOR_IO_ReadMultiple(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_OUTX_L_G, buffer, 6); 153 | 154 | for(i=0; i<3; i++) 155 | { 156 | pnRawData[i]=((((uint16_t)buffer[2*i+1]) << 8) + (uint16_t)buffer[2*i]); 157 | } 158 | 159 | /* Normal mode */ 160 | /* Switch the sensitivity value set in the CRTL2_G */ 161 | switch(ctrlg & 0x0C) 162 | { 163 | case LSM6DSL_GYRO_FS_245: 164 | sensitivity = LSM6DSL_GYRO_SENSITIVITY_245DPS; 165 | break; 166 | case LSM6DSL_GYRO_FS_500: 167 | sensitivity = LSM6DSL_GYRO_SENSITIVITY_500DPS; 168 | break; 169 | case LSM6DSL_GYRO_FS_1000: 170 | sensitivity = LSM6DSL_GYRO_SENSITIVITY_1000DPS; 171 | break; 172 | case LSM6DSL_GYRO_FS_2000: 173 | // #define LSM6DSL_GYRO_SENSITIVITY_2000DPS ((float)70.00f) /**< Sensitivity value for 2000 dps full scale [mdps/LSB] */ 174 | sensitivity = LSM6DSL_GYRO_SENSITIVITY_2000DPS; 175 | break; 176 | } 177 | 178 | /* Obtain the mg value for the three axis */ 179 | for(i=0; i<3; i++) 180 | { 181 | pfData[i]=( float )(pnRawData[i] * sensitivity); 182 | } 183 | } 184 | ``` 185 | -------------------------------------------------------------------------------- /docs/0017_SW4STM32_B-L475E-IOT01A_Global_Define.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A Global Define 2 | 3 | ![img/SW4STM32_B-L475E-IOT01_Define.png](img/SW4STM32_B-L475E-IOT01_Define.png) 4 | 5 | -------------------------------------------------------------------------------- /docs/0021_SW4STM32_B-L475E-IOT01A_SysTick.md: -------------------------------------------------------------------------------- 1 | # SW4STM32 B-L475E-IOT01A SysTick 2 | 3 | ## SysTick 4 | 5 | ```C 6 | int main(void) 7 | { 8 | /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ 9 | HAL_Init(); ---------------+ 10 | ... | 11 | } | 12 | | 13 | HAL_StatusTypeDef HAL_Init(void) <---------+ 14 | { 15 | /* Configure Flash prefetch, Instruction cache, Data cache */ 16 | /* Default configuration at reset is: */ 17 | /* - Prefetch disabled */ 18 | /* - Instruction cache enabled */ 19 | /* - Data cache enabled */ 20 | #if (INSTRUCTION_CACHE_ENABLE == 0) 21 | __HAL_FLASH_INSTRUCTION_CACHE_DISABLE(); 22 | #endif /* INSTRUCTION_CACHE_ENABLE */ 23 | 24 | #if (DATA_CACHE_ENABLE == 0) 25 | __HAL_FLASH_DATA_CACHE_DISABLE(); 26 | #endif /* DATA_CACHE_ENABLE */ 27 | 28 | #if (PREFETCH_ENABLE != 0) 29 | __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); 30 | #endif /* PREFETCH_ENABLE */ 31 | 32 | /* Set Interrupt Group Priority */ 33 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); 34 | 35 | /* Use SysTick as time base source and configure 1ms tick (default clock after Reset is MSI) */ 36 | HAL_InitTick(TICK_INT_PRIORITY); --------------+ 37 | | 38 | /* Init the low level hardware */ | 39 | HAL_MspInit(); | 40 | | 41 | /* Return function status */ | 42 | return HAL_OK; | 43 | } | 44 | v-------------------+ 45 | __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 46 | { 47 | /*Configure the SysTick to have interrupt in 1ms time basis*/ 48 | HAL_SYSTICK_Config(SystemCoreClock/1000); --------------------+ 49 | | 50 | /*Configure the SysTick IRQ priority */ | 51 | HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0); | 52 | | 53 | /* Return function status */ | 54 | return HAL_OK; | 55 | } | 56 | | 57 | uint32_t SystemCoreClock = 4000000; <----------------------+ 58 | | 59 | uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb) <--------------+ 60 | { 61 | return SysTick_Config(TicksNumb); -----------------------+ 62 | } | 63 | | 64 | __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) <---------+ 65 | { 66 | if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) 67 | { 68 | return (1UL); /* Reload value impossible */ 69 | } 70 | 71 | SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ 72 | NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ 73 | SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ 74 | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | 75 | SysTick_CTRL_TICKINT_Msk | 76 | SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ 77 | return (0UL); /* Function successful */ 78 | } 79 | ``` 80 | 81 | ## Interrupt 82 | 83 | ```C 84 | g_pfnVectors: 85 | ... 86 | .word SysTick_Handler ---------+ 87 | ... | 88 | | 89 | void SysTick_Handler(void) <--------+ 90 | { 91 | HAL_IncTick(); ---------+ 92 | HAL_SYSTICK_IRQHandler(); ---------*-+ 93 | } | | 94 | | | 95 | __weak void HAL_IncTick(void) <--------+ | 96 | { | 97 | uwTick++; ---------*----------------------------------------+ 98 | } | | 99 | | | 100 | void HAL_SYSTICK_IRQHandler(void) <--------+ | 101 | { | 102 | HAL_SYSTICK_Callback(); --------------+ | 103 | } | | 104 | | | 105 | __weak void HAL_SYSTICK_Callback(void) <--------+ | 106 | { | 107 | /* NOTE : This function should not be modified, when the callback is needed, | 108 | the HAL_SYSTICK_Callback could be implemented in the user file | 109 | */ | 110 | } | 111 | | 112 | __weak uint32_t HAL_GetTick(void) | 113 | { | 114 | return uwTick; <--------------------------------------------------+ 115 | } 116 | ``` 117 | -------------------------------------------------------------------------------- /docs/0025_iot-edge-sdk-for-iot-parser_DeviceManager.md: -------------------------------------------------------------------------------- 1 | # iot-edge-sdk-for-iot-parser DeviceManager 2 | 3 | ## 参考文档 4 | 5 | * [百度云天工物联网平台 IoT Edge SDK for C](https://github.com/baidu/iot-edge-c-sdk) 6 | 7 | ## 操作步骤 8 | 9 | * `cd iot-edge-c-sdk` 10 | * `mkdir cmake` 11 | * `cd cmake` 12 | * `cmake ..` 13 | * `cmake --build .` 14 | 15 | ## Example Source Code 16 | 17 | https://github.com/baidu/iot-edge-c-sdk/tree/master/iothub_client/samples/iotdm_client_sample 18 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug/ 2 | /Release/ -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/.mxproject: -------------------------------------------------------------------------------- 1 | [PreviousGenFiles] 2 | HeaderPath=D:/zengjf/SourceCode/STM32/STM32F103C8T6/Inc 3 | HeaderFiles=FreeRTOSConfig.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h; 4 | SourcePath=D:/zengjf/SourceCode/STM32/STM32F103C8T6/Src 5 | SourceFiles=FreeRTOSConfig.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h;freertos.c;stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c; 6 | 7 | [PreviousLibFiles] 8 | LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Middlewares/Third_Party/FreeRTOS/Source/include/croutine.h;Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h;Middlewares/Third_Party/FreeRTOS/Source/include/event_groups.h;Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h;Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOSConfig_template.h;Middlewares/Third_Party/FreeRTOS/Source/include/list.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_prototypes.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h;Middlewares/Third_Party/FreeRTOS/Source/include/portable.h;Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h;Middlewares/Third_Party/FreeRTOS/Source/include/queue.h;Middlewares/Third_Party/FreeRTOS/Source/include/semphr.h;Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h;Middlewares/Third_Party/FreeRTOS/Source/include/task.h;Middlewares/Third_Party/FreeRTOS/Source/include/timers.h;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h;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/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h; 9 | 10 | [PreviousUsedSW4STM32Files] 11 | SourceFiles=../Src/main.c;../Src/freertos.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.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/tasks.c;../Middlewares/Third_Party/FreeRTOS/Source/timers.c;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s;../Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.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/tasks.c;../Middlewares/Third_Party/FreeRTOS/Source/timers.c;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c; 12 | HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Middlewares\Third_Party\FreeRTOS\Source\include;..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS;..\Drivers\CMSIS\Include; 13 | CDefines=__weak=__attribute__((weak));__packed=__attribute__((__packed__)); 14 | 15 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | STM32F103C8T6 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 25 | fr.ac6.mcu.ide.core.MCUProjectNature 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/code/STM32F103C8T6/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/code/STM32F103C8T6/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V4.2.0 6 | * @date 31-March-2017 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /** @addtogroup CMSIS 39 | * @{ 40 | */ 41 | 42 | /** @addtogroup stm32f10x_system 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief Define to prevent recursive inclusion 48 | */ 49 | #ifndef __SYSTEM_STM32F10X_H 50 | #define __SYSTEM_STM32F10X_H 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | /** @addtogroup STM32F10x_System_Includes 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | /** @addtogroup STM32F10x_System_Exported_types 66 | * @{ 67 | */ 68 | 69 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 70 | extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ 71 | extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @addtogroup STM32F10x_System_Exported_Constants 78 | * @{ 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @addtogroup STM32F10x_System_Exported_Macros 86 | * @{ 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @addtogroup STM32F10x_System_Exported_Functions 94 | * @{ 95 | */ 96 | 97 | extern void SystemInit(void); 98 | extern void SystemCoreClockUpdate(void); 99 | /** 100 | * @} 101 | */ 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif /*__SYSTEM_STM32F10X_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 117 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. October 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #ifndef _ARM_COMMON_TABLES_H 42 | #define _ARM_COMMON_TABLES_H 43 | 44 | #include "arm_math.h" 45 | 46 | extern const uint16_t armBitRevTable[1024]; 47 | extern const q15_t armRecipTableQ15[64]; 48 | extern const q31_t armRecipTableQ31[64]; 49 | /* extern const q31_t realCoefAQ31[1024]; */ 50 | /* extern const q31_t realCoefBQ31[1024]; */ 51 | extern const float32_t twiddleCoef_16[32]; 52 | extern const float32_t twiddleCoef_32[64]; 53 | extern const float32_t twiddleCoef_64[128]; 54 | extern const float32_t twiddleCoef_128[256]; 55 | extern const float32_t twiddleCoef_256[512]; 56 | extern const float32_t twiddleCoef_512[1024]; 57 | extern const float32_t twiddleCoef_1024[2048]; 58 | extern const float32_t twiddleCoef_2048[4096]; 59 | extern const float32_t twiddleCoef_4096[8192]; 60 | #define twiddleCoef twiddleCoef_4096 61 | extern const q31_t twiddleCoef_16_q31[24]; 62 | extern const q31_t twiddleCoef_32_q31[48]; 63 | extern const q31_t twiddleCoef_64_q31[96]; 64 | extern const q31_t twiddleCoef_128_q31[192]; 65 | extern const q31_t twiddleCoef_256_q31[384]; 66 | extern const q31_t twiddleCoef_512_q31[768]; 67 | extern const q31_t twiddleCoef_1024_q31[1536]; 68 | extern const q31_t twiddleCoef_2048_q31[3072]; 69 | extern const q31_t twiddleCoef_4096_q31[6144]; 70 | extern const q15_t twiddleCoef_16_q15[24]; 71 | extern const q15_t twiddleCoef_32_q15[48]; 72 | extern const q15_t twiddleCoef_64_q15[96]; 73 | extern const q15_t twiddleCoef_128_q15[192]; 74 | extern const q15_t twiddleCoef_256_q15[384]; 75 | extern const q15_t twiddleCoef_512_q15[768]; 76 | extern const q15_t twiddleCoef_1024_q15[1536]; 77 | extern const q15_t twiddleCoef_2048_q15[3072]; 78 | extern const q15_t twiddleCoef_4096_q15[6144]; 79 | extern const float32_t twiddleCoef_rfft_32[32]; 80 | extern const float32_t twiddleCoef_rfft_64[64]; 81 | extern const float32_t twiddleCoef_rfft_128[128]; 82 | extern const float32_t twiddleCoef_rfft_256[256]; 83 | extern const float32_t twiddleCoef_rfft_512[512]; 84 | extern const float32_t twiddleCoef_rfft_1024[1024]; 85 | extern const float32_t twiddleCoef_rfft_2048[2048]; 86 | extern const float32_t twiddleCoef_rfft_4096[4096]; 87 | 88 | 89 | /* floating-point bit reversal tables */ 90 | #define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 ) 91 | #define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 ) 92 | #define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 ) 93 | #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 ) 94 | #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 ) 95 | #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 ) 96 | #define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800) 97 | #define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808) 98 | #define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032) 99 | 100 | extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH]; 101 | extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH]; 102 | extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH]; 103 | extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; 104 | extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; 105 | extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; 106 | extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH]; 107 | extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH]; 108 | extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH]; 109 | 110 | /* fixed-point bit reversal tables */ 111 | #define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 ) 112 | #define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 ) 113 | #define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 ) 114 | #define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 ) 115 | #define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 ) 116 | #define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 ) 117 | #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 ) 118 | #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) 119 | #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) 120 | 121 | extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH]; 122 | extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH]; 123 | extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH]; 124 | extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH]; 125 | extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH]; 126 | extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH]; 127 | extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; 128 | extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; 129 | extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; 130 | 131 | /* Tables for Fast Math Sine and Cosine */ 132 | extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; 133 | extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; 134 | extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; 135 | 136 | #endif /* ARM_COMMON_TABLES_H */ 137 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Include/arm_const_structs.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_const_structs.h 9 | * 10 | * Description: This file has constant structs that are initialized for 11 | * user convenience. For example, some can be given as 12 | * arguments to the arm_cfft_f32() function. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * - Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * - Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * - Neither the name of ARM LIMITED nor the names of its contributors 26 | * may be used to endorse or promote products derived from this 27 | * software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 | * POSSIBILITY OF SUCH DAMAGE. 41 | * -------------------------------------------------------------------- */ 42 | 43 | #ifndef _ARM_CONST_STRUCTS_H 44 | #define _ARM_CONST_STRUCTS_H 45 | 46 | #include "arm_math.h" 47 | #include "arm_common_tables.h" 48 | 49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; 50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; 51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; 52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; 53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; 54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; 55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; 56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; 57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; 58 | 59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; 60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; 61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; 62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; 63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; 64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; 65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; 66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; 67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; 68 | 69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; 70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; 71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; 72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; 73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; 74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; 75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; 76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; 77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Include/core_cmFunc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmFunc.h 3 | * @brief CMSIS Cortex-M Core Function Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMFUNC_H 42 | #define __CORE_CMFUNC_H 43 | 44 | 45 | /* ########################### Core Function Access ########################### */ 46 | /** \ingroup CMSIS_Core_FunctionInterface 47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@} end of CMSIS_Core_RegAccFunctions */ 86 | 87 | #endif /* __CORE_CMFUNC_H */ 88 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Include/core_cmInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmInstr.h 3 | * @brief CMSIS Cortex-M Core Instruction Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMINSTR_H 42 | #define __CORE_CMINSTR_H 43 | 44 | 45 | /* ########################## Core Instruction Access ######################### */ 46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface 47 | Access to dedicated instructions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */ 86 | 87 | #endif /* __CORE_CMINSTR_H */ 88 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/CMSIS/Include/core_cmSimd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmSimd.h 3 | * @brief CMSIS Cortex-M SIMD Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMSIMD_H 42 | #define __CORE_CMSIMD_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | 49 | /* ################### Compiler specific Intrinsics ########################### */ 50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics 51 | Access to dedicated SIMD instructions 52 | @{ 53 | */ 54 | 55 | /*------------------ RealView Compiler -----------------*/ 56 | #if defined ( __CC_ARM ) 57 | #include "cmsis_armcc.h" 58 | 59 | /*------------------ ARM Compiler V6 -------------------*/ 60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 61 | #include "cmsis_armcc_V6.h" 62 | 63 | /*------------------ GNU Compiler ----------------------*/ 64 | #elif defined ( __GNUC__ ) 65 | #include "cmsis_gcc.h" 66 | 67 | /*------------------ ICC Compiler ----------------------*/ 68 | #elif defined ( __ICCARM__ ) 69 | #include 70 | 71 | /*------------------ TI CCS Compiler -------------------*/ 72 | #elif defined ( __TMS470__ ) 73 | #include 74 | 75 | /*------------------ TASKING Compiler ------------------*/ 76 | #elif defined ( __TASKING__ ) 77 | /* 78 | * The CMSIS functions have been implemented as intrinsics in the compiler. 79 | * Please use "carm -?i" to get an up to date list of all intrinsics, 80 | * Including the CMSIS ones. 81 | */ 82 | 83 | /*------------------ COSMIC Compiler -------------------*/ 84 | #elif defined ( __CSMC__ ) 85 | #include 86 | 87 | #endif 88 | 89 | /*@} end of group CMSIS_SIMD_intrinsics */ 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __CORE_CMSIMD_H */ 97 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_def.h 4 | * @author MCD Application Team 5 | * @version V1.1.1 6 | * @date 12-May-2017 7 | * @brief This file contains HAL common defines, enumeration, macros and 8 | * structures definitions. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT(c) 2017 STMicroelectronics

13 | * 14 | * Redistribution and use in source and binary forms, with or without modification, 15 | * are permitted provided that the following conditions are met: 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 22 | * may be used to endorse or promote products derived from this software 23 | * without specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | ****************************************************************************** 37 | */ 38 | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ 40 | #ifndef __STM32F1xx_HAL_DEF 41 | #define __STM32F1xx_HAL_DEF 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f1xx.h" 49 | #if defined(USE_HAL_LEGACY) 50 | #include "Legacy/stm32_hal_legacy.h" 51 | #endif 52 | #include 53 | 54 | /* Exported types ------------------------------------------------------------*/ 55 | 56 | /** 57 | * @brief HAL Status structures definition 58 | */ 59 | typedef enum 60 | { 61 | HAL_OK = 0x00U, 62 | HAL_ERROR = 0x01U, 63 | HAL_BUSY = 0x02U, 64 | HAL_TIMEOUT = 0x03U 65 | } HAL_StatusTypeDef; 66 | 67 | /** 68 | * @brief HAL Lock structures definition 69 | */ 70 | typedef enum 71 | { 72 | HAL_UNLOCKED = 0x00U, 73 | HAL_LOCKED = 0x01U 74 | } HAL_LockTypeDef; 75 | 76 | /* Exported macro ------------------------------------------------------------*/ 77 | #define HAL_MAX_DELAY 0xFFFFFFFFU 78 | 79 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) 80 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) 81 | 82 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 83 | do{ \ 84 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 85 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 86 | } while(0U) 87 | 88 | #define UNUSED(x) ((void)(x)) 89 | 90 | /** @brief Reset the Handle's State field. 91 | * @param __HANDLE__: specifies the Peripheral Handle. 92 | * @note This macro can be used for the following purpose: 93 | * - When the Handle is declared as local variable; before passing it as parameter 94 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 95 | * to set to 0 the Handle's "State" field. 96 | * Otherwise, "State" field may have any random value and the first time the function 97 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 98 | * (i.e. HAL_PPP_MspInit() will not be executed). 99 | * - When there is a need to reconfigure the low level hardware: instead of calling 100 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 101 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 102 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 103 | * @retval None 104 | */ 105 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) 106 | 107 | #if (USE_RTOS == 1U) 108 | /* Reserved for future use */ 109 | #error "USE_RTOS should be 0 in the current HAL release" 110 | #else 111 | #define __HAL_LOCK(__HANDLE__) \ 112 | do{ \ 113 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 114 | { \ 115 | return HAL_BUSY; \ 116 | } \ 117 | else \ 118 | { \ 119 | (__HANDLE__)->Lock = HAL_LOCKED; \ 120 | } \ 121 | }while (0U) 122 | 123 | #define __HAL_UNLOCK(__HANDLE__) \ 124 | do{ \ 125 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 126 | }while (0U) 127 | #endif /* USE_RTOS */ 128 | 129 | #if defined ( __GNUC__ ) 130 | #ifndef __weak 131 | #define __weak __attribute__((weak)) 132 | #endif /* __weak */ 133 | #ifndef __packed 134 | #define __packed __attribute__((__packed__)) 135 | #endif /* __packed */ 136 | #endif /* __GNUC__ */ 137 | 138 | 139 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 140 | #if defined (__GNUC__) /* GNU Compiler */ 141 | #ifndef __ALIGN_END 142 | #define __ALIGN_END __attribute__ ((aligned (4))) 143 | #endif /* __ALIGN_END */ 144 | #ifndef __ALIGN_BEGIN 145 | #define __ALIGN_BEGIN 146 | #endif /* __ALIGN_BEGIN */ 147 | #else 148 | #ifndef __ALIGN_END 149 | #define __ALIGN_END 150 | #endif /* __ALIGN_END */ 151 | #ifndef __ALIGN_BEGIN 152 | #if defined (__CC_ARM) /* ARM Compiler */ 153 | #define __ALIGN_BEGIN __align(4) 154 | #elif defined (__ICCARM__) /* IAR Compiler */ 155 | #define __ALIGN_BEGIN 156 | #endif /* __CC_ARM */ 157 | #endif /* __ALIGN_BEGIN */ 158 | #endif /* __GNUC__ */ 159 | 160 | 161 | /** 162 | * @brief __RAM_FUNC definition 163 | */ 164 | #if defined ( __CC_ARM ) 165 | /* ARM Compiler 166 | ------------ 167 | RAM functions are defined using the toolchain options. 168 | Functions that are executed in RAM should reside in a separate source module. 169 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 170 | area of a module to a memory space in physical RAM. 171 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 172 | dialog. 173 | */ 174 | #define __RAM_FUNC HAL_StatusTypeDef 175 | 176 | #elif defined ( __ICCARM__ ) 177 | /* ICCARM Compiler 178 | --------------- 179 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 180 | */ 181 | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef 182 | 183 | #elif defined ( __GNUC__ ) 184 | /* GNU Compiler 185 | ------------ 186 | RAM functions are defined using a specific toolchain attribute 187 | "__attribute__((section(".RamFunc")))". 188 | */ 189 | #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc"))) 190 | 191 | #endif 192 | 193 | /** 194 | * @brief __NOINLINE definition 195 | */ 196 | #if defined ( __CC_ARM ) || defined ( __GNUC__ ) 197 | /* ARM & GNUCompiler 198 | ---------------- 199 | */ 200 | #define __NOINLINE __attribute__ ( (noinline) ) 201 | 202 | #elif defined ( __ICCARM__ ) 203 | /* ICCARM Compiler 204 | --------------- 205 | */ 206 | #define __NOINLINE _Pragma("optimize = no_inline") 207 | 208 | #endif 209 | 210 | #ifdef __cplusplus 211 | } 212 | #endif 213 | 214 | #endif /* ___STM32F1xx_HAL_DEF */ 215 | 216 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 217 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_gpio_ex.c 4 | * @author MCD Application Team 5 | * @version V1.1.1 6 | * @date 12-May-2017 7 | * @brief GPIO Extension HAL module driver. 8 | * This file provides firmware functions to manage the following 9 | * functionalities of the General Purpose Input/Output (GPIO) extension peripheral. 10 | * + Extended features functions 11 | * 12 | @verbatim 13 | ============================================================================== 14 | ##### GPIO Peripheral extension features ##### 15 | ============================================================================== 16 | [..] GPIO module on STM32F1 family, manage also the AFIO register: 17 | (+) Possibility to use the EVENTOUT Cortex feature 18 | 19 | ##### How to use this driver ##### 20 | ============================================================================== 21 | [..] This driver provides functions to use EVENTOUT Cortex feature 22 | (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 23 | (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 24 | (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 25 | 26 | @endverbatim 27 | ****************************************************************************** 28 | * @attention 29 | * 30 | *

© COPYRIGHT(c) 2016 STMicroelectronics

31 | * 32 | * Redistribution and use in source and binary forms, with or without modification, 33 | * are permitted provided that the following conditions are met: 34 | * 1. Redistributions of source code must retain the above copyright notice, 35 | * this list of conditions and the following disclaimer. 36 | * 2. Redistributions in binary form must reproduce the above copyright notice, 37 | * this list of conditions and the following disclaimer in the documentation 38 | * and/or other materials provided with the distribution. 39 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 40 | * may be used to endorse or promote products derived from this software 41 | * without specific prior written permission. 42 | * 43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 44 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 46 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 49 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 50 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 51 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 | * 54 | ****************************************************************************** 55 | */ 56 | 57 | /* Includes ------------------------------------------------------------------*/ 58 | #include "stm32f1xx_hal.h" 59 | 60 | /** @addtogroup STM32F1xx_HAL_Driver 61 | * @{ 62 | */ 63 | 64 | /** @defgroup GPIOEx GPIOEx 65 | * @brief GPIO HAL module driver 66 | * @{ 67 | */ 68 | 69 | #ifdef HAL_GPIO_MODULE_ENABLED 70 | 71 | /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions 72 | * @{ 73 | */ 74 | 75 | /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions 76 | * @brief Extended features functions 77 | * 78 | @verbatim 79 | ============================================================================== 80 | ##### Extended features functions ##### 81 | ============================================================================== 82 | [..] This section provides functions allowing to: 83 | (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 84 | (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 85 | (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 86 | 87 | @endverbatim 88 | * @{ 89 | */ 90 | 91 | /** 92 | * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected. 93 | * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal. 94 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT. 95 | * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal. 96 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN. 97 | * @retval None 98 | */ 99 | void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource) 100 | { 101 | /* Verify the parameters */ 102 | assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource)); 103 | assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource)); 104 | 105 | /* Apply the new configuration */ 106 | MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT)|(AFIO_EVCR_PIN), (GPIO_PortSource)|(GPIO_PinSource)); 107 | } 108 | 109 | /** 110 | * @brief Enables the Event Output. 111 | * @retval None 112 | */ 113 | void HAL_GPIOEx_EnableEventout(void) 114 | { 115 | SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 116 | } 117 | 118 | /** 119 | * @brief Disables the Event Output. 120 | * @retval None 121 | */ 122 | void HAL_GPIOEx_DisableEventout(void) 123 | { 124 | CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 125 | } 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | #endif /* HAL_GPIO_MODULE_ENABLED */ 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /** 142 | * @} 143 | */ 144 | 145 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 146 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Inc/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | This file is part of the FreeRTOS distribution. 8 | 9 | FreeRTOS is free software; you can redistribute it and/or modify it under 10 | the terms of the GNU General Public License (version 2) as published by the 11 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 12 | 13 | *************************************************************************** 14 | >>! NOTE: The modification to the GPL is included to allow you to !<< 15 | >>! distribute a combined work that includes FreeRTOS without being !<< 16 | >>! obliged to provide the source code for proprietary components !<< 17 | >>! outside of the FreeRTOS kernel. !<< 18 | *************************************************************************** 19 | 20 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 | FOR A PARTICULAR PURPOSE. Full license text is available on the following 23 | link: http://www.freertos.org/a00114.html 24 | 25 | *************************************************************************** 26 | * * 27 | * FreeRTOS provides completely free yet professionally developed, * 28 | * robust, strictly quality controlled, supported, and cross * 29 | * platform software that is more than just the market leader, it * 30 | * is the industry's de facto standard. * 31 | * * 32 | * Help yourself get started quickly while simultaneously helping * 33 | * to support the FreeRTOS project by purchasing a FreeRTOS * 34 | * tutorial book, reference manual, or both: * 35 | * http://www.FreeRTOS.org/Documentation * 36 | * * 37 | *************************************************************************** 38 | 39 | http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading 40 | the FAQ page "My application does not run, what could be wrong?". Have you 41 | defined configASSERT()? 42 | 43 | http://www.FreeRTOS.org/support - In return for receiving this top quality 44 | embedded software for free we request you assist our global community by 45 | participating in the support forum. 46 | 47 | http://www.FreeRTOS.org/training - Investing in training allows your team to 48 | be as productive as possible as early as possible. Now you can receive 49 | FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers 50 | Ltd, and the world's leading authority on the world's leading RTOS. 51 | 52 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 53 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 54 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 55 | 56 | http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. 57 | Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. 58 | 59 | http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High 60 | Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS 61 | licenses offer ticketed support, indemnification and commercial middleware. 62 | 63 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 64 | engineered and independently SIL3 certified version for use in safety and 65 | mission critical applications that require provable dependability. 66 | 67 | 1 tab == 4 spaces! 68 | */ 69 | 70 | #ifndef FREERTOS_CONFIG_H 71 | #define FREERTOS_CONFIG_H 72 | 73 | /*----------------------------------------------------------- 74 | * Application specific definitions. 75 | * 76 | * These definitions should be adjusted for your particular hardware and 77 | * application requirements. 78 | * 79 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE 80 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. 81 | * 82 | * See http://www.freertos.org/a00110.html. 83 | *----------------------------------------------------------*/ 84 | 85 | /* USER CODE BEGIN Includes */ 86 | /* Section where include file can be added */ 87 | /* USER CODE END Includes */ 88 | 89 | /* Ensure stdint is only used by the compiler, and not the assembler. */ 90 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 91 | #include 92 | #include "main.h" 93 | extern uint32_t SystemCoreClock; 94 | #endif 95 | 96 | #define configUSE_PREEMPTION 1 97 | #define configSUPPORT_STATIC_ALLOCATION 0 98 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 99 | #define configUSE_IDLE_HOOK 0 100 | #define configUSE_TICK_HOOK 0 101 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 102 | #define configTICK_RATE_HZ ((TickType_t)1000) 103 | #define configMAX_PRIORITIES ( 7 ) 104 | #define configMINIMAL_STACK_SIZE ((uint16_t)128) 105 | #define configTOTAL_HEAP_SIZE ((size_t)3072) 106 | #define configMAX_TASK_NAME_LEN ( 16 ) 107 | #define configUSE_16_BIT_TICKS 0 108 | #define configUSE_MUTEXES 1 109 | #define configQUEUE_REGISTRY_SIZE 8 110 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 111 | 112 | /* Co-routine definitions. */ 113 | #define configUSE_CO_ROUTINES 0 114 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 115 | 116 | /* Set the following definitions to 1 to include the API function, or zero 117 | to exclude the API function. */ 118 | #define INCLUDE_vTaskPrioritySet 1 119 | #define INCLUDE_uxTaskPriorityGet 1 120 | #define INCLUDE_vTaskDelete 1 121 | #define INCLUDE_vTaskCleanUpResources 0 122 | #define INCLUDE_vTaskSuspend 1 123 | #define INCLUDE_vTaskDelayUntil 0 124 | #define INCLUDE_vTaskDelay 1 125 | #define INCLUDE_xTaskGetSchedulerState 1 126 | 127 | /* Cortex-M specific definitions. */ 128 | #ifdef __NVIC_PRIO_BITS 129 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 130 | #define configPRIO_BITS __NVIC_PRIO_BITS 131 | #else 132 | #define configPRIO_BITS 4 133 | #endif 134 | 135 | /* The lowest interrupt priority that can be used in a call to a "set priority" 136 | function. */ 137 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 138 | 139 | /* The highest interrupt priority that can be used by any interrupt service 140 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 141 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 142 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 143 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 144 | 145 | /* Interrupt priorities used by the kernel port layer itself. These are generic 146 | to all Cortex-M ports, and do not rely on any particular library functions. */ 147 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 148 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 149 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 150 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 151 | 152 | /* Normal assert() semantics without relying on the provision of an assert.h 153 | header file. */ 154 | /* USER CODE BEGIN 1 */ 155 | #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} 156 | /* USER CODE END 1 */ 157 | 158 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 159 | standard names. */ 160 | #define vPortSVCHandler SVC_Handler 161 | #define xPortPendSVHandler PendSV_Handler 162 | 163 | /* IMPORTANT: This define MUST be commented when used with STM32Cube firmware, 164 | to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 165 | /* #define xPortSysTickHandler SysTick_Handler */ 166 | 167 | /* USER CODE BEGIN Defines */ 168 | /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ 169 | /* USER CODE END Defines */ 170 | 171 | #endif /* FREERTOS_CONFIG_H */ 172 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Inc/main.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * File Name : main.h 4 | * Description : This file contains the common defines of the application 5 | ****************************************************************************** 6 | * This notice applies to any and all portions of this file 7 | * that are not between comment pairs USER CODE BEGIN and 8 | * USER CODE END. Other portions of this file, whether 9 | * inserted by the user or by software development tools 10 | * are owned by their respective copyright owners. 11 | * 12 | * Copyright (c) 2017 STMicroelectronics International N.V. 13 | * All rights reserved. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted, provided that the following conditions are met: 17 | * 18 | * 1. Redistribution of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. Neither the name of STMicroelectronics nor the names of other 24 | * contributors to this software may be used to endorse or promote products 25 | * derived from this software without specific written permission. 26 | * 4. This software, including modifications and/or derivative works of this 27 | * software, must execute solely and exclusively on microcontroller or 28 | * microprocessor devices manufactured by or for STMicroelectronics. 29 | * 5. Redistribution and use of this software other than as permitted under 30 | * this license is void and will automatically terminate your rights under 31 | * this license. 32 | * 33 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 34 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 36 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 37 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 38 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 39 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 41 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 42 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 43 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 44 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 | * 46 | ****************************************************************************** 47 | */ 48 | /* Define to prevent recursive inclusion -------------------------------------*/ 49 | #ifndef __MAIN_H 50 | #define __MAIN_H 51 | /* Includes ------------------------------------------------------------------*/ 52 | 53 | /* USER CODE BEGIN Includes */ 54 | 55 | /* USER CODE END Includes */ 56 | 57 | /* Private define ------------------------------------------------------------*/ 58 | 59 | /* USER CODE BEGIN Private defines */ 60 | 61 | /* USER CODE END Private defines */ 62 | 63 | void _Error_Handler(char *, int); 64 | 65 | #define Error_Handler() _Error_Handler(__FILE__, __LINE__) 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /* __MAIN_H */ 76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_it.h 4 | * @brief This file contains the headers of the interrupt handlers. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2017 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Define to prevent recursive inclusion -------------------------------------*/ 35 | #ifndef __STM32F1xx_IT_H 36 | #define __STM32F1xx_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | #include "stm32f1xx_hal.h" 44 | #include "main.h" 45 | /* Exported types ------------------------------------------------------------*/ 46 | /* Exported constants --------------------------------------------------------*/ 47 | /* Exported macro ------------------------------------------------------------*/ 48 | /* Exported functions ------------------------------------------------------- */ 49 | 50 | void NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void MemManage_Handler(void); 53 | void BusFault_Handler(void); 54 | void UsageFault_Handler(void); 55 | void DebugMon_Handler(void); 56 | void SysTick_Handler(void); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* __STM32F1xx_IT_H */ 63 | 64 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 65 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOSConfig_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | This file is part of the FreeRTOS distribution. 8 | 9 | FreeRTOS is free software; you can redistribute it and/or modify it under 10 | the terms of the GNU General Public License (version 2) as published by the 11 | Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. 12 | 13 | *************************************************************************** 14 | >>! NOTE: The modification to the GPL is included to allow you to !<< 15 | >>! distribute a combined work that includes FreeRTOS without being !<< 16 | >>! obliged to provide the source code for proprietary components !<< 17 | >>! outside of the FreeRTOS kernel. !<< 18 | *************************************************************************** 19 | 20 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 | FOR A PARTICULAR PURPOSE. Full license text is available on the following 23 | link: http://www.freertos.org/a00114.html 24 | 25 | *************************************************************************** 26 | * * 27 | * FreeRTOS provides completely free yet professionally developed, * 28 | * robust, strictly quality controlled, supported, and cross * 29 | * platform software that is more than just the market leader, it * 30 | * is the industry's de facto standard. * 31 | * * 32 | * Help yourself get started quickly while simultaneously helping * 33 | * to support the FreeRTOS project by purchasing a FreeRTOS * 34 | * tutorial book, reference manual, or both: * 35 | * http://www.FreeRTOS.org/Documentation * 36 | * * 37 | *************************************************************************** 38 | 39 | http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading 40 | the FAQ page "My application does not run, what could be wrong?". Have you 41 | defined configASSERT()? 42 | 43 | http://www.FreeRTOS.org/support - In return for receiving this top quality 44 | embedded software for free we request you assist our global community by 45 | participating in the support forum. 46 | 47 | http://www.FreeRTOS.org/training - Investing in training allows your team to 48 | be as productive as possible as early as possible. Now you can receive 49 | FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers 50 | Ltd, and the world's leading authority on the world's leading RTOS. 51 | 52 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 53 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 54 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 55 | 56 | http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. 57 | Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. 58 | 59 | http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High 60 | Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS 61 | licenses offer ticketed support, indemnification and commercial middleware. 62 | 63 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 64 | engineered and independently SIL3 certified version for use in safety and 65 | mission critical applications that require provable dependability. 66 | 67 | 1 tab == 4 spaces! 68 | */ 69 | 70 | 71 | #ifndef FREERTOS_CONFIG_H 72 | #define FREERTOS_CONFIG_H 73 | 74 | /*----------------------------------------------------------- 75 | * Application specific definitions. 76 | * 77 | * These definitions should be adjusted for your particular hardware and 78 | * application requirements. 79 | * 80 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE 81 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. 82 | * 83 | * See http://www.freertos.org/a00110.html. 84 | *----------------------------------------------------------*/ 85 | 86 | /* Ensure stdint is only used by the compiler, and not the assembler. */ 87 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 88 | #include 89 | extern uint32_t SystemCoreClock; 90 | #endif 91 | 92 | #define configUSE_PREEMPTION 1 93 | #define configUSE_IDLE_HOOK 0 94 | #define configUSE_TICK_HOOK 0 95 | #define configCPU_CLOCK_HZ (SystemCoreClock) 96 | #define configTICK_RATE_HZ ((TickType_t)1000) 97 | #define configMAX_PRIORITIES (7) 98 | #define configMINIMAL_STACK_SIZE ((uint16_t)128) 99 | #define configTOTAL_HEAP_SIZE ((size_t)(15 * 1024)) 100 | #define configMAX_TASK_NAME_LEN (16) 101 | #define configUSE_TRACE_FACILITY 1 102 | #define configUSE_16_BIT_TICKS 0 103 | #define configIDLE_SHOULD_YIELD 1 104 | #define configUSE_MUTEXES 1 105 | #define configQUEUE_REGISTRY_SIZE 8 106 | #define configCHECK_FOR_STACK_OVERFLOW 0 107 | #define configUSE_RECURSIVE_MUTEXES 1 108 | #define configUSE_MALLOC_FAILED_HOOK 0 109 | #define configUSE_APPLICATION_TASK_TAG 0 110 | #define configUSE_COUNTING_SEMAPHORES 1 111 | #define configGENERATE_RUN_TIME_STATS 0 112 | 113 | /* Co-routine definitions. */ 114 | #define configUSE_CO_ROUTINES 0 115 | #define configMAX_CO_ROUTINE_PRIORITIES (2) 116 | 117 | /* Software timer definitions. */ 118 | #define configUSE_TIMERS 0 119 | #define configTIMER_TASK_PRIORITY (2) 120 | #define configTIMER_QUEUE_LENGTH 10 121 | #define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) 122 | 123 | /* Set the following definitions to 1 to include the API function, or zero 124 | to exclude the API function. */ 125 | #define INCLUDE_vTaskPrioritySet 1 126 | #define INCLUDE_uxTaskPriorityGet 1 127 | #define INCLUDE_vTaskDelete 1 128 | #define INCLUDE_vTaskCleanUpResources 0 129 | #define INCLUDE_vTaskSuspend 1 130 | #define INCLUDE_vTaskDelayUntil 0 131 | #define INCLUDE_vTaskDelay 1 132 | #define INCLUDE_xTaskGetSchedulerState 1 133 | 134 | /* Cortex-M specific definitions. */ 135 | #ifdef __NVIC_PRIO_BITS 136 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 137 | #define configPRIO_BITS __NVIC_PRIO_BITS 138 | #else 139 | #define configPRIO_BITS 4 /* 15 priority levels */ 140 | #endif 141 | 142 | /* The lowest interrupt priority that can be used in a call to a "set priority" 143 | function. */ 144 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf 145 | 146 | /* The highest interrupt priority that can be used by any interrupt service 147 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 148 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 149 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 150 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 151 | 152 | /* Interrupt priorities used by the kernel port layer itself. These are generic 153 | to all Cortex-M ports, and do not rely on any particular library functions. */ 154 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 155 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 156 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 157 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 158 | 159 | /* Normal assert() semantics without relying on the provision of an assert.h 160 | header file. */ 161 | #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } 162 | 163 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 164 | standard names. */ 165 | #define vPortSVCHandler SVC_Handler 166 | #define xPortPendSVHandler PendSV_Handler 167 | 168 | /* IMPORTANT: This define MUST be commented when used with STM32Cube firmware, 169 | to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 170 | /* #define xPortSysTickHandler SysTick_Handler */ 171 | 172 | #endif /* FREERTOS_CONFIG_H */ 173 | 174 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | This file is part of the FreeRTOS distribution. 8 | 9 | FreeRTOS is free software; you can redistribute it and/or modify it under 10 | the terms of the GNU General Public License (version 2) as published by the 11 | Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. 12 | 13 | *************************************************************************** 14 | >>! NOTE: The modification to the GPL is included to allow you to !<< 15 | >>! distribute a combined work that includes FreeRTOS without being !<< 16 | >>! obliged to provide the source code for proprietary components !<< 17 | >>! outside of the FreeRTOS kernel. !<< 18 | *************************************************************************** 19 | 20 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 | FOR A PARTICULAR PURPOSE. Full license text is available on the following 23 | link: http://www.freertos.org/a00114.html 24 | 25 | *************************************************************************** 26 | * * 27 | * FreeRTOS provides completely free yet professionally developed, * 28 | * robust, strictly quality controlled, supported, and cross * 29 | * platform software that is more than just the market leader, it * 30 | * is the industry's de facto standard. * 31 | * * 32 | * Help yourself get started quickly while simultaneously helping * 33 | * to support the FreeRTOS project by purchasing a FreeRTOS * 34 | * tutorial book, reference manual, or both: * 35 | * http://www.FreeRTOS.org/Documentation * 36 | * * 37 | *************************************************************************** 38 | 39 | http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading 40 | the FAQ page "My application does not run, what could be wrong?". Have you 41 | defined configASSERT()? 42 | 43 | http://www.FreeRTOS.org/support - In return for receiving this top quality 44 | embedded software for free we request you assist our global community by 45 | participating in the support forum. 46 | 47 | http://www.FreeRTOS.org/training - Investing in training allows your team to 48 | be as productive as possible as early as possible. Now you can receive 49 | FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers 50 | Ltd, and the world's leading authority on the world's leading RTOS. 51 | 52 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 53 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 54 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 55 | 56 | http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. 57 | Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. 58 | 59 | http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High 60 | Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS 61 | licenses offer ticketed support, indemnification and commercial middleware. 62 | 63 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 64 | engineered and independently SIL3 certified version for use in safety and 65 | mission critical applications that require provable dependability. 66 | 67 | 1 tab == 4 spaces! 68 | */ 69 | 70 | #ifndef STACK_MACROS_H 71 | #define STACK_MACROS_H 72 | 73 | /* 74 | * Call the stack overflow hook function if the stack of the task being swapped 75 | * out is currently overflowed, or looks like it might have overflowed in the 76 | * past. 77 | * 78 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 79 | * the current stack state only - comparing the current top of stack value to 80 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 81 | * will also cause the last few stack bytes to be checked to ensure the value 82 | * to which the bytes were set when the task was created have not been 83 | * overwritten. Note this second test does not guarantee that an overflowed 84 | * stack will always be recognised. 85 | */ 86 | 87 | /*-----------------------------------------------------------*/ 88 | 89 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 90 | 91 | /* Only the current stack state is to be checked. */ 92 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 93 | { \ 94 | /* Is the currently saved stack pointer within the stack limit? */ \ 95 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 96 | { \ 97 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 98 | } \ 99 | } 100 | 101 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 102 | /*-----------------------------------------------------------*/ 103 | 104 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 105 | 106 | /* Only the current stack state is to be checked. */ 107 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 108 | { \ 109 | \ 110 | /* Is the currently saved stack pointer within the stack limit? */ \ 111 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 112 | { \ 113 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 114 | } \ 115 | } 116 | 117 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 118 | /*-----------------------------------------------------------*/ 119 | 120 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 121 | 122 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 123 | { \ 124 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 125 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 126 | \ 127 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 128 | ( pulStack[ 1 ] != ulCheckValue ) || \ 129 | ( pulStack[ 2 ] != ulCheckValue ) || \ 130 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 131 | { \ 132 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 133 | } \ 134 | } 135 | 136 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 137 | /*-----------------------------------------------------------*/ 138 | 139 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 140 | 141 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 142 | { \ 143 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 144 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 145 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 146 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 147 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 148 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 149 | \ 150 | \ 151 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 152 | \ 153 | /* Has the extremity of the task stack ever been written over? */ \ 154 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 155 | { \ 156 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 157 | } \ 158 | } 159 | 160 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 161 | /*-----------------------------------------------------------*/ 162 | 163 | /* Remove stack overflow macro if not being used. */ 164 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 165 | #define taskCHECK_FOR_STACK_OVERFLOW() 166 | #endif 167 | 168 | 169 | 170 | #endif /* STACK_MACROS_H */ 171 | 172 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | This file is part of the FreeRTOS distribution. 8 | 9 | FreeRTOS is free software; you can redistribute it and/or modify it under 10 | the terms of the GNU General Public License (version 2) as published by the 11 | Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. 12 | 13 | *************************************************************************** 14 | >>! NOTE: The modification to the GPL is included to allow you to !<< 15 | >>! distribute a combined work that includes FreeRTOS without being !<< 16 | >>! obliged to provide the source code for proprietary components !<< 17 | >>! outside of the FreeRTOS kernel. !<< 18 | *************************************************************************** 19 | 20 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 | FOR A PARTICULAR PURPOSE. Full license text is available on the following 23 | link: http://www.freertos.org/a00114.html 24 | 25 | *************************************************************************** 26 | * * 27 | * FreeRTOS provides completely free yet professionally developed, * 28 | * robust, strictly quality controlled, supported, and cross * 29 | * platform software that is more than just the market leader, it * 30 | * is the industry's de facto standard. * 31 | * * 32 | * Help yourself get started quickly while simultaneously helping * 33 | * to support the FreeRTOS project by purchasing a FreeRTOS * 34 | * tutorial book, reference manual, or both: * 35 | * http://www.FreeRTOS.org/Documentation * 36 | * * 37 | *************************************************************************** 38 | 39 | http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading 40 | the FAQ page "My application does not run, what could be wrong?". Have you 41 | defined configASSERT()? 42 | 43 | http://www.FreeRTOS.org/support - In return for receiving this top quality 44 | embedded software for free we request you assist our global community by 45 | participating in the support forum. 46 | 47 | http://www.FreeRTOS.org/training - Investing in training allows your team to 48 | be as productive as possible as early as possible. Now you can receive 49 | FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers 50 | Ltd, and the world's leading authority on the world's leading RTOS. 51 | 52 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 53 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 54 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 55 | 56 | http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. 57 | Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. 58 | 59 | http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High 60 | Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS 61 | licenses offer ticketed support, indemnification and commercial middleware. 62 | 63 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 64 | engineered and independently SIL3 certified version for use in safety and 65 | mission critical applications that require provable dependability. 66 | 67 | 1 tab == 4 spaces! 68 | */ 69 | 70 | #ifndef PROJDEFS_H 71 | #define PROJDEFS_H 72 | 73 | /* 74 | * Defines the prototype to which task functions must conform. Defined in this 75 | * file to ensure the type is known before portable.h is included. 76 | */ 77 | typedef void (*TaskFunction_t)( void * ); 78 | 79 | /* Converts a time in milliseconds to a time in ticks. This macro can be 80 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the 81 | definition here is not suitable for your application. */ 82 | #ifndef pdMS_TO_TICKS 83 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) ) 84 | #endif 85 | 86 | #define pdFALSE ( ( BaseType_t ) 0 ) 87 | #define pdTRUE ( ( BaseType_t ) 1 ) 88 | 89 | #define pdPASS ( pdTRUE ) 90 | #define pdFAIL ( pdFALSE ) 91 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) 92 | #define errQUEUE_FULL ( ( BaseType_t ) 0 ) 93 | 94 | /* FreeRTOS error definitions. */ 95 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 96 | #define errQUEUE_BLOCKED ( -4 ) 97 | #define errQUEUE_YIELD ( -5 ) 98 | 99 | /* Macros used for basic data corruption checks. */ 100 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 101 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0 102 | #endif 103 | 104 | #if( configUSE_16_BIT_TICKS == 1 ) 105 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a 106 | #else 107 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL 108 | #endif 109 | 110 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS 111 | itself. */ 112 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ 113 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ 114 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ 115 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ 116 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ 117 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ 118 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ 119 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ 120 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ 121 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ 122 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ 123 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ 124 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ 125 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ 126 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ 127 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ 128 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ 129 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ 130 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ 131 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ 132 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ 133 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ 134 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ 135 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ 136 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ 137 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ 138 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ 139 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 140 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ 141 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ 142 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ 143 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ 144 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ 145 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ 146 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ 147 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ 148 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ 149 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ 150 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ 151 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ 152 | 153 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS 154 | itself. */ 155 | #define pdFREERTOS_LITTLE_ENDIAN 0 156 | #define pdFREERTOS_BIG_ENDIAN 1 157 | 158 | #endif /* PROJDEFS_H */ 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/STM32F103C8T6 Run.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32F103C8T6 board with a single STM32F103C8Tx chip 2 | # 3 | # Generated by System Workbench for STM32 4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s) 5 | 6 | source [find interface/stlink.cfg] 7 | 8 | set WORKAREASIZE 0x5000 9 | 10 | transport select "hla_swd" 11 | 12 | set CHIPNAME STM32F103C8Tx 13 | 14 | # Enable debug when in low power modes 15 | set ENABLE_LOW_POWER 1 16 | 17 | # Stop Watchdog counters when halt 18 | set STOP_WATCHDOG 1 19 | 20 | # STlink Debug clock frequency 21 | set CLOCK_FREQ 4000 22 | 23 | # use hardware reset, connect under reset 24 | # connect_assert_srst needed if low power mode application running (WFI...) 25 | # reset_config srst_only srst_nogate connect_assert_srst 26 | reset_config none 27 | set CONNECT_UNDER_RESET 1 28 | 29 | source [find target/stm32f1x.cfg] 30 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/STM32F103C8T6.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | FREERTOS.IPParameters=Tasks01 3 | FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default,NULL 4 | File.Version=6 5 | KeepUserPlacement=false 6 | Mcu.Family=STM32F1 7 | Mcu.IP0=FREERTOS 8 | Mcu.IP1=NVIC 9 | Mcu.IP2=RCC 10 | Mcu.IP3=SYS 11 | Mcu.IPNb=4 12 | Mcu.Name=STM32F103C(8-B)Tx 13 | Mcu.Package=LQFP48 14 | Mcu.Pin0=PD0-OSC_IN 15 | Mcu.Pin1=PD1-OSC_OUT 16 | Mcu.Pin2=PB1 17 | Mcu.Pin3=PB11 18 | Mcu.Pin4=PB14 19 | Mcu.Pin5=PB15 20 | Mcu.Pin6=PA8 21 | Mcu.Pin7=VP_FREERTOS_VS_ENABLE 22 | Mcu.Pin8=VP_SYS_VS_ND 23 | Mcu.Pin9=VP_SYS_VS_Systick 24 | Mcu.PinsNb=10 25 | Mcu.UserConstants= 26 | Mcu.UserName=STM32F103C8Tx 27 | MxCube.Version=4.22.1 28 | MxDb.Version=DB.4.0.221 29 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 30 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false 31 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 32 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false 33 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false 34 | NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false 35 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 36 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false 37 | NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false 38 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 39 | PA8.Mode=Clock-out 40 | PA8.Signal=RCC_MCO 41 | PB1.Locked=true 42 | PB1.Signal=GPIO_Output 43 | PB11.Locked=true 44 | PB11.Signal=GPIO_Output 45 | PB14.Locked=true 46 | PB14.Signal=GPIO_Output 47 | PB15.Locked=true 48 | PB15.Signal=GPIO_Output 49 | PCC.Checker=false 50 | PCC.Line=STM32F103 51 | PCC.MCU=STM32F103C(8-B)Tx 52 | PCC.PartNumber=STM32F103C8Tx 53 | PCC.Seq0=0 54 | PCC.Series=STM32F1 55 | PCC.Temperature=25 56 | PCC.Vdd=3.3 57 | PD0-OSC_IN.Mode=HSE-External-Oscillator 58 | PD0-OSC_IN.Signal=RCC_OSC_IN 59 | PD1-OSC_OUT.Mode=HSE-External-Oscillator 60 | PD1-OSC_OUT.Signal=RCC_OSC_OUT 61 | PinOutPanel.RotationAngle=0 62 | ProjectManager.AskForMigrate=true 63 | ProjectManager.BackupPrevious=false 64 | ProjectManager.CompilerOptimize=2 65 | ProjectManager.ComputerToolchain=false 66 | ProjectManager.CoupleFile=false 67 | ProjectManager.CustomerFirmwarePackage=C\:/Users/aplex/STM32Cube/Repository/STM32Cube_FW_F1_V1.6.0 68 | ProjectManager.DefaultFWLocation=true 69 | ProjectManager.DeletePrevious=true 70 | ProjectManager.DeviceId=STM32F103C8Tx 71 | ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.6.0 72 | ProjectManager.FreePins=false 73 | ProjectManager.HalAssertFull=false 74 | ProjectManager.HeapSize=0x200 75 | ProjectManager.KeepUserCode=true 76 | ProjectManager.LastFirmware=true 77 | ProjectManager.LibraryCopy=1 78 | ProjectManager.PreviousToolchain=SW4STM32 79 | ProjectManager.ProjectBuild=false 80 | ProjectManager.ProjectFileName=STM32F103C8T6.ioc 81 | ProjectManager.ProjectName=STM32F103C8T6 82 | ProjectManager.StackSize=0x400 83 | ProjectManager.TargetToolchain=SW4STM32 84 | ProjectManager.ToolChainLocation= 85 | ProjectManager.UnderRoot=true 86 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-SystemClock_Config-RCC-false-HAL 87 | RCC.ADCFreqValue=36000000 88 | RCC.AHBFreq_Value=72000000 89 | RCC.APB1CLKDivider=RCC_HCLK_DIV2 90 | RCC.APB1Freq_Value=36000000 91 | RCC.APB1TimFreq_Value=72000000 92 | RCC.APB2Freq_Value=72000000 93 | RCC.APB2TimFreq_Value=72000000 94 | RCC.FCLKCortexFreq_Value=72000000 95 | RCC.FamilyName=M 96 | RCC.HCLKFreq_Value=72000000 97 | RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,RCC_MCOSource,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value 98 | RCC.MCOFreq_Value=36000000 99 | RCC.PLLCLKFreq_Value=72000000 100 | RCC.PLLMCOFreq_Value=36000000 101 | RCC.PLLMUL=RCC_PLL_MUL9 102 | RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE 103 | RCC.RCC_MCOSource=RCC_MCO1SOURCE_PLLCLK 104 | RCC.SYSCLKFreq_VALUE=72000000 105 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK 106 | RCC.TimSysFreq_Value=72000000 107 | RCC.USBFreq_Value=72000000 108 | RCC.VCOOutput2Freq_Value=8000000 109 | VP_FREERTOS_VS_ENABLE.Mode=Enabled 110 | VP_FREERTOS_VS_ENABLE.Signal=FREERTOS_VS_ENABLE 111 | VP_SYS_VS_ND.Mode=No_Debug 112 | VP_SYS_VS_ND.Signal=SYS_VS_ND 113 | VP_SYS_VS_Systick.Mode=SysTick 114 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 115 | board=STM32F103C8T6 116 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/STM32F103C8T6.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ]> 11 | 12 | 13 | 14 | STM32F103C8T6 15 | SWD 16 | ST-Link 17 | stm32f103c8tx 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/STM32F103C8Tx_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Abstract : Linker script for STM32F103C8Tx Device with 8 | ** 64KByte FLASH, 20KByte RAM 9 | ** 10 | ** Set heap size, stack size and stack location according 11 | ** to application requirements. 12 | ** 13 | ** Set memory bank area and size if external memory is used. 14 | ** 15 | ** Target : STMicroelectronics STM32 16 | ** 17 | ** 18 | ** Distribution: The file is distributed as is, without any warranty 19 | ** of any kind. 20 | ** 21 | ** (c)Copyright Ac6. 22 | ** You may use this file as-is or modify it according to the needs of your 23 | ** project. Distribution of this file (unmodified or modified) is not 24 | ** permitted. Ac6 permit registered System Workbench for MCU users the 25 | ** rights to distribute the assembled, compiled & linked contents of this 26 | ** file as part of an application binary file, provided that it is built 27 | ** using the System Workbench for MCU toolchain. 28 | ** 29 | ***************************************************************************** 30 | */ 31 | 32 | /* Entry Point */ 33 | ENTRY(Reset_Handler) 34 | 35 | /* Highest address of the user mode stack */ 36 | _estack = 0x20005000; /* end of RAM */ 37 | /* Generate a link error if heap and stack don't fit into RAM */ 38 | _Min_Heap_Size = 0x200; /* required amount of heap */ 39 | _Min_Stack_Size = 0x400; /* required amount of stack */ 40 | 41 | /* Specify the memory areas */ 42 | MEMORY 43 | { 44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K 45 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K 46 | } 47 | 48 | /* Define output sections */ 49 | SECTIONS 50 | { 51 | /* The startup code goes first into FLASH */ 52 | .isr_vector : 53 | { 54 | . = ALIGN(4); 55 | KEEP(*(.isr_vector)) /* Startup code */ 56 | . = ALIGN(4); 57 | } >FLASH 58 | 59 | /* The program code and other data goes into FLASH */ 60 | .text : 61 | { 62 | . = ALIGN(4); 63 | *(.text) /* .text sections (code) */ 64 | *(.text*) /* .text* sections (code) */ 65 | *(.glue_7) /* glue arm to thumb code */ 66 | *(.glue_7t) /* glue thumb to arm code */ 67 | *(.eh_frame) 68 | 69 | KEEP (*(.init)) 70 | KEEP (*(.fini)) 71 | 72 | . = ALIGN(4); 73 | _etext = .; /* define a global symbols at end of code */ 74 | } >FLASH 75 | 76 | /* Constant data goes into FLASH */ 77 | .rodata : 78 | { 79 | . = ALIGN(4); 80 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 81 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 82 | . = ALIGN(4); 83 | } >FLASH 84 | 85 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 86 | .ARM : { 87 | __exidx_start = .; 88 | *(.ARM.exidx*) 89 | __exidx_end = .; 90 | } >FLASH 91 | 92 | .preinit_array : 93 | { 94 | PROVIDE_HIDDEN (__preinit_array_start = .); 95 | KEEP (*(.preinit_array*)) 96 | PROVIDE_HIDDEN (__preinit_array_end = .); 97 | } >FLASH 98 | .init_array : 99 | { 100 | PROVIDE_HIDDEN (__init_array_start = .); 101 | KEEP (*(SORT(.init_array.*))) 102 | KEEP (*(.init_array*)) 103 | PROVIDE_HIDDEN (__init_array_end = .); 104 | } >FLASH 105 | .fini_array : 106 | { 107 | PROVIDE_HIDDEN (__fini_array_start = .); 108 | KEEP (*(SORT(.fini_array.*))) 109 | KEEP (*(.fini_array*)) 110 | PROVIDE_HIDDEN (__fini_array_end = .); 111 | } >FLASH 112 | 113 | /* used by the startup to initialize data */ 114 | _sidata = LOADADDR(.data); 115 | 116 | /* Initialized data sections goes into RAM, load LMA copy after code */ 117 | .data : 118 | { 119 | . = ALIGN(4); 120 | _sdata = .; /* create a global symbol at data start */ 121 | *(.data) /* .data sections */ 122 | *(.data*) /* .data* sections */ 123 | 124 | . = ALIGN(4); 125 | _edata = .; /* define a global symbol at data end */ 126 | } >RAM AT> FLASH 127 | 128 | 129 | /* Uninitialized data section */ 130 | . = ALIGN(4); 131 | .bss : 132 | { 133 | /* This is used by the startup in order to initialize the .bss secion */ 134 | _sbss = .; /* define a global symbol at bss start */ 135 | __bss_start__ = _sbss; 136 | *(.bss) 137 | *(.bss*) 138 | *(COMMON) 139 | 140 | . = ALIGN(4); 141 | _ebss = .; /* define a global symbol at bss end */ 142 | __bss_end__ = _ebss; 143 | } >RAM 144 | 145 | /* User_heap_stack section, used to check that there is enough RAM left */ 146 | ._user_heap_stack : 147 | { 148 | . = ALIGN(8); 149 | PROVIDE ( end = . ); 150 | PROVIDE ( _end = . ); 151 | . = . + _Min_Heap_Size; 152 | . = . + _Min_Stack_Size; 153 | . = ALIGN(8); 154 | } >RAM 155 | 156 | 157 | 158 | /* Remove information from the standard libraries */ 159 | /DISCARD/ : 160 | { 161 | libc.a ( * ) 162 | libm.a ( * ) 163 | libgcc.a ( * ) 164 | } 165 | 166 | .ARM.attributes 0 : { *(.ARM.attributes) } 167 | } 168 | 169 | 170 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Src/freertos.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * File Name : freertos.c 4 | * Description : Code for freertos applications 5 | ****************************************************************************** 6 | * This notice applies to any and all portions of this file 7 | * that are not between comment pairs USER CODE BEGIN and 8 | * USER CODE END. Other portions of this file, whether 9 | * inserted by the user or by software development tools 10 | * are owned by their respective copyright owners. 11 | * 12 | * Copyright (c) 2017 STMicroelectronics International N.V. 13 | * All rights reserved. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted, provided that the following conditions are met: 17 | * 18 | * 1. Redistribution of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. Neither the name of STMicroelectronics nor the names of other 24 | * contributors to this software may be used to endorse or promote products 25 | * derived from this software without specific written permission. 26 | * 4. This software, including modifications and/or derivative works of this 27 | * software, must execute solely and exclusively on microcontroller or 28 | * microprocessor devices manufactured by or for STMicroelectronics. 29 | * 5. Redistribution and use of this software other than as permitted under 30 | * this license is void and will automatically terminate your rights under 31 | * this license. 32 | * 33 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 34 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 36 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 37 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 38 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 39 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 41 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 42 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 43 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 44 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 | * 46 | ****************************************************************************** 47 | */ 48 | 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "FreeRTOS.h" 51 | #include "task.h" 52 | 53 | /* USER CODE BEGIN Includes */ 54 | 55 | /* USER CODE END Includes */ 56 | 57 | /* Variables -----------------------------------------------------------------*/ 58 | 59 | /* USER CODE BEGIN Variables */ 60 | 61 | /* USER CODE END Variables */ 62 | 63 | /* Function prototypes -------------------------------------------------------*/ 64 | 65 | /* USER CODE BEGIN FunctionPrototypes */ 66 | 67 | /* USER CODE END FunctionPrototypes */ 68 | 69 | /* Hook prototypes */ 70 | 71 | /* USER CODE BEGIN Application */ 72 | 73 | /* USER CODE END Application */ 74 | 75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 76 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Src/stm32f1xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * File Name : stm32f1xx_hal_msp.c 4 | * Description : This file provides code for the MSP Initialization 5 | * and de-Initialization codes. 6 | ****************************************************************************** 7 | * This notice applies to any and all portions of this file 8 | * that are not between comment pairs USER CODE BEGIN and 9 | * USER CODE END. Other portions of this file, whether 10 | * inserted by the user or by software development tools 11 | * are owned by their respective copyright owners. 12 | * 13 | * Copyright (c) 2017 STMicroelectronics International N.V. 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted, provided that the following conditions are met: 18 | * 19 | * 1. Redistribution of source code must retain the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright notice, 22 | * this list of conditions and the following disclaimer in the documentation 23 | * and/or other materials provided with the distribution. 24 | * 3. Neither the name of STMicroelectronics nor the names of other 25 | * contributors to this software may be used to endorse or promote products 26 | * derived from this software without specific written permission. 27 | * 4. This software, including modifications and/or derivative works of this 28 | * software, must execute solely and exclusively on microcontroller or 29 | * microprocessor devices manufactured by or for STMicroelectronics. 30 | * 5. Redistribution and use of this software other than as permitted under 31 | * this license is void and will automatically terminate your rights under 32 | * this license. 33 | * 34 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 35 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 37 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 38 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 39 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 40 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 42 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 43 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 44 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * 47 | ****************************************************************************** 48 | */ 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "stm32f1xx_hal.h" 51 | 52 | extern void _Error_Handler(char *, int); 53 | /* USER CODE BEGIN 0 */ 54 | 55 | /* USER CODE END 0 */ 56 | /** 57 | * Initializes the Global MSP. 58 | */ 59 | void HAL_MspInit(void) 60 | { 61 | /* USER CODE BEGIN MspInit 0 */ 62 | 63 | /* USER CODE END MspInit 0 */ 64 | 65 | __HAL_RCC_AFIO_CLK_ENABLE(); 66 | 67 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); 68 | 69 | /* System interrupt init*/ 70 | /* MemoryManagement_IRQn interrupt configuration */ 71 | HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0); 72 | /* BusFault_IRQn interrupt configuration */ 73 | HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0); 74 | /* UsageFault_IRQn interrupt configuration */ 75 | HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0); 76 | /* SVCall_IRQn interrupt configuration */ 77 | HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0); 78 | /* DebugMonitor_IRQn interrupt configuration */ 79 | HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0); 80 | /* PendSV_IRQn interrupt configuration */ 81 | HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0); 82 | /* SysTick_IRQn interrupt configuration */ 83 | HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0); 84 | 85 | /**DISABLE: JTAG-DP Disabled and SW-DP Disabled 86 | */ 87 | __HAL_AFIO_REMAP_SWJ_DISABLE(); 88 | 89 | /* USER CODE BEGIN MspInit 1 */ 90 | 91 | /* USER CODE END MspInit 1 */ 92 | } 93 | 94 | /* USER CODE BEGIN 1 */ 95 | 96 | /* USER CODE END 1 */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 107 | -------------------------------------------------------------------------------- /docs/code/STM32F103C8T6/Src/stm32f1xx_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_it.c 4 | * @brief Interrupt Service Routines. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2017 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "stm32f1xx_hal.h" 35 | #include "stm32f1xx.h" 36 | #include "stm32f1xx_it.h" 37 | #include "cmsis_os.h" 38 | 39 | /* USER CODE BEGIN 0 */ 40 | 41 | /* USER CODE END 0 */ 42 | 43 | /* External variables --------------------------------------------------------*/ 44 | 45 | /******************************************************************************/ 46 | /* Cortex-M3 Processor Interruption and Exception Handlers */ 47 | /******************************************************************************/ 48 | 49 | /** 50 | * @brief This function handles Non maskable interrupt. 51 | */ 52 | void NMI_Handler(void) 53 | { 54 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 55 | 56 | /* USER CODE END NonMaskableInt_IRQn 0 */ 57 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 58 | 59 | /* USER CODE END NonMaskableInt_IRQn 1 */ 60 | } 61 | 62 | /** 63 | * @brief This function handles Hard fault interrupt. 64 | */ 65 | void HardFault_Handler(void) 66 | { 67 | /* USER CODE BEGIN HardFault_IRQn 0 */ 68 | 69 | /* USER CODE END HardFault_IRQn 0 */ 70 | while (1) 71 | { 72 | } 73 | /* USER CODE BEGIN HardFault_IRQn 1 */ 74 | 75 | /* USER CODE END HardFault_IRQn 1 */ 76 | } 77 | 78 | /** 79 | * @brief This function handles Memory management fault. 80 | */ 81 | void MemManage_Handler(void) 82 | { 83 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 84 | 85 | /* USER CODE END MemoryManagement_IRQn 0 */ 86 | while (1) 87 | { 88 | } 89 | /* USER CODE BEGIN MemoryManagement_IRQn 1 */ 90 | 91 | /* USER CODE END MemoryManagement_IRQn 1 */ 92 | } 93 | 94 | /** 95 | * @brief This function handles Prefetch fault, memory access fault. 96 | */ 97 | void BusFault_Handler(void) 98 | { 99 | /* USER CODE BEGIN BusFault_IRQn 0 */ 100 | 101 | /* USER CODE END BusFault_IRQn 0 */ 102 | while (1) 103 | { 104 | } 105 | /* USER CODE BEGIN BusFault_IRQn 1 */ 106 | 107 | /* USER CODE END BusFault_IRQn 1 */ 108 | } 109 | 110 | /** 111 | * @brief This function handles Undefined instruction or illegal state. 112 | */ 113 | void UsageFault_Handler(void) 114 | { 115 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 116 | 117 | /* USER CODE END UsageFault_IRQn 0 */ 118 | while (1) 119 | { 120 | } 121 | /* USER CODE BEGIN UsageFault_IRQn 1 */ 122 | 123 | /* USER CODE END UsageFault_IRQn 1 */ 124 | } 125 | 126 | /** 127 | * @brief This function handles Debug monitor. 128 | */ 129 | void DebugMon_Handler(void) 130 | { 131 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 132 | 133 | /* USER CODE END DebugMonitor_IRQn 0 */ 134 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 135 | 136 | /* USER CODE END DebugMonitor_IRQn 1 */ 137 | } 138 | 139 | /** 140 | * @brief This function handles System tick timer. 141 | */ 142 | void SysTick_Handler(void) 143 | { 144 | /* USER CODE BEGIN SysTick_IRQn 0 */ 145 | 146 | /* USER CODE END SysTick_IRQn 0 */ 147 | HAL_IncTick(); 148 | osSystickHandler(); 149 | /* USER CODE BEGIN SysTick_IRQn 1 */ 150 | 151 | /* USER CODE END SysTick_IRQn 1 */ 152 | } 153 | 154 | /******************************************************************************/ 155 | /* STM32F1xx Peripheral Interrupt Handlers */ 156 | /* Add here the Interrupt Handlers for the used peripherals. */ 157 | /* For the available peripheral interrupt handler names, */ 158 | /* please refer to the startup file (startup_stm32f1xx.s). */ 159 | /******************************************************************************/ 160 | 161 | /* USER CODE BEGIN 1 */ 162 | 163 | /* USER CODE END 1 */ 164 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 165 | -------------------------------------------------------------------------------- /docs/code/TCP/asynchronous-client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | Pymodbus Asynchronous Client Examples 4 | -------------------------------------------------------------------------- 5 | 6 | The following is an example of how to use the asynchronous modbus 7 | client implementation from pymodbus. 8 | ''' 9 | #---------------------------------------------------------------------------# 10 | # import needed libraries 11 | #---------------------------------------------------------------------------# 12 | from twisted.internet import reactor, protocol 13 | from pymodbus.constants import Defaults 14 | 15 | #---------------------------------------------------------------------------# 16 | # choose the requested modbus protocol 17 | #---------------------------------------------------------------------------# 18 | from pymodbus.client.async import ModbusClientProtocol 19 | #from pymodbus.client.async import ModbusUdpClientProtocol 20 | 21 | #---------------------------------------------------------------------------# 22 | # configure the client logging 23 | #---------------------------------------------------------------------------# 24 | import logging 25 | logging.basicConfig() 26 | log = logging.getLogger() 27 | log.setLevel(logging.DEBUG) 28 | 29 | #---------------------------------------------------------------------------# 30 | # helper method to test deferred callbacks 31 | #---------------------------------------------------------------------------# 32 | def dassert(deferred, callback): 33 | def _assertor(value): 34 | assert(value) 35 | 36 | def _print_assertor(response): 37 | 38 | print(response) 39 | print(callback(response)) 40 | 41 | assert(callback(response)) 42 | 43 | deferred.addCallback(_print_assertor) 44 | deferred.addErrback(lambda _: _assertor(False)) 45 | 46 | #---------------------------------------------------------------------------# 47 | # specify slave to query 48 | #---------------------------------------------------------------------------# 49 | # The slave to query is specified in an optional parameter for each 50 | # individual request. This can be done by specifying the `unit` parameter 51 | # which defaults to `0x00` 52 | #---------------------------------------------------------------------------# 53 | def exampleRequests(client): 54 | rr = client.read_coils(1, 1, unit=0x02) 55 | 56 | #---------------------------------------------------------------------------# 57 | # example requests 58 | #---------------------------------------------------------------------------# 59 | # simply call the methods that you would like to use. An example session 60 | # is displayed below along with some assert checks. Note that unlike the 61 | # synchronous version of the client, the asynchronous version returns 62 | # deferreds which can be thought of as a handle to the callback to send 63 | # the result of the operation. We are handling the result using the 64 | # deferred assert helper(dassert). 65 | #---------------------------------------------------------------------------# 66 | def beginAsynchronousTest(client): 67 | # write_coil(address, value, **kwargs) 68 | # address – The starting address to write to 69 | # value – The value to write to the specified address 70 | rq = client.write_coil(1, True) 71 | 72 | # read_coils(address, count=1, **kwargs) 73 | # address – The starting address to read from 74 | # count – The number of coils to read 75 | rr = client.read_coils(1,1) 76 | 77 | dassert(rq, lambda r: r.function_code < 0x80) # test that we are not an error 78 | dassert(rr, lambda r: r.bits[0] == True) # test the expected value 79 | 80 | ''' 81 | # write_coils(address, values, **kwargs) 82 | # address – The starting address to write to 83 | # values – The values to write to the specified address 84 | rq = client.write_coils(1, [True]*8) 85 | 86 | # read_coils(address, count=1, **kwargs) 87 | # address – The starting address to read from 88 | # count – The number of coils to read 89 | rr = client.read_coils(1,8) 90 | 91 | dassert(rq, lambda r: r.function_code < 0x80) # test that we are not an error 92 | dassert(rr, lambda r: r.bits == [True]*8) # test the expected value 93 | 94 | rq = client.write_coils(1, [False]*8) 95 | 96 | # read_discrete_inputs(address, count=1, **kwargs) 97 | # address – The starting address to read from 98 | # count – The number of discretes to read 99 | rr = client.read_discrete_inputs(1,8) 100 | dassert(rq, lambda r: r.function_code < 0x80) # test that we are not an error 101 | dassert(rr, lambda r: r.bits == [True]*8) # test the expected value 102 | 103 | # write_register(address, value, **kwargs) 104 | # address – The starting address to write to 105 | # value – The value to write to the specified address 106 | rq = client.write_register(1, 10) 107 | 108 | # read_holding_registers(address, count=1, **kwargs) 109 | # address – The starting address to read from 110 | # count – The number of registers to read 111 | rr = client.read_holding_registers(1,1) 112 | dassert(rq, lambda r: r.function_code < 0x80) # test that we are not an error 113 | dassert(rr, lambda r: r.registers[0] == 10) # test the expected value 114 | 115 | # write_registers(address, values, **kwargs) 116 | # address – The starting address to write to 117 | # values – The values to write to the specified address 118 | rq = client.write_registers(1, [10]*8) 119 | 120 | # read_input_registers(address, count=1, **kwargs) 121 | # address – The starting address to read from 122 | # count – The number of registers to read 123 | rr = client.read_input_registers(1,8) 124 | 125 | dassert(rq, lambda r: r.function_code < 0x80) # test that we are not an error 126 | dassert(rr, lambda r: r.registers == [17]*8) # test the expected value 127 | 128 | arguments = { 129 | 'read_address': 1, 130 | 'read_count': 8, 131 | 'write_address': 1, 132 | 'write_registers': [20]*8, 133 | } 134 | # readwrite_registers(*args, **kwargs) 135 | # read_address – The address to start reading from 136 | # read_count – The number of registers to read from address 137 | # write_address – The address to start writing to 138 | # write_registers – The registers to write to the specified address 139 | rq = client.readwrite_registers(**arguments) 140 | rr = client.read_input_registers(1,8) 141 | dassert(rq, lambda r: r.registers == [20]*8) # test the expected value 142 | dassert(rr, lambda r: r.registers == [17]*8) # test the expected value 143 | ''' 144 | 145 | #-----------------------------------------------------------------------# 146 | # close the client at some time later 147 | #-----------------------------------------------------------------------# 148 | reactor.callLater(1, client.transport.loseConnection) 149 | reactor.callLater(2, reactor.stop) 150 | 151 | #---------------------------------------------------------------------------# 152 | # extra requests 153 | #---------------------------------------------------------------------------# 154 | # If you are performing a request that is not available in the client 155 | # mixin, you have to perform the request like this instead:: 156 | # 157 | # from pymodbus.diag_message import ClearCountersRequest 158 | # from pymodbus.diag_message import ClearCountersResponse 159 | # 160 | # request = ClearCountersRequest() 161 | # response = client.execute(request) 162 | # if isinstance(response, ClearCountersResponse): 163 | # ... do something with the response 164 | # 165 | #---------------------------------------------------------------------------# 166 | 167 | #---------------------------------------------------------------------------# 168 | # choose the client you want 169 | #---------------------------------------------------------------------------# 170 | # make sure to start an implementation to hit against. For this 171 | # you can use an existing device, the reference implementation in the tools 172 | # directory, or start a pymodbus server. 173 | #---------------------------------------------------------------------------# 174 | # 固定用法,生成ModbusClientProtocol协议Client端 175 | defer = protocol.ClientCreator(reactor, ModbusClientProtocol 176 | ).connectTCP("localhost", 5020) 177 | # 异步回调函数 178 | defer.addCallback(beginAsynchronousTest) 179 | reactor.run() 180 | -------------------------------------------------------------------------------- /docs/code/TCP/asynchronous-server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | Pymodbus Asynchronous Server Example 4 | -------------------------------------------------------------------------- 5 | 6 | The asynchronous server is a high performance implementation using the 7 | twisted library as its backend. This allows it to scale to many thousands 8 | of nodes which can be helpful for testing monitoring software. 9 | ''' 10 | #---------------------------------------------------------------------------# 11 | # import the various server implementations 12 | #---------------------------------------------------------------------------# 13 | from pymodbus.server.async import StartTcpServer 14 | from pymodbus.server.async import StartUdpServer 15 | from pymodbus.server.async import StartSerialServer 16 | 17 | from pymodbus.device import ModbusDeviceIdentification 18 | from pymodbus.datastore import ModbusSequentialDataBlock 19 | from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext 20 | from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer 21 | 22 | #---------------------------------------------------------------------------# 23 | # configure the service logging 24 | #---------------------------------------------------------------------------# 25 | import logging 26 | logging.basicConfig() 27 | log = logging.getLogger() 28 | log.setLevel(logging.DEBUG) 29 | 30 | #---------------------------------------------------------------------------# 31 | # initialize your data store 32 | #---------------------------------------------------------------------------# 33 | # The datastores only respond to the addresses that they are initialized to. 34 | # Therefore, if you initialize a DataBlock to addresses from 0x00 to 0xFF, a 35 | # request to 0x100 will respond with an invalid address exception. This is 36 | # because many devices exhibit this kind of behavior (but not all):: 37 | # 38 | # block = ModbusSequentialDataBlock(0x00, [0]*0xff) 39 | # 40 | # Continuing, you can choose to use a sequential or a sparse DataBlock in 41 | # your data context. The difference is that the sequential has no gaps in 42 | # the data while the sparse can. Once again, there are devices that exhibit 43 | # both forms of behavior:: 44 | # 45 | # block = ModbusSparseDataBlock({0x00: 0, 0x05: 1}) 46 | # block = ModbusSequentialDataBlock(0x00, [0]*5) 47 | # 48 | # Alternately, you can use the factory methods to initialize the DataBlocks 49 | # or simply do not pass them to have them initialized to 0x00 on the full 50 | # address range:: 51 | # 52 | # store = ModbusSlaveContext(di = ModbusSequentialDataBlock.create()) 53 | # store = ModbusSlaveContext() 54 | # 55 | # Finally, you are allowed to use the same DataBlock reference for every 56 | # table or you you may use a seperate DataBlock for each table. This depends 57 | # if you would like functions to be able to access and modify the same data 58 | # or not:: 59 | # 60 | # block = ModbusSequentialDataBlock(0x00, [0]*0xff) 61 | # store = ModbusSlaveContext(di=block, co=block, hr=block, ir=block) 62 | # 63 | # The server then makes use of a server context that allows the server to 64 | # respond with different slave contexts for different unit ids. By default 65 | # it will return the same context for every unit id supplied (broadcast 66 | # mode). However, this can be overloaded by setting the single flag to False 67 | # and then supplying a dictionary of unit id to context mapping:: 68 | # 69 | # slaves = { 70 | # 0x01: ModbusSlaveContext(...), 71 | # 0x02: ModbusSlaveContext(...), 72 | # 0x03: ModbusSlaveContext(...), 73 | # } 74 | # context = ModbusServerContext(slaves=slaves, single=False) 75 | # 76 | # The slave context can also be initialized in zero_mode which means that a 77 | # request to address(0-7) will map to the address (0-7). The default is 78 | # False which is based on section 4.4 of the specification, so address(0-7) 79 | # will map to (1-8):: 80 | # 81 | # store = ModbusSlaveContext(..., zero_mode=True) 82 | #---------------------------------------------------------------------------# 83 | # This creates a modbus data model with each data access stored in its own personal block 84 | # Initializes the datastores, defaults to fully populated sequential data blocks if none are passed in. 85 | # Parameters: kwargs – 86 | # Each element is a ModbusDataBlock 87 | # 88 | # ‘di’ - Discrete Inputs initializer ‘co’ - Coils initializer ‘hr’ - Holding Register initializer ‘ir’ - Input Registers iniatializer 89 | # di --> 离散输入初始化器 90 | # co --> 线圈初始化器 91 | # hr --> 持有寄存器初始化器 92 | # ir --> 输入寄存器初始化器 93 | store = ModbusSlaveContext( 94 | # 创建一个顺序的modbus数据存储: 95 | # address – The starting address of the datastore 96 | # values – Either a list or a dictionary of values 97 | di = ModbusSequentialDataBlock(0, [17]*100), 98 | co = ModbusSequentialDataBlock(0, [17]*100), 99 | hr = ModbusSequentialDataBlock(0, [17]*100), 100 | ir = ModbusSequentialDataBlock(0, [17]*100)) 101 | # This represents a master collection of slave contexts. If single is set to true, it will be treated as a single context so every unit-id returns the same context. If single is set to false, it will be interpreted as a collection of slave contexts. 102 | context = ModbusServerContext(slaves=store, single=True) 103 | 104 | #---------------------------------------------------------------------------# 105 | # initialize the server information 106 | #---------------------------------------------------------------------------# 107 | # If you don't set this or any fields, they are defaulted to empty strings. 108 | #---------------------------------------------------------------------------# 109 | identity = ModbusDeviceIdentification() 110 | identity.VendorName = 'Pymodbus' 111 | identity.ProductCode = 'PM' 112 | identity.VendorUrl = 'http://github.com/bashwork/pymodbus/' 113 | identity.ProductName = 'Pymodbus Server' 114 | identity.ModelName = 'Pymodbus Server' 115 | identity.MajorMinorRevision = '1.0' 116 | 117 | #---------------------------------------------------------------------------# 118 | # run the server you want 119 | #---------------------------------------------------------------------------# 120 | StartTcpServer(context, identity=identity, address=("localhost", 5020)) 121 | #StartUdpServer(context, identity=identity, address=("localhost", 502)) 122 | #StartSerialServer(context, identity=identity, port='/dev/pts/3', framer=ModbusRtuFramer) 123 | #StartSerialServer(context, identity=identity, port='/dev/pts/3', framer=ModbusAsciiFramer) 124 | -------------------------------------------------------------------------------- /docs/code/html/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/code/html/index.html -------------------------------------------------------------------------------- /docs/code/iot-edge-sdk-for-iot-parser/asynchronous-server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | Pymodbus Asynchronous Server Example 4 | -------------------------------------------------------------------------- 5 | 6 | The asynchronous server is a high performance implementation using the 7 | twisted library as its backend. This allows it to scale to many thousands 8 | of nodes which can be helpful for testing monitoring software. 9 | ''' 10 | #---------------------------------------------------------------------------# 11 | # import the various server implementations 12 | #---------------------------------------------------------------------------# 13 | from pymodbus.server.async import StartTcpServer 14 | from pymodbus.server.async import StartUdpServer 15 | from pymodbus.server.async import StartSerialServer 16 | 17 | from pymodbus.device import ModbusDeviceIdentification 18 | from pymodbus.datastore import ModbusSequentialDataBlock 19 | from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext 20 | from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer 21 | 22 | #---------------------------------------------------------------------------# 23 | # configure the service logging 24 | #---------------------------------------------------------------------------# 25 | import logging 26 | logging.basicConfig() 27 | log = logging.getLogger() 28 | log.setLevel(logging.DEBUG) 29 | 30 | #---------------------------------------------------------------------------# 31 | # initialize your data store 32 | #---------------------------------------------------------------------------# 33 | # The datastores only respond to the addresses that they are initialized to. 34 | # Therefore, if you initialize a DataBlock to addresses from 0x00 to 0xFF, a 35 | # request to 0x100 will respond with an invalid address exception. This is 36 | # because many devices exhibit this kind of behavior (but not all):: 37 | # 38 | # block = ModbusSequentialDataBlock(0x00, [0]*0xff) 39 | # 40 | # Continuing, you can choose to use a sequential or a sparse DataBlock in 41 | # your data context. The difference is that the sequential has no gaps in 42 | # the data while the sparse can. Once again, there are devices that exhibit 43 | # both forms of behavior:: 44 | # 45 | # block = ModbusSparseDataBlock({0x00: 0, 0x05: 1}) 46 | # block = ModbusSequentialDataBlock(0x00, [0]*5) 47 | # 48 | # Alternately, you can use the factory methods to initialize the DataBlocks 49 | # or simply do not pass them to have them initialized to 0x00 on the full 50 | # address range:: 51 | # 52 | # store = ModbusSlaveContext(di = ModbusSequentialDataBlock.create()) 53 | # store = ModbusSlaveContext() 54 | # 55 | # Finally, you are allowed to use the same DataBlock reference for every 56 | # table or you you may use a seperate DataBlock for each table. This depends 57 | # if you would like functions to be able to access and modify the same data 58 | # or not:: 59 | # 60 | # block = ModbusSequentialDataBlock(0x00, [0]*0xff) 61 | # store = ModbusSlaveContext(di=block, co=block, hr=block, ir=block) 62 | # 63 | # The server then makes use of a server context that allows the server to 64 | # respond with different slave contexts for different unit ids. By default 65 | # it will return the same context for every unit id supplied (broadcast 66 | # mode). However, this can be overloaded by setting the single flag to False 67 | # and then supplying a dictionary of unit id to context mapping:: 68 | # 69 | # slaves = { 70 | # 0x01: ModbusSlaveContext(...), 71 | # 0x02: ModbusSlaveContext(...), 72 | # 0x03: ModbusSlaveContext(...), 73 | # } 74 | # context = ModbusServerContext(slaves=slaves, single=False) 75 | # 76 | # The slave context can also be initialized in zero_mode which means that a 77 | # request to address(0-7) will map to the address (0-7). The default is 78 | # False which is based on section 4.4 of the specification, so address(0-7) 79 | # will map to (1-8):: 80 | # 81 | # store = ModbusSlaveContext(..., zero_mode=True) 82 | #---------------------------------------------------------------------------# 83 | # This creates a modbus data model with each data access stored in its own personal block 84 | # Initializes the datastores, defaults to fully populated sequential data blocks if none are passed in. 85 | # Parameters: kwargs – 86 | # Each element is a ModbusDataBlock 87 | # 88 | # ‘di’ - Discrete Inputs initializer ‘co’ - Coils initializer ‘hr’ - Holding Register initializer ‘ir’ - Input Registers iniatializer 89 | # di --> 离散输入初始化器 90 | # co --> 线圈初始化器 91 | # hr --> 持有寄存器初始化器 92 | # ir --> 输入寄存器初始化器 93 | store = ModbusSlaveContext( 94 | # 创建一个顺序的modbus数据存储: 95 | # address – The starting address of the datastore 96 | # values – Either a list or a dictionary of values 97 | di = ModbusSequentialDataBlock(0, [17]*100), 98 | co = ModbusSequentialDataBlock(0, [17]*100), 99 | hr = ModbusSequentialDataBlock(0, [17]*100), 100 | ir = ModbusSequentialDataBlock(0, [17]*100)) 101 | # This represents a master collection of slave contexts. If single is set to true, it will be treated as a single context so every unit-id returns the same context. If single is set to false, it will be interpreted as a collection of slave contexts. 102 | context = ModbusServerContext(slaves=store, single=True) 103 | 104 | #---------------------------------------------------------------------------# 105 | # initialize the server information 106 | #---------------------------------------------------------------------------# 107 | # If you don't set this or any fields, they are defaulted to empty strings. 108 | #---------------------------------------------------------------------------# 109 | identity = ModbusDeviceIdentification() 110 | identity.VendorName = 'Pymodbus' 111 | identity.ProductCode = 'PM' 112 | identity.VendorUrl = 'http://github.com/bashwork/pymodbus/' 113 | identity.ProductName = 'Pymodbus Server' 114 | identity.ModelName = 'Pymodbus Server' 115 | identity.MajorMinorRevision = '1.0' 116 | 117 | #---------------------------------------------------------------------------# 118 | # run the server you want 119 | #---------------------------------------------------------------------------# 120 | StartTcpServer(context, identity=identity, address=("0.0.0.0", 5020)) 121 | #StartUdpServer(context, identity=identity, address=("localhost", 502)) 122 | #StartSerialServer(context, identity=identity, port='/dev/pts/3', framer=ModbusRtuFramer) 123 | #StartSerialServer(context, identity=identity, port='/dev/pts/3', framer=ModbusAsciiFramer) 124 | -------------------------------------------------------------------------------- /docs/code/syscalls.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/code/syscalls.c -------------------------------------------------------------------------------- /docs/img/Baidu_IoT_Parser_Modbus_TCP_Arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Baidu_IoT_Parser_Modbus_TCP_Arch.png -------------------------------------------------------------------------------- /docs/img/Baidu_IoT_Parser_Modbus_Verify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Baidu_IoT_Parser_Modbus_Verify.png -------------------------------------------------------------------------------- /docs/img/Baidu_IoT_Parser_iot_edge-sdk-for-iot-parser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Baidu_IoT_Parser_iot_edge-sdk-for-iot-parser.png -------------------------------------------------------------------------------- /docs/img/Baidu_IoT_Parser_modbus_gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Baidu_IoT_Parser_modbus_gateway.png -------------------------------------------------------------------------------- /docs/img/Baidu_IoT_Parser_modbus_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Baidu_IoT_Parser_modbus_key.png -------------------------------------------------------------------------------- /docs/img/Modbus_Poll_Raw_Data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Modbus_Poll_Raw_Data.png -------------------------------------------------------------------------------- /docs/img/STM32CubeMX_STM32F103C8Tx_Clock_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/STM32CubeMX_STM32F103C8Tx_Clock_config.png -------------------------------------------------------------------------------- /docs/img/STM32CubeMX_STM32F103C8Tx_Pinout_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/STM32CubeMX_STM32F103C8Tx_Pinout_config.png -------------------------------------------------------------------------------- /docs/img/STM32CubeMX_STM32F103C8Tx_Project_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/STM32CubeMX_STM32F103C8Tx_Project_config.png -------------------------------------------------------------------------------- /docs/img/SW4STM32_B-L475E-IOT01_Compile_Download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/SW4STM32_B-L475E-IOT01_Compile_Download.png -------------------------------------------------------------------------------- /docs/img/SW4STM32_B-L475E-IOT01_Define.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/SW4STM32_B-L475E-IOT01_Define.png -------------------------------------------------------------------------------- /docs/img/SW4STM32_GPIO_LED.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/SW4STM32_GPIO_LED.JPG -------------------------------------------------------------------------------- /docs/img/SW4STM32_GPIO_While.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/SW4STM32_GPIO_While.png -------------------------------------------------------------------------------- /docs/img/Uno_R3_pin_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/Uno_R3_pin_functions.png -------------------------------------------------------------------------------- /docs/img/WireShark_Capture_Modbus_Data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/WireShark_Capture_Modbus_Data.png -------------------------------------------------------------------------------- /docs/img/WireShark_Modbus_Data_Analysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/WireShark_Modbus_Data_Analysis.png -------------------------------------------------------------------------------- /docs/img/WireShark_Support_ModBus_Protocol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/WireShark_Support_ModBus_Protocol.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_Arduino_Connector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_Arduino_Connector.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_Arduino_Connector_Pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_Arduino_Connector_Pinout.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_PMOD_Interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_PMOD_Interface.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_PMOD_Interface_Type2A_SPI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_PMOD_Interface_Type2A_SPI.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_PMOD_Interface_Type4A_UART.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_PMOD_Interface_Type4A_UART.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_Power_Select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_Power_Select.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_Power_Supply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_Power_Supply.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_ST-Link_Debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_ST-Link_Debug.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_ST-Link_MCU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_ST-Link_MCU.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_ST-Link_Power3V3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_ST-Link_Power3V3.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_ST-Link_SWD_Interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_ST-Link_SWD_Interface.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_ST-Link_USB_Connector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_ST-Link_USB_Connector.png -------------------------------------------------------------------------------- /docs/img/b-l475e-iot01a1_ST-Link_USB_Power_Switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/img/b-l475e-iot01a1_ST-Link_USB_Power_Switch.png -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/Digilent-Pmod_Interface_Specification.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/Digilent-Pmod_Interface_Specification.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/Product Specifications_en.DM00347837.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/Product Specifications_en.DM00347837.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/Technical Notes & Articles_en.DM00290229.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/Technical Notes & Articles_en.DM00290229.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/User_Manuals_en.DM00285842.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/User_Manuals_en.DM00285842.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/User_Manuals_en.DM00347848.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/User_Manuals_en.DM00347848.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch.zip -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_assembly drawings_revC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_assembly drawings_revC.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_assembly drawings_revD.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_assembly drawings_revD.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_sch_revC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_sch_revC.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_sch_revD-01.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/b-l475e-iot01a1_sch_revD-01.pdf -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b-l475e-iot01ax_sch/readme.txt -------------------------------------------------------------------------------- /docs/refers/B-L475E-IOT01A/en.b_l475e_iot01a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/B-L475E-IOT01A/en.b_l475e_iot01a.jpg -------------------------------------------------------------------------------- /docs/refers/IOT_STuino_v2.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/IOT_STuino_v2.1.pdf -------------------------------------------------------------------------------- /docs/refers/MiCOKit-EXT+V1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/MiCOKit-EXT+V1.1.pdf -------------------------------------------------------------------------------- /docs/refers/Modbus_Application_Protocol_V1_1b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/Modbus_Application_Protocol_V1_1b.pdf -------------------------------------------------------------------------------- /docs/refers/Modbus_Messaging_Implementation_Guide_V1_0b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/Modbus_Messaging_Implementation_Guide_V1_0b.pdf -------------------------------------------------------------------------------- /docs/refers/Modbus_TCP_Parser.xml: -------------------------------------------------------------------------------- 1 | 7V3dc6o4FP9reLRDEkB47Oe9O3N3prvt7t19TJUqt2gcjG3dv36DECAkWioQpOhL8SSA5HfOyfmkBrpevH+L8Gr+O5n6oQHN6buBbgwIgWeb7E9M2SYUCE2YUGZRME1n5YSH4D8/JaYnzjbB1F8LEykhIQ1WInFClkt/QgUajiLyJk57JqF41xWe+RLhYYJDmfozmNJ5QnXhOKd/94PZnN8ZOF4y8oQnL7OIbJbp/QyInnefZHiB+bXSB13P8ZS8FUjo1kDXESE0OVq8X/thvLh82ZLz7vaMZr878pe0ygkpLK843KSP/ht5ZITvm6f0B9ItX5TdY/nxicBAV2/zgPoPKzyJR98YHzDanC7CdPg5CMNrEpJody66230YfRbhacB+HB9bkqUfTydLmrIBGKffC6ebuw+j4zCYLRltwi7hs8GrED/54T1ZBzQgwsCrH9GAIfqjNIGSVWH0Mr3eE6GULNhAuh5s2H/fu6YgQ4qJgE8WPo22bAo/wU3B5dzPufotZyXLTGnzAhvx83DKvbPs0jmC7CAFUQ0okmDzp4y1068konMyI0sc3ubUqxxYUwTRfw/oPzH5Atrp13/TWWwtom1xLP7OB3/5lG5TOPGGEkbK7/yDxAjsrr+mEXnxCziP70xzxyZV+SF52vgRD4PFVoRsookvcD3F0cynBZIMaeSHmAav4tXr4GPtEbh7HK0Z3/ZC5vYKz5HC2IDMjYBrC0I3grLQAYAUUgeaEDtotyN3RbEDPZAsWyFZXk3R2p16GUV4W5iwIsGSrgtXvo8JOUM4lsAOHPm7itPdw9NRScWX5rOD5PfmvJM9eCV2siUt8XcQ0Q2O5zBz62nDntz8hqn/hrf90BlNyLjlCos+liU8W7migDtNyLejR77zbVXYU3fzTl32HVn2bV27KmgfHvPrwWOZmvBxJH3G7R3zPiK/YhduMFoMOEi2TFR6y2pCb411662L3nkDbod6qyV37SvpLQU82vSWK+mti4uLwagqhQvlKRyoRvSUq1lPgf4JgtehnrL06KleQFDXlZW9SSh6k8xEKIlUgnl6Wg7bZ51iiOzyjUCJDer5rd7ZzsuiwGNbNvOA2476BEBaeDlMYN74rwFb2F4gcIJx/RHwRPFBlrxB2lCxQ2YZgFoYw/0Y//n4V4bvuh8ANwJIKehre4qgr9uSyQLQfjwer+8N6IQ03qpWeMmOZ3T3zA5exOu9fFrHfzLAkqnsjuLsgeAIgNUhjPKeFRA6ii2D0Xr60g8QTlJb2qJVgxTxWkuZkLHt+rBmCXZtnnX/Ah9c7IoeRULT4FIAORNa2s6uw1hE+iGAjQgMAoLAWAqBAa7TkhqUU06f3c04XsPezFzYIYiaslS9VGywpmI7yuMeITFnaVuHE8ujkotRml/bQQea8gEnzyGKQoXEoNfNIVmcoCKHQNNqlUMgbIVDimZTbin11HDKalK7MJzaKfEDXx8gXcFyqAjG/fH4mMRAKZmQ8IAxZH4pY2jE9xtuDSlKYQGvvWo8p6QhaaF3rzskkkcKiiKptA/TdvfBckkdSgMze0vwzJrzvQ8qAu1D02tvs46mgtFea3EFczp1mbOy9pDjgkPV4tATnRiIFBVMbWlxpKky4NSFAdWteammdiEqYdZQ6tnxkHCfrius+WOeS6yLkm6XVl1niTWPfg66xFqQeChvf5xtK0DafBGQBpNFsHJ7WKOlwkxbtSK/+bn8hi26oyi/aavKGmko4z15Y14QA0UAvlPVpSExchIgfKSe6gYp1caaZYlmQ2sFjGUrsvECRiRnpYdU8e3wFjsNJd9IdwTkFM0JQTgVHVqdKk0NucLe23tddtWhc1tdXnZhKmJSbZVbI0+P6jp57h+3Yk6gsXfhFD6emESqGqI6Yvu3oGaVVzLk+wN6VypvPGj7DCHZq1XZZ14DSs6SI6TGrWMwYbxyjFvbuLo03LsdhR2b8YF7Y1zepkOxoZ4UAk6DV14E+Phwc1WoDyyMDAdBqddLVeyuaiJpIsZqyQ2t5z6hpivfLSQ6qXrbhCxF3nLYbUKWJeKhtb3ElrXouUvoKBjH3DjrBEa5puvcJdSEbI7F0gK9TUJ2x+b+SYSMhde3pZpSeMcAqgxq4+a+faDHcpBNQlbJF9baXmIfaNk69wh9ZisDZocoDuVVlR8pNm4pN6nYjspqZZZMxRYQu+RgNN0CYg+ljUzgEEXKmhvvnXNIFt2uyCEuLwVpi0PaSQ0VzabT70ERuEf1cqYuDadWqmZ71iT0IUBWhwCdy8uzogP+9qIumoQc2bEfVEKh9E5l5Mhr7yiq5rLK4Fprr8H91mtnTPF6nnHJeo5Xu1vG/5Bkv5aq8kb1xlOs5e6msig1Va9Vuo3rlfijZhOVhpe8fMUOP7uR9xi23eFnOTXnf9ThVyombLzF75iq4LLSOIJbBSXUuRHWTVuThG1bCs4THS2+p1XludL8z/Ic+5r/r6hkev4fudDt/w== -------------------------------------------------------------------------------- /docs/refers/freemodbus-v1.5.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FolderLevel/Modbus_TCP/78902a37611e9cc6f77ba62f497e8a467e8b2670/docs/refers/freemodbus-v1.5.0.zip --------------------------------------------------------------------------------