Feature/mstp extended frames (#529)

* added MSTP extended frames to bacnet/datalink/mstp.c module. Thank you, Simon!

* auto-size some FIFO buffers for MSTP

* add COBS library to MSTP builds

---------

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2023-11-08 15:54:18 -06:00
committed by GitHub
parent 2536d5a350
commit 1372e52aa7
22 changed files with 109 additions and 32 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ static uint32_t Baud_Rate = 9600;
/* turnaround_time_milliseconds = (Tturnaround*1000UL)/Baud_Rate; */
/* buffer for storing received bytes - size must be power of two */
static uint8_t Receive_Buffer_Data[128];
static uint8_t Receive_Buffer_Data[256];
static FIFO_BUFFER Receive_Buffer;
static struct mstimer Silence_Timer;
+2 -2
View File
@@ -46,9 +46,9 @@ FIFO_BUFFER FIFO_Rx;
FIFO_BUFFER FIFO_Tx;
#pragma udata MSTPPortData
/* the buffer for receiving data (size must be a power of 2) */
volatile uint8_t RS485_Rx_Buffer[128];
volatile uint8_t RS485_Rx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
/* the buffer for sending data (size must be a power of 2) */
volatile uint8_t RS485_Tx_Buffer[128];
volatile uint8_t RS485_Tx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
#pragma udata
/****************************************************************************
+2 -2
View File
@@ -46,9 +46,9 @@ FIFO_BUFFER FIFO_Rx;
FIFO_BUFFER FIFO_Tx;
#pragma udata MSTPPortData
/* the buffer for receiving data (size must be a power of 2) */
volatile uint8_t RS485_Rx_Buffer[128];
volatile uint8_t RS485_Rx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
/* the buffer for sending data (size must be a power of 2) */
volatile uint8_t RS485_Tx_Buffer[128];
volatile uint8_t RS485_Tx_Buffer[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
#pragma udata
/****************************************************************************
+2 -1
View File
@@ -30,12 +30,13 @@
#include "hardware.h"
#include "bacnet/basic/sys/mstimer.h"
#include "bacnet/bits.h"
#include "bacnet/datalink/dlmstp.h"
#include "bacnet/basic/sys/fifo.h"
#include "led.h"
#include "rs485.h"
/* buffer for storing received bytes - size must be power of two */
static uint8_t Receive_Buffer_Data[512];
static uint8_t Receive_Buffer_Data[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
static FIFO_BUFFER Receive_Buffer;
/* amount of silence on the wire */
static struct mstimer Silence_Timer;
+1 -1
View File
@@ -137,7 +137,7 @@ OPTIMIZE_FLAGS += -DNDEBUG
BACNET_FLAGS = -DBACDL_MSTP=1
BACNET_FLAGS += -DBACAPP_ALL
BACNET_FLAGS += -DMAX_APDU=480
BACNET_FLAGS += -DMAX_APDU=1476
BACNET_FLAGS += -DBIG_ENDIAN=0
BACNET_FLAGS += -DMAX_TSM_TRANSACTIONS=0
BACNET_FLAGS += -DMAX_CHARACTER_STRING_BYTES=64
+1 -1
View File
@@ -224,7 +224,7 @@
<state>USE_STDPERIPH_DRIVER</state>
<state>STM32F4XX</state>
<state>BACDL_MSTP</state>
<state>MAX_APDU=480</state>
<state>MAX_APDU=1476</state>
<state>BIG_ENDIAN=0</state>
<state>MAX_TSM_TRANSACTIONS=1</state>
</option>
+5 -4
View File
@@ -33,17 +33,18 @@
#include "bacnet/basic/sys/mstimer.h"
#include "bacnet/bits.h"
#include "bacnet/basic/sys/fifo.h"
#include "bacnet/datalink/dlmstp.h"
#include "bacnet/datalink/mstpdef.h"
#include "rs485.h"
/* buffer for storing received bytes - size must be power of two */
/* BACnet DLMSTP_MPDU_MAX for MS/TP is 501 bytes */
static uint8_t Receive_Queue_Data[512];
/* BACnet DLMSTP_MPDU_MAX for MS/TP is 1501 bytes */
static uint8_t Receive_Queue_Data[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
static FIFO_BUFFER Receive_Queue;
/* buffer for storing bytes to transmit */
/* BACnet DLMSTP_MPDU_MAX for MS/TP is 501 bytes */
static uint8_t Transmit_Queue_Data[512];
/* BACnet DLMSTP_MPDU_MAX for MS/TP is 1501 bytes */
static uint8_t Transmit_Queue_Data[NEXT_POWER_OF_2(DLMSTP_MPDU_MAX)];
static FIFO_BUFFER Transmit_Queue;
/* baud rate of the UART interface */
@@ -201,6 +201,7 @@
<ClCompile Include="..\..\..\..\src\bacnet\lighting.c" />
<ClCompile Include="..\..\..\..\src\bacnet\lso.c" />
<ClCompile Include="..\..\..\..\src\bacnet\memcopy.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\cobs.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\mstp.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\mstptext.c" />
<ClCompile Include="..\..\..\..\src\bacnet\npdu.c" />
@@ -161,6 +161,7 @@
<ClCompile Include="..\..\..\..\src\bacnet\datalink\crc.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\datalink.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\dlenv.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\cobs.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\mstp.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datalink\mstptext.c" />
<ClCompile Include="..\..\..\..\src\bacnet\datetime.c" />
+2 -1
View File
@@ -35,8 +35,9 @@
#include "sysclk.h"
#include "bacnet/basic/sys/fifo.h"
#include "bacnet/basic/sys/mstimer.h"
#include "led.h"
#include "bacnet/datalink/dlmstp.h"
#include "bacnet/datalink/mstpdef.h"
#include "led.h"
/* me! */
#include "rs485.h"