Compare View

switch
from
...
to
 
Commits (3)
CMakeLists.txt
... ... @@ -59,6 +59,7 @@ set(
59 59 soft_uart_serial_test_half_duplex
60 60 soft_uart_serial_test_half_duplex_9O2
61 61 soft_uart_serial_test_half_duplex_char
  62 + echo_test
62 63 )
63 64  
64 65 foreach(src_example ${SOFT_UART_EXAMPLES})
... ...
README.md
1   -## soft_uart v2.0
  1 +## soft_uart v3.0
2 2  
3 3 This is soft_uart library for the Arduino DUE electronic prototyping platform.
4 4  
5   -Copyright (C) 2015 Antonio C. Domínguez Brito (<adominguez@iusiani.ulpgc.es>). División de Robótica y Oceanografía Computacional (<http://www.roc.siani.es>) and Departamento de Informática y Sistemas (<http://www.dis.ulpgc.es>). Universidad de Las Palmas de Gran Canaria (ULPGC) (<http://www.ulpgc.es>).
  5 +Copyright (C) 2015-2018 Antonio C. Domínguez Brito (<adominguez@iusiani.ulpgc.es>). División de Robótica y Oceanografía Computacional (<http://www.roc.siani.es>) and Departamento de Informática y Sistemas (<http://www.dis.ulpgc.es>). Universidad de Las Palmas de Gran Canaria (ULPGC) (<http://www.ulpgc.es>).
6 6  
7 7 ### 0. License
8 8  
... ... @@ -137,8 +137,14 @@ In this section we would like to enumerate users using the library in their own
137 137  
138 138 The list of users/projects goes now:
139 139  
140   -1. **Project:** Autonomous sailboat A-Tirma (<http://velerorobot.blogspot.com.es>). **User**: División de Robótica y Oceanografía Computacional (<http://www.roc.siani.es>). **Description**: The library was a specific development for this project. The sailboat onboard system is based on an Arduino DUE, and we ran out of hardware serial ports for all the hardware we use on the boat.
  140 +1. **Project:** Autonomous sailboat A-Tirma (<http://velerorobot.blogspot.com.es>). **User:** División de Robótica y Oceanografía Computacional (<http://www.roc.siani.es>). **Description:** The library was a specific development for this project. The sailboat onboard system is based on an Arduino DUE, and we ran out of hardware serial ports for all the hardware we use on the boat.
141 141  
142   -### 8. Feedback & Suggestions
  142 +2. **Project:** Arduino Altair 8800 simulator (<https://github.com/dhansel/Altair8800>). **User:** David Hansel (<david@hansels.net>). **Description:** Source code for Arduino Altair 8800 simulator.
  143 +
  144 +### 8. Acknowledgements
  145 +
  146 +David Hansel for his suggestions and debugging of the library, soft_uart version 2.0 and 3.0 owe a lot to his findings.
  147 +
  148 +### 9. Feedback & Suggestions
143 149  
144 150 Please be free to send me any comment, doubt of use, or suggestion in relation to soft_uart.
... ...
examples/basic_test/basic_test.ino
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
examples/soft_uart_serial_test/soft_uart_serial_test.ino
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ... @@ -40,7 +40,7 @@ using namespace arduino_due;
40 40  
41 41 #define RX_PIN 10 // software serial port's reception pin
42 42 #define TX_PIN 11 // software serial port's transmision pin
43   -#define SOFT_UART_BIT_RATE 115200 // 57600 38400 1200 19200 9600 115200 300
  43 +#define SOFT_UART_BIT_RATE 57600 // 57600 38400 1200 19200 9600 115200 300
44 44 #define RX_BUF_LENGTH 256 // software serial port's reception buffer length
45 45 #define TX_BUF_LENGTH 256 // software serial port's transmision buffer length
46 46 #define RECEPTION_TIMEOUT 100 // milliseconds
... ...
examples/soft_uart_serial_test_auto/soft_uart_serial_test_auto.ino
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
examples/soft_uart_serial_test_half_duplex/soft_uart_serial_test_half_duplex.ino
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
examples/soft_uart_serial_test_half_duplex_9O2/soft_uart_serial_test_half_duplex_9O2.ino
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
examples/soft_uart_serial_test_half_duplex_char/soft_uart_serial_test_half_duplex_char.ino
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
fifo.h
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
library.properties
1 1 name=soft_uart
2   -version=2.0
  2 +version=3.0
3 3 author=Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
4 4 maintainer=Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
5 5 sentence=This is an implementation of a software UART (Universal Asynchronous Receiver Transmitter) library for the Arduino Due's Atmel ATSAM3X8E micro-controller.
... ...
soft_uart.cpp
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...
soft_uart.h
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ... @@ -670,6 +670,7 @@ namespace arduino_due
670 670 double frame_time;
671 671 uint32_t bit_ticks;
672 672 uint32_t bit_1st_half;
  673 + uint32_t bit_1st_quarter;
673 674  
674 675 // serial protocol
675 676 uint32_t bit_rate;
... ... @@ -923,6 +924,7 @@ namespace arduino_due
923 924  
924 925 bit_ticks=static_cast<uint32_t>(bit_time/tc_tick);
925 926 bit_1st_half=(bit_ticks>>1);
  927 + bit_1st_quarter=(bit_ticks>>2);
926 928  
927 929 data_bits=the_data_bits; parity=the_parity; stop_bits=the_stop_bits;
928 930  
... ... @@ -991,7 +993,8 @@ namespace arduino_due
991 993 //disable_tc_ra_interrupt();
992 994  
993 995 //TC_SetRC(timer_p->tc_p,timer_p->channel,bit_ticks);
994   - TC_SetRC(timer_p->tc_p,timer_p->channel,bit_1st_half);
  996 + //TC_SetRC(timer_p->tc_p,timer_p->channel,bit_1st_half);
  997 + TC_SetRC(timer_p->tc_p,timer_p->channel,bit_1st_quarter);
995 998 //disable_tc_rc_interrupt();
996 999 enable_tc_rc_interrupt();
997 1000  
... ... @@ -1020,10 +1023,11 @@ namespace arduino_due
1020 1023 // rx code
1021 1024 if(rx_status==rx_status_codes::RECEIVING)
1022 1025 {
1023   - if((rx_interrupt_counter++)&1)
  1026 + if(rx_interrupt_counter==1)
1024 1027 {
1025   - get_incoming_bit();
1026   - if((rx_bit_counter++)==rx_frame_bits-1)
  1028 + get_incoming_bit();
  1029 + rx_bit_counter++;
  1030 + if(rx_bit_counter==rx_frame_bits)
1027 1031 {
1028 1032 if(stop_bits==stop_bit_codes::TWO_STOP_BITS)
1029 1033 get_incoming_bit();
... ... @@ -1035,27 +1039,33 @@ namespace arduino_due
1035 1039 rx_status=rx_status_codes::LISTENING;
1036 1040 }
1037 1041 }
  1042 + rx_interrupt_counter=(rx_interrupt_counter+1)&0x3;
1038 1043 }
1039 1044  
1040 1045 // tx code
1041 1046 if(tx_status==tx_status_codes::SENDING)
1042 1047 {
1043   - if((tx_interrupt_counter++)&1)
  1048 + if(tx_interrupt_counter==0)
1044 1049 {
1045   - set_outgoing_bit();
1046   - if((tx_bit_counter++)==tx_frame_bits-1)
  1050 + if(tx_bit_counter>=tx_frame_bits)
1047 1051 {
1048 1052 uint32_t data_to_send;
1049 1053 if(tx_buffer.pop(data_to_send))
1050   - { tx_data=data_to_send; tx_bit_counter=0; }
  1054 + {
  1055 + tx_data=data_to_send; tx_bit_counter=0;
  1056 + set_outgoing_bit(); tx_bit_counter++;
  1057 + }
1051 1058 else
1052 1059 {
1053   - if(rx_status==rx_status_codes::LISTENING) stop_tc_interrupts();
  1060 + if(rx_status==rx_status_codes::LISTENING)
  1061 + stop_tc_interrupts();
1054 1062  
1055 1063 tx_status=tx_status_codes::IDLE;
1056 1064 }
1057 1065 }
  1066 + else { set_outgoing_bit(); tx_bit_counter++; }
1058 1067 }
  1068 + tx_interrupt_counter=(tx_interrupt_counter+1)&0x3;
1059 1069 }
1060 1070 }
1061 1071 }
... ... @@ -1080,16 +1090,16 @@ namespace arduino_due
1080 1090 {
1081 1091 rx_status=rx_status_codes::RECEIVING;
1082 1092 rx_data=rx_bit_counter=rx_bit=0;
1083   - rx_interrupt_counter=1;
  1093 + rx_interrupt_counter=0;
1084 1094  
1085 1095 if(tx_status==tx_status_codes::IDLE) start_tc_interrupts();
1086   - else
1087   - {
1088   - register uint32_t timer_value=
1089   - TC_ReadCV(timer_p->tc_p,timer_p->channel);
  1096 + //else
  1097 + //{
  1098 + // register uint32_t timer_value=
  1099 + // TC_ReadCV(timer_p->tc_p,timer_p->channel);
1090 1100  
1091   - if(timer_value>=(bit_1st_half>>1)) rx_interrupt_counter=0;
1092   - }
  1101 + // if(timer_value>=(bit_1st_half>>1)) rx_interrupt_counter=0;
  1102 + //}
1093 1103 }
1094 1104 break;
1095 1105  
... ... @@ -1213,7 +1223,7 @@ namespace arduino_due
1213 1223 {
1214 1224 tx_buffer.pop(data_to_send);
1215 1225 tx_data=data_to_send; tx_bit_counter=0;
1216   - tx_interrupt_counter=1;
  1226 + tx_interrupt_counter=0;
1217 1227 }
1218 1228  
1219 1229 if(
... ...
soft_uart_license_header.txt
1 1 /**
2 2 ** soft_uart library
3   - ** Copyright (C) 2015
  3 + ** Copyright (C) 2015-2018
4 4 **
5 5 ** Antonio C. Domínguez Brito <adominguez@iusiani.ulpgc.es>
6 6 ** División de Robótica y Oceanografía Computacional <www.roc.siani.es>
... ...