From e26a9c56978e0f0840db8f73262dba46841e4ba2 Mon Sep 17 00:00:00 2001
From: Jake <jake.read@cba.mit.edu>
Date: Sun, 10 Dec 2017 01:14:34 -0500
Subject: [PATCH] midpack test complete

---
 circuit/atsams70n-switch/atsams70n-switch.brd |   8 ++++---
 circuit/atsams70n-switch/eagle.epf            |   6 +++---
 embedded/README.md                            |  19 +++++++++++++++++
 .../.vs/atsams70-tinyrouter/v14/.atsuo        | Bin 123392 -> 124928 bytes
 .../atsams70-tinyrouter.cproj                 |   3 +++
 .../atsams70-tinyrouter/src/main.c            |  19 +++++++++++++++--
 .../atsams70-tinyrouter/src/node.h            |   2 +-
 .../atsams70-tinyrouter/src/ports.h           |   1 -
 .../atsams70-tinyrouter/src/testpins.h        |  20 ++++++++++++++++++
 .../atsams70-tinyrouter/src/tinyport.c        |   9 ++++++--
 .../atsams70-tinyrouter/src/tinyport.h        |   3 ++-
 11 files changed, 77 insertions(+), 13 deletions(-)
 create mode 100644 embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/testpins.h

diff --git a/circuit/atsams70n-switch/atsams70n-switch.brd b/circuit/atsams70n-switch/atsams70n-switch.brd
index e23bdb8..1898b5e 100644
--- a/circuit/atsams70n-switch/atsams70n-switch.brd
+++ b/circuit/atsams70n-switch/atsams70n-switch.brd
@@ -6,7 +6,7 @@
 <setting alwaysvectorfont="no"/>
 <setting verticaltext="up"/>
 </settings>
-<grid distance="20" unitdist="mil" unit="mil" style="lines" multiple="1" display="yes" altdistance="5" altunitdist="mil" altunit="mil"/>
+<grid distance="10" unitdist="mil" unit="mil" style="lines" multiple="1" display="yes" altdistance="5" altunitdist="mil" altunit="mil"/>
 <layers>
 <layer number="1" name="Top" color="4" fill="1" visible="yes" active="yes"/>
 <layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/>
@@ -205,8 +205,10 @@ cat</text>
 <text x="21.128990625" y="23.38705" size="0.8128" layer="21" font="vector" rot="R180">7</text>
 <text x="21.128990625" y="20.806409375" size="0.8128" layer="21" font="vector" rot="R180">5</text>
 <text x="21.128990625" y="18.22576875" size="0.8128" layer="21" font="vector" rot="R180">3</text>
-<dimension x1="11.684" y1="63.5" x2="11.684" y2="14.224" x3="0" y3="38.862" textsize="1.778" layer="48"/>
-<dimension x1="11.684" y1="63.5" x2="42.672" y2="63.5" x3="27.178" y3="70.104" textsize="1.778" layer="48"/>
+<dimension x1="11.684" y1="63.754" x2="11.684" y2="14.732" x3="1.27" y3="39.243" textsize="1.778" layer="48"/>
+<dimension x1="11.684" y1="63.754" x2="42.672" y2="63.754" x3="27.178" y3="69.342" textsize="1.778" layer="48"/>
+<dimension x1="11.684" y1="63.754" x2="11.684" y2="66.802" x3="-1.778" y3="65.278" textsize="1.778" layer="48"/>
+<dimension x1="11.684" y1="63.754" x2="8.636" y2="63.754" x3="10.16" y3="75.184" textsize="1.778" layer="48"/>
 </plain>
 <libraries>
 <library name="crystal" urn="urn:adsk.eagle:library:204">
diff --git a/circuit/atsams70n-switch/eagle.epf b/circuit/atsams70n-switch/eagle.epf
index 06b42d0..22ab89b 100644
--- a/circuit/atsams70n-switch/eagle.epf
+++ b/circuit/atsams70n-switch/eagle.epf
@@ -36,7 +36,7 @@ Loc="0 0 1919 1039"
 State=1
 Number=2
 File="atsams70n-switch.sch"
-View="-11.1752 -18.2176 175.417 87.9839"
+View="62.9279 -21.864 249.52 84.3376"
 WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.2032 0.254 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524"
 PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
 PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
@@ -75,7 +75,7 @@ ArcDirection=0
 AddLevel=2
 PadsSameType=0
 Layer=91
-Views=" 1: -11.1752 -18.2176 175.417 87.9839"
+Views=" 1: 62.9279 -21.864 249.52 84.3376"
 Sheet="1"
 
 [Win_2]
@@ -84,7 +84,7 @@ Loc="0 0 1919 1039"
 State=1
 Number=1
 File="atsams70n-switch.brd"
-View="30.9666 26.5371 36.7107 32.3263"
+View="16.7928 5.66944 52.3586 41.5147"
 WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.254 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.2032 0.1524 0.3048"
 PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
 PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
diff --git a/embedded/README.md b/embedded/README.md
index 643e82e..9f85828 100644
--- a/embedded/README.md
+++ b/embedded/README.md
@@ -4,6 +4,25 @@
 // test at higher bitrates?
 // how to do big packet pushing?
 // better app layer - and make sure to clear space?
+ - towards timing measurement
+
+// status updates & lambda function
+
+// testing ... 
+ - p1 -> hi when rx buffer non-empty
+ - p2 -> hi when packet handler has packet
+ - p3 -> hi when tx buffer non-empty
+
+# Results
+
+// do writeup
+
+In this screenshot, a falling edge on Channel 4 indicates an end of the main while() loop - so intervals between are packet processing and decision making. 
+
+see captures saved ... 43us processing time, the rest is bitrate
+
+-> can we push bitrate by improving rx / tx interrupts? eliminate everything, try cranking past brgr 6
+
 
 [0:start][1:destination-msb:9][2:hopcount][3:source][4:#bytestotal][byte_5][byte_7]...[byte_n] 0-255 bytes
 
diff --git a/embedded/atsams70-tinyrouter/.vs/atsams70-tinyrouter/v14/.atsuo b/embedded/atsams70-tinyrouter/.vs/atsams70-tinyrouter/v14/.atsuo
index 2f3bfe9144f9f7d07078ae8e07fd188986711ea3..082ba7adaec048943c11ddd3c6d49720b54ec6ce 100644
GIT binary patch
delta 3627
zcmZoT!rpL!eS(cB4+8@OGXn#|zyJULGcYhPFfuSOsBH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%;mY5Z3ZkcUVmXw_vTozssY3Od`o9pOrX_*-AnyPJ-URIjo84=`Km7bgx
z>SB^n9F-Ytl9Az<n3HYd;v8C)>}8^znCt7Poswn}UX|%v<!%`29vtrHYg+H0<&+gz
zm=#!(U7DQY=asJQo1f=io?aQ8XdIqxSXx?M9#QIAmhRymRO(WgnO|z+VeDq%pI?-3
z8em=?nCo0+lwa&rWa@4ntnF#)?B)|165>==VD1-Cs_*LV?i7`-?G)k|m}KJX9hg~Q
zkW%cQl4hKgZcwQms2^11npN+S5|md_n3!o2o|#<kUa0Nt=wx6SUKJT074DN!<!+kk
zT%jG}pIK(+Sm_>BVc~D$mztjJXP|B992Q*Q=@wa5kQ|s8>>cQ58J-iKSETJ>=oesa
z;O0|a>YJKplI<0eZL04ZSQ=DWSP|@5nd9OYp6};V9-5f%mE;!a=A4>S>>OZ_XX4|R
zV(I5%kXD$J=n_$xkzQ;W=A2XNrJo&H>1W{)RFRt!rf-syX`Y#s8{lo2o|P6^=IUvg
z?PyT!>#T3#n~`Xuo$8ot77^^P?ctT3nQq~fQXZaH6kd?(;*l6Q{k;mK1}~`P3vJ#q
zm~EG{VSL2D{YW+AT}DArLl7b(bl@Wc1B1f$cm9k*Y?Bu(U$ecSg)xhDy4Wg4h3N}>
z8NES`QL*WJrZc)s-!zHQWxGok;~v&!n;6+9J8s`JJz*jv_x8OL7@Zj>D>ij(@0h{Z
z&NW%-UF39!vy3yQ9bufkefAQ@RL1EKiWx<>_Z?$=%{rY?p7H<o|H~K|)hB;i;Jf|Q
z6-G1W?a?<GJ(;K9zs#5fD!bUGGaqFX-0pgpaW~WSi{}_qre|DZ6q_!8o$(<^<x&m+
DmrPiO

diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj
index 94e88c3..37e4667 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj
@@ -508,6 +508,9 @@
     <Compile Include="src\ringbuffer.h">
       <SubType>compile</SubType>
     </Compile>
+    <Compile Include="src\testpins.h">
+      <SubType>compile</SubType>
+    </Compile>
     <Compile Include="src\tinyport.c">
       <SubType>compile</SubType>
     </Compile>
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c
index cb1c915..231e973 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c
@@ -30,6 +30,7 @@
  */
 #include <asf.h>
 #include "pin.h"
+#include "testpins.h"
 #include "tinyport.h"
 #include "packet_handling.h"
 #include "ports.h"
@@ -187,6 +188,7 @@ int main (void){
 	tp4 = tinyport_new(UART4, PIOD, PERIPHERAL_C, PIO_PER_P18, PIO_PER_P19, &p4rbrx, &p4rbtx, &p4lr, &p4lg, &p4lb);
 
 	tp_init(&tp1);
+	UART2->UART_BRGR = 81; // manual set to FTDI speed
 	tp_init(&tp2);
 	tp_init(&tp3);
 	tp_init(&tp4);
@@ -207,6 +209,19 @@ int main (void){
 	ports[2] = &tp3;
 	ports[3] = &tp4;
 	
+	// test indicators
+	tstrx = pin_new(PIOD, PIO_PER_P8);
+	pin_output(&tstrx);
+	pin_clear(&tstrx);
+	tstpckt = pin_new(PIOD, PIO_PER_P6);
+	pin_output(&tstpckt);
+	pin_clear(&tstpckt);
+	tstclk = pin_new(PIOD, PIO_PER_P2);
+	pin_output(&tstclk);
+	pin_clear(&tsttx);
+	tsttx = pin_new(PIOD, PIO_PER_P4);
+	pin_output(&tsttx);
+	pin_clear(&tsttx);
 	
 	myAddress = MYADDRESS;
 	
@@ -219,13 +234,12 @@ int main (void){
 	packet_t packetlooper;
 
 	while(1){
-		
+		pin_set(&tstclk);
 		// loop over ports to run packet deciphering... allows quick handling of RXINT w/ simpler rxhandler
 		// each returns one packet at a time
 		for(int i = 0; i < 4; i++){
 			tp_packetparser(ports[i]);
 		}
-
 		for(int i = 0; i < 4; i++){ // loop over ports and check for packets, add packets to packet buffer
 			if(ports[i]->haspacket){
 
@@ -239,6 +253,7 @@ int main (void){
 				packet_clean(&packetlooper);
 			}
 		}
+		pin_clear(&tstclk);
 		delay_cycles(1); // one clock tick to relax interrupt scheduler
 	} // end while
 } // end main
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h
index dbe27ea..be97332 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h
@@ -2,7 +2,7 @@
 #define NODE_H_
 
 #define MAX_HOPCOUNT 6
-#define MYADDRESS 1
+#define MYADDRESS 3
 
 uint8_t LUT[1024][4];
 uint8_t myAddress;
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h
index 1c976b7..43e30b7 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h
@@ -48,5 +48,4 @@ pin_t p4lb;
 
 tinyport_t* ports[4];
 
-
 #endif /* PORTS_H_ */
\ No newline at end of file
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/testpins.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/testpins.h
new file mode 100644
index 0000000..8266da0
--- /dev/null
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/testpins.h
@@ -0,0 +1,20 @@
+/*
+ * testpins.h
+ *
+ * Created: 12/9/2017 11:34:09 PM
+ *  Author: Jake
+ */ 
+
+
+#ifndef TESTPINS_H_
+#define TESTPINS_H_
+
+#include "pin.h"
+
+// for testing
+pin_t tstrx; // MKHeader P24, PD8
+pin_t tsttx; // MKHeader P20, PD4
+pin_t tstpckt; // MKHeader P22, PD6
+pin_t tstclk; // MKHeader P18, PD2
+
+#endif /* TESTPINS_H_ */
\ No newline at end of file
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c
index 2e7086c..19e8e85 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c
@@ -35,8 +35,9 @@ void tp_init(tinyport_t *tp){
 	// do abcdsr - a, b, c, d | 00, 01, 10, 11
 	// this is handled in global setup
 	
-	tp->uart->UART_MR = UART_MR_BRSRCCK_PERIPH_CLK | UART_MR_CHMODE_NORMAL| UART_MR_PAR_NO | UART_MR_FILTER_DISABLED;
-	tp->uart->UART_BRGR = UART_BAUD_DIVIDER; 
+	tp->uart->UART_MR = UART_MR_BRSRCCK_PERIPH_CLK | UART_MR_CHMODE_NORMAL | UART_MR_PAR_NO | UART_MR_FILTER_DISABLED;
+	tp->uart->UART_BRGR = UART_BAUD_DIVIDER;
+	
 	tp->uart->UART_CR = UART_CR_TXEN | UART_CR_RXEN;
 	
 	tp->uart->UART_IER = UART_IER_RXRDY;
@@ -66,6 +67,7 @@ void tp_rxhandler(tinyport_t *tp){
 	uint8_t data = tp->uart->UART_RHR;
 	rb_putchar(tp->rbrx, data);
 	pin_clear(tp->stlb);
+	pin_set(&tstrx);
 }
 
 void tp_packetparser(tinyport_t *tp){
@@ -107,6 +109,7 @@ void tp_packetparser(tinyport_t *tp){
 					tp->haspacket = TP_HAS_PACKET; // this data is final byte, we have packet, this will be last tick in loop
 					tp->packetstate = TP_PACKETSTATE_OUTSIDE; // and we're outside again
 					pin_set(tp->stlb);
+					pin_clear(&tstrx);
 				}
 				break;
 				
@@ -121,9 +124,11 @@ void tp_txhandler(tinyport_t *tp){
 	if(!rb_empty(tp->rbtx)){
 		tp->uart->UART_THR = rb_get(tp->rbtx);
 		pin_clear(tp->stlg);
+		pin_set(&tsttx);
 	} else {
 		tp->uart->UART_IDR = UART_IER_TXRDY; // if nothing left to tx, turn isr off
 		pin_set(tp->stlg);
+		pin_clear(&tsttx); // tricky, adding these increases transfer time... 
 	}
 	//while(!(tp->uart->UART_SR & UART_SR_TXRDY)); // blocking
 }
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h
index 98809d3..9f51993 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h
@@ -48,11 +48,12 @@
 // packet delimiters
 #define TP_DELIMITER_START 255
 
-#define UART_BAUD_DIVIDER 81 // 977: 9600 baud, 81: 115200, 10: 921600
+#define UART_BAUD_DIVIDER 6 // 977: 9600 baud, 81: 115200, 10: 921600: newclock: 63: 115200
 #define RINGBUFFER_SIZE 1024 // in bytes, or 4 full length packets, have 384KBytes total in system
 
 #include "asf.h"
 #include "pin.h"
+#include "testpins.h"
 #include "ringbuffer.h"
 #include "packet.h"
 
-- 
GitLab