diff --git a/john103C6T6/Core/Src/main.c b/john103C6T6/Core/Src/main.c
index e03a23b..694330d 100644
--- a/john103C6T6/Core/Src/main.c
+++ b/john103C6T6/Core/Src/main.c
@@ -60,7 +60,7 @@ uint8_t ralay_5v_on_var=0;
float temperature;
extern uint8_t roms[MAX_DEVICES][8];
//extern uint8_t devices_found ;
- uint8_t _debug_init=1;
+ uint8_t _debug_init=0;
//TEMP temp_sense[30];
float set_temp_old[30];
char rx_buffer[64];
diff --git a/john103C6T6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c b/john103C6T6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c
index b7cf66c..aca9433 100644
--- a/john103C6T6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c
+++ b/john103C6T6/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c
@@ -726,6 +726,7 @@ __weak void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/**
* @brief UART MSP DeInit.
+
* @param huart Pointer to a UART_HandleTypeDef structure that contains
* the configuration information for the specified UART module.
* @retval None
diff --git a/john103C6T6/MDK-ARM/john103C6T6.uvoptx b/john103C6T6/MDK-ARM/john103C6T6.uvoptx
index f7a2c3e..25a6634 100644
--- a/john103C6T6/MDK-ARM/john103C6T6.uvoptx
+++ b/john103C6T6/MDK-ARM/john103C6T6.uvoptx
@@ -148,7 +148,24 @@
-U37FF71064E57343625581443 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL08000 -FP0($$Device:STM32F103C6$Flash\STM32F10x_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2
-
+
+
+ 0
+ 0
+ 302
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ..\Modbus\modbus.c
+
+
+
+
0
@@ -225,6 +242,21 @@
1
MB_DATA.Coils.coils[1].state_val_bit.state_val_01,0x0A
+
+ 15
+ 1
+ RS_Buffer
+
+
+ 16
+ 1
+ MODBUS_MSG
+
+
+ 17
+ 1
+ modbus_uart_buff
+
@@ -233,6 +265,14 @@
resolution
+
+
+ 1
+ 0
+ 0x2000058c
+ 0
+
+
0
@@ -433,7 +473,7 @@
2
8
1
- 0
+ 1
0
0
..\Modbus\modbus.c
diff --git a/john103C6T6/Modbus/modbus.c b/john103C6T6/Modbus/modbus.c
index 55970c1..bf636f7 100644
--- a/john103C6T6/Modbus/modbus.c
+++ b/john103C6T6/Modbus/modbus.c
@@ -807,6 +807,17 @@ RS_StatusTypeDef RS_Parse_Message(RS_HandleTypeDef *hmodbus, RS_MsgTypeDef *modb
uint32_t check_empty_buff;
int ind = 0; // ind for modbus-uart buffer
//-----INFO ABOUT DATA/MESSAGE-------
+ #ifdef TCP_ModBus
+ modbus_msg->ID_Transaction=modbus_uart_buff[ind++]<<8;
+ modbus_msg->ID_Transaction|=modbus_uart_buff[ind++];
+
+ modbus_msg->ID_Prot=modbus_uart_buff[ind++]<<8;
+ modbus_msg->ID_Prot|=modbus_uart_buff[ind++];
+ modbus_msg->PDU_Length=modbus_uart_buff[ind++]<<8;
+ modbus_msg->PDU_Length|=modbus_uart_buff[ind++];
+ #else
+
+ #endif
//-----------[first bits]------------
// get ID of message/user
modbus_msg->MbAddr = modbus_uart_buff[ind++];
diff --git a/john103C6T6/Modbus/modbus.h b/john103C6T6/Modbus/modbus.h
index 8514eb4..9603ec9 100644
--- a/john103C6T6/Modbus/modbus.h
+++ b/john103C6T6/Modbus/modbus.h
@@ -11,7 +11,7 @@
*************************************************************************/
#ifndef __MODBUS_H_
#define __MODBUS_H_
-
+#define TCP_ModBus
#include "modbus_config.h"
#include "modbus_data.h"
//#include "settings.h" // for modbus settings
@@ -32,6 +32,10 @@
/////////////////////---USER MESSAGE DEFINES---//////////////////////
//-------------DEFINES FOR STRUCTURE----------------
/* defines for structure of modbus message */
+
+#define ID_Transaction_size 2
+#define ID_Prot_size 2
+#define DataLength_size 2
#define MbAddr_SIZE 1 ///< size of (MbAddr)
#define Func_Code_SIZE 1 ///< size of (Func_Code)
#define Addr_SIZE 2 ///< size of (Addr)
@@ -41,8 +45,11 @@
#define CRC_SIZE 2 ///< size of (MB_CRC) in bytes
/** @brief Size of whole message */
+#ifdef TCP_ModBus
+#define INFO_SIZE_MAX (ID_Transaction_size+ID_Prot_size+DataLength_size+MbAddr_SIZE+Func_Code_SIZE+Addr_SIZE+Qnt_SIZE)
+#else
#define INFO_SIZE_MAX (MbAddr_SIZE+Func_Code_SIZE+Addr_SIZE+Qnt_SIZE+ByteCnt_SIZE)
-
+#endif
/** @brief Size of first part of message that will be received
first receive info part of message, than defines size of rest message*/
#define RX_FIRST_PART_SIZE INFO_SIZE_MAX
@@ -134,6 +141,10 @@ typedef struct
/** @brief Structure for modbus messsage */
typedef struct // RS_MsgTypeDef
{
+ uint16_t ID_Transaction;
+ uint16_t ID_Prot;
+ uint16_t PDU_Length;
+
uint8_t MbAddr; ///< Modbus Slave Address
MB_FunctonTypeDef Func_Code; ///< Modbus Function Code
MB_DevIdMsgTypeDef DevId; ///< Read Device Identification Header struct
diff --git a/john103C6T6/Modbus/rs_message.h b/john103C6T6/Modbus/rs_message.h
index 8131a52..6aaabd3 100644
--- a/john103C6T6/Modbus/rs_message.h
+++ b/john103C6T6/Modbus/rs_message.h
@@ -168,6 +168,8 @@ typedef struct
typedef struct // RS_HandleTypeDef
{
/* MESSAGE */
+
+
uint8_t ID; ///< ID of RS "channel"
RS_MsgTypeDef *pMessagePtr; ///< pointer to message struct
uint8_t *pBufferPtr; ///< pointer to message buffer
diff --git a/john103C6T6/john103C6T6.ioc b/john103C6T6/john103C6T6.ioc
index 1db9af6..cb1363d 100644
---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.Pin15=PB11
+Mcu.Pin16=PB12
+Mcu.Pin17=PB13
+Mcu.Pin18=PB14
+Mcu.Pin19=PB15
+Mcu.Pin2=PD1-OSC_OUT
+Mcu.Pin20=PA8
+Mcu.Pin21=PA9
+Mcu.Pin22=PA10
+Mcu.Pin23=PA11
+Mcu.Pin24=PA12
+Mcu.Pin25=PA13
+Mcu.Pin26=PA14
+Mcu.Pin27=PA15
+Mcu.Pin28=PB3
+Mcu.Pin29=PB4
+Mcu.Pin3=PA0-WKUP
+Mcu.Pin30=PB5
+Mcu.Pin31=PB6
+Mcu.Pin32=PB7
+Mcu.Pin33=PB8
+Mcu.Pin34=PB9
+Mcu.Pin35=VP_ADC1_TempSens_Input
+Mcu.Pin36=VP_ADC1_Vref_Input
+Mcu.Pin37=VP_RTC_VS_RTC_Activate
+Mcu.Pin38=VP_RTC_VS_RTC_Calendar
+Mcu.Pin39=VP_SYS_VS_tim3
+Mcu.Pin4=PA1
+Mcu.Pin40=VP_TIM1_VS_ClockSourceINT
+Mcu.Pin41=VP_TIM2_VS_ClockSourceINT
+Mcu.Pin5=PA2
+Mcu.Pin6=PA3
+Mcu.Pin7=PA4
+Mcu.Pin8=PA5
+Mcu.Pin9=PA6
+Mcu.PinsNb=42
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103C6Tx
@@ -173,10 +171,6 @@ PB9.Mode=I2C
PB9.Signal=I2C1_SDA
PC13-TAMPER-RTC.Mode=RTC OUT
PC13-TAMPER-RTC.Signal=RTC_OUT
-PC14-OSC32_IN.Mode=LSE-External-Oscillator
-PC14-OSC32_IN.Signal=RCC_OSC32_IN
-PC15-OSC32_OUT.Mode=LSE-External-Oscillator
-PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
PD0-OSC_IN.Mode=HSE-External-Oscillator
PD0-OSC_IN.Signal=RCC_OSC_IN
PD1-OSC_OUT.Mode=HSE-External-Oscillator