From e9bf0ba7306afec2d1c46fed23626d557b22def4 Mon Sep 17 00:00:00 2001
From: Jake Read <jake.read@cba.mit.edu>
Date: Mon, 6 Dec 2021 13:39:13 -0500
Subject: [PATCH] qdec notes

---
 circuit/2021-12_fab-step-cl/eagle.epf | 75 ++++++---------------------
 log/fab-step-log.md                   | 14 ++++-
 2 files changed, 28 insertions(+), 61 deletions(-)

diff --git a/circuit/2021-12_fab-step-cl/eagle.epf b/circuit/2021-12_fab-step-cl/eagle.epf
index 4660be7..6506c66 100644
--- a/circuit/2021-12_fab-step-cl/eagle.epf
+++ b/circuit/2021-12_fab-step-cl/eagle.epf
@@ -24,17 +24,17 @@ UsedLibrary="C:/Dropbox/CBA/circuits/eagle/parts/usbraw.lbr"
 UsedLibrary="C:/Dropbox/CBA/circuits/eagle/parts/SparkFun-Eagle-Libraries/SparkFun-Connectors.lbr"
 
 [Win_1]
-Type="Library Editor"
-Number=3
-File="C:/Dropbox/CBA/circuits/eagle/parts/SparkFun-Eagle-Libraries/SparkFun-Connectors.lbr"
-View="-3.82317 -1.88715 4.60415 6.22817"
-WireWidths=" 0.0762 0.1016 0.15 0.2 0.2032 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524 0.254 0.127"
+Type="Schematic Editor"
+Number=1
+File="fab-step-cl.sch"
+View="-29.8949 -94.1149 526.668 245.687"
+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"
 ViaDiameters=" 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.3 0"
 ViaDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
 HoleDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
-TextSizes=" 0.254 0.3048 0.4064 0.6096 1.016 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 0.8128 1.27"
+TextSizes=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778"
 PolygonSpacings=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.27"
 PolygonIsolates=" 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"
 MiterRadiuss=" 0.254 0.3175 0.635 1.27 2.54 1 2 2.5 5 7.5 10 0"
@@ -42,9 +42,9 @@ DimensionWidths=" 0 0.127 0.254 0.1 0.26 0.13"
 DimensionExtWidths=" 0.127 0.254 0.1 0.13 0.26 0"
 DimensionExtLengths=" 1.27 2.54 1 2 3 0"
 DimensionExtOffsets=" 1.27 2.54 1 2 3 0"
-SmdSizes=" 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635 1.4 0.4 1.4 0.3 1.4 0.2 1.4 0.25 1.4 0.275 1.4 0.225 1.4 0.22"
+SmdSizes=" 0.3048 0.1524 0.4064 0.2032 0.6096 0.3048 0.8128 0.4064 1.016 0.508 1.27 0.6604 1.4224 0.7112 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635"
 WireBend=0
-WireBendSet=0
+WireBendSet=31
 WireCap=1
 MiterStyle=1
 PadShape=0
@@ -65,20 +65,22 @@ SwapLevel=0
 ArcDirection=0
 AddLevel=2
 PadsSameType=0
-Layer=21
+Layer=91
+Views=" 1: -29.8949 -94.1149 526.668 245.687"
+Sheet="1"
 
 [Win_2]
 Type="Board Editor"
 Number=2
 File="fab-step-cl.brd"
-View="7.16701 -8.3205 64.5228 51.6356"
+View="0.563647 -11.9702 69.3906 59.9774"
 WireWidths=" 0.127 0.2 1.016 1.27 2.54 0.15 0.0762 0.8128 0 0.254 0.2032 0.3048 0.4064 0.508 0.6096 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"
 ViaDiameters=" 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.3 0"
 ViaDrills=" 0.25 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35 0.8382 0.3"
 HoleDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
-TextSizes=" 0.254 0.3048 0.4064 0.6096 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 0.8128"
+TextSizes=" 0.254 0.3048 0.4064 0.6096 1.016 1.27 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 0.8128 1.4224"
 PolygonSpacings=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.27"
 PolygonIsolates=" 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"
 MiterRadiuss=" 0.254 0.3175 0.635 1.27 2.54 1 2 2.5 5 7.5 10 0"
@@ -87,7 +89,7 @@ DimensionExtWidths=" 0.127 0.254 0.1 0.13 0.26 0"
 DimensionExtLengths=" 1.27 2.54 1 2 3 0"
 DimensionExtOffsets=" 1.27 2.54 1 2 3 0"
 SmdSizes=" 0.3048 0.1524 0.4064 0.2032 0.6096 0.3048 0.8128 0.4064 1.016 0.508 1.27 0.6604 1.4224 0.7112 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635"
-WireBend=1
+WireBend=3
 WireBendSet=0
 WireCap=1
 MiterStyle=1
@@ -109,55 +111,9 @@ SwapLevel=0
 ArcDirection=0
 AddLevel=2
 PadsSameType=0
-Layer=1
+Layer=47
 
 [Win_3]
-Type="Schematic Editor"
-Number=1
-File="fab-step-cl.sch"
-View="265.524 3.41067 355.412 58.2906"
-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"
-ViaDiameters=" 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.3 0"
-ViaDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
-HoleDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
-TextSizes=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778"
-PolygonSpacings=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.27"
-PolygonIsolates=" 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"
-MiterRadiuss=" 0.254 0.3175 0.635 1.27 2.54 1 2 2.5 5 7.5 10 0"
-DimensionWidths=" 0 0.127 0.254 0.1 0.26 0.13"
-DimensionExtWidths=" 0.127 0.254 0.1 0.13 0.26 0"
-DimensionExtLengths=" 1.27 2.54 1 2 3 0"
-DimensionExtOffsets=" 1.27 2.54 1 2 3 0"
-SmdSizes=" 0.3048 0.1524 0.4064 0.2032 0.6096 0.3048 0.8128 0.4064 1.016 0.508 1.27 0.6604 1.4224 0.7112 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635"
-WireBend=0
-WireBendSet=31
-WireCap=1
-MiterStyle=1
-PadShape=0
-ViaShape=1
-PolygonPour=0
-PolygonRank=0
-PolygonThermals=1
-PolygonOrphans=0
-TextRatio=8
-DimensionUnit=1
-DimensionPrecision=2
-DimensionShowUnit=0
-PinDirection=3
-PinFunction=0
-PinLength=2
-PinVisible=3
-SwapLevel=0
-ArcDirection=0
-AddLevel=2
-PadsSameType=0
-Layer=91
-Views=" 1: 265.524 3.41067 355.412 58.2906"
-Sheet="1"
-
-[Win_4]
 Type="Control Panel"
 Number=0
 
@@ -166,4 +122,3 @@ Screen="1920 1080"
 Window="Win_1"
 Window="Win_2"
 Window="Win_3"
-Window="Win_4"
diff --git a/log/fab-step-log.md b/log/fab-step-log.md
index 19f1b84..dca9a10 100644
--- a/log/fab-step-log.md
+++ b/log/fab-step-log.md
@@ -141,4 +141,16 @@ More or less done w/ this now;
 ![routed](images/2021-12-06_routed.png)
 ![schematic](images/2021-12-06_schematic.png)
 
-Sending these to fab, doing orders, then we're off. I leave the actual CAD design of the mount, etc, to myself in the future. 
\ No newline at end of file
+Sending these to fab, doing orders, then we're off. I leave the actual CAD design of the mount, etc, to myself in the future. 
+
+### Quadrature Decoding 
+
+Ah - one last thing. Dave pointed out that I should have paid attention to the rate of quadrature signal generation - so I had an ohshit moment for this...
+
+There's a sheet now, basically I wanted to know how long between pulses at certain rates. This is kind of punishing... I can do 1024 PPR @ 1K RPM makes for 5.8us between pulse, if I go to the encoder's full 4096 PPR I get 1.46us: a lot. 
+
+So I have ordered this part `LS7366R-S` which is a hardware counter (SPI interface) that I could inter-pose between the encoder, my circuit, etc... and I just noticed that simpleFOC uses interrupts, seems fine. Here's [their doc](https://docs.simplefoc.com/encoder). 
+
+For the interrupts - my beef is that I have some i.e. ~ 4us (?) interrupts happening pretty regularely on the UCBus, so adding this additional requirement is troublesome.
+
+I need to know if interrupts can interrupt others - haha - otherwise a 2us QDEC interrupt spacing on top of a 5us comms interrupt will miss a tick. 
\ No newline at end of file
-- 
GitLab