Added a MSTP monitor build for BACnet Development Kit. Use 'make BUILD=monitor' with Makefile. Uses second serial port at 115200, and can be monitored using mstpcap utility.

This commit is contained in:
skarg
2010-07-18 20:22:24 +00:00
parent a298d07b9a
commit c0d63a1ed0
4 changed files with 28 additions and 1 deletions
+5 -1
View File
@@ -155,6 +155,10 @@ ifeq (${BUILD},release)
OPTIMIZATION = -Os $(OPTIMIZE_FLAGS)
DEBUGGING = -DNDEBUG
endif
ifeq (${BUILD},monitor)
OPTIMIZATION = -Os $(OPTIMIZE_FLAGS)
DEBUGGING = -DNDEBUG -DMSTP_MONITOR
endif
## BACnet options
BFLAGS = -DBACDL_MSTP
@@ -271,7 +275,7 @@ AVRDUDE_WRITE_FLASH = -e -U flash:w:$(TARGET).hex
AVRDUDE_INSTALL = $(AVRDUDE_WRITE_FLASH)
#AVRDUDE_INSTALL += $(AVRDUDE_WRITE_FUSES)
## Objects that must be built in order to link
## Objects not in library that must be built in order to link
OBJECTS = $(COBJ) $(DEMOOBJ)
## Build
@@ -31,6 +31,7 @@
#include "nvdata.h"
#include "rs485.h"
#include "input.h"
#include "adc.h"
/* BACnet Stack includes */
#include "datalink.h"
#include "npdu.h"
@@ -108,6 +108,9 @@ ISR(USART0_RX_vect)
if (BIT_CHECK(UCSR0A, RXC0)) {
/* data is available */
data_byte = UDR0;
#ifdef MSTP_MONITOR
UDR1 = data_byte;
#endif
(void) FIFO_Put(&Receive_Buffer, data_byte);
timer_elapsed_start(&Silence_Timer);
}
@@ -144,6 +147,9 @@ void rs485_bytes_send(
while (nbytes) {
/* Send the data byte */
UDR0 = *buffer;
#ifdef MSTP_MONITOR
UDR1 = *buffer;
#endif
while (!BIT_CHECK(UCSR0A, UDRE0)) {
/* do nothing - wait until Tx buffer is empty */
}
+16
View File
@@ -39,9 +39,24 @@ static uint8_t MSTP_MAC_Address;
void test_init(
void)
{
#ifdef MSTP_MONITOR
serial_baud_rate_set(115200);
#else
serial_baud_rate_set(9600);
#endif
timer_interval_start_seconds(&Test_Timer, 1);
}
#ifdef MSTP_MONITOR
void test_task(
void)
{
if (timer_interval_expired(&Test_Timer)) {
timer_interval_reset(&Test_Timer);
MSTP_MAC_Address = MSTP_MAC_Address;
}
}
#else
void test_task(
void)
{
@@ -81,3 +96,4 @@ void test_task(
serial_byte_transmit_complete();
}
}
#endif