From 03dfa101c9fdb5f178c4b47d75bce491f14db757 Mon Sep 17 00:00:00 2001 From: skarg Date: Mon, 20 Aug 2007 19:39:36 +0000 Subject: [PATCH] Adjusted the minimum Turnaround time for ARM and AVR ports to give a minimum since there are errors induced from the clock and from rounding. --- bacnet-stack/ports/at91sam7s/makefile | 4 +++- bacnet-stack/ports/at91sam7s/rs485.c | 8 +++----- bacnet-stack/ports/atmega168/rs485.c | 8 +++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/bacnet-stack/ports/at91sam7s/makefile b/bacnet-stack/ports/at91sam7s/makefile index 9a9f9415..6d71d92a 100644 --- a/bacnet-stack/ports/at91sam7s/makefile +++ b/bacnet-stack/ports/at91sam7s/makefile @@ -8,6 +8,7 @@ CC=arm-elf-gcc OBJCOPY=arm-elf-objcopy OBJDUMP=arm-elf-objdump AR=arm-elf-ar +SIZE = arm-elf-size LDSCRIPT=at91sam7s256.ld @@ -79,8 +80,9 @@ AOBJ = $(ASRC:.s=.o) COBJ = $(CSRC:.c=.o) COREOBJ = $(CORESRC:.c=.o) -all: $(TARGET).bin +all: $(TARGET).bin $(TARGET).elf $(OBJDUMP) $(ODFLAGS) $(TARGET).elf > $(TARGET).dmp + $(SIZE) $(TARGET).elf $(TARGET).bin: $(TARGET).elf $(OBJCOPY) $(TARGET).elf $(CPFLAGS) $(TARGET).bin diff --git a/bacnet-stack/ports/at91sam7s/rs485.c b/bacnet-stack/ports/at91sam7s/rs485.c index 4bc92abb..96996ff0 100644 --- a/bacnet-stack/ports/at91sam7s/rs485.c +++ b/bacnet-stack/ports/at91sam7s/rs485.c @@ -162,11 +162,9 @@ void RS485_Send_Frame( /* delay after reception - per MS/TP spec */ if (mstp_port) { - /* wait about 40 bit times since reception */ - turnaround_time = (40*1000)/RS485_Baud; - if (!turnaround_time) { - turnaround_time = 1; - } + /* wait a minimum 40 bit times since reception */ + /* at least 1 ms for errors: rounding, clock tick */ + turnaround_time = 1 + ((Tturnaround*1000)/RS485_Baud); while (mstp_port->SilenceTimer() < turnaround_time) { /* do nothing - wait for timer to increment */ }; diff --git a/bacnet-stack/ports/atmega168/rs485.c b/bacnet-stack/ports/atmega168/rs485.c index a96ab9a1..9e629e57 100644 --- a/bacnet-stack/ports/atmega168/rs485.c +++ b/bacnet-stack/ports/atmega168/rs485.c @@ -123,11 +123,9 @@ void RS485_Send_Frame( /* delay after reception - per MS/TP spec */ if (mstp_port) { - /* wait about 40 bit times since reception */ - turnaround_time = (Tturnaround*1000UL)/RS485_Baud; - if (!turnaround_time) { - turnaround_time = 1; - } + /* wait a minimum 40 bit times since reception */ + /* at least 1 ms for errors: rounding, clock tick */ + turnaround_time = 1 + ((Tturnaround*1000UL)/RS485_Baud); while (mstp_port->SilenceTimer() < turnaround_time) { /* do nothing - wait for timer to increment */ };