Commit ad0bd0a9 authored by Jake Read's avatar Jake Read

pwm cycles working

parent 48d5c0f7
......@@ -11,6 +11,7 @@ Power is bussed to the board with two M3 Screw Terminals. The board includes roo
## Notes
- label lights
- wants one lo-side debug pin!
- might have to go to DRV8320 - newer, available
- CSD88548 is CSD88599 but more amps less volts, use these
......
......@@ -6,7 +6,7 @@
<setting alwaysvectorfont="no"/>
<setting verticaltext="up"/>
</settings>
<grid distance="0.5" unitdist="mm" unit="mm" style="dots" multiple="1" display="yes" altdistance="5" altunitdist="mil" altunit="mil"/>
<grid distance="0.1" unitdist="mm" unit="mm" style="dots" 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="2" name="Route2" color="1" fill="3" visible="no" active="no"/>
......@@ -3024,111 +3024,6 @@ design rules under a new name.</description>
<wire x1="49.1" y1="39.8" x2="49.05" y2="39.75" width="0.1524" layer="1"/>
<wire x1="49.05" y1="39.75" x2="49.05" y2="38.3" width="0.1524" layer="1"/>
</signal>
<signal name="PWMLO2">
<contactref element="U2" pad="P$20"/>
<contactref element="U1" pad="18"/>
<wire x1="66.000009375" y1="44.000003125" x2="64.537884375" y2="44.000003125" width="0.1524" layer="1"/>
<wire x1="64.537884375" y1="44.000003125" x2="64.0856875" y2="44.4522" width="0.1524" layer="1"/>
<wire x1="64.0856875" y1="44.4522" x2="60.9002875" y2="44.4522" width="0.1524" layer="1"/>
<wire x1="57.9856" y1="47.3668875" x2="57.9856" y2="47.9144" width="0.1524" layer="1"/>
<wire x1="60.9002875" y1="44.4522" x2="57.9856" y2="47.3668875" width="0.1524" layer="1"/>
<wire x1="57.4" y1="48.5" x2="55.5" y2="48.5" width="0.1524" layer="1"/>
<wire x1="55.5" y1="48.5" x2="54.7" y2="49.3" width="0.1524" layer="1"/>
<wire x1="57.9856" y1="47.9144" x2="57.4" y2="48.5" width="0.1524" layer="1"/>
<wire x1="54.7" y1="49.3" x2="54.7" y2="49.9378875" width="0.1524" layer="1"/>
<wire x1="54.7" y1="49.9378875" x2="52.8474875" y2="51.7904" width="0.1524" layer="1"/>
<wire x1="49.15" y1="51.55" x2="49.15" y2="51.1" width="0.1524" layer="1"/>
<wire x1="52.8474875" y1="51.7904" x2="49.3904" y2="51.7904" width="0.1524" layer="1"/>
<wire x1="49.3904" y1="51.7904" x2="49.15" y2="51.55" width="0.1524" layer="1"/>
</signal>
<signal name="PWMLO3">
<contactref element="U2" pad="P$22"/>
<contactref element="U1" pad="16"/>
<wire x1="50.4" y1="50.35" x2="51.2308" y2="51.1808" width="0.1524" layer="1"/>
<wire x1="51.2308" y1="51.1808" x2="52.58814375" y2="51.1808" width="0.1524" layer="1"/>
<wire x1="52.58814375" y1="51.1808" x2="54.0904" y2="49.67854375" width="0.1524" layer="1"/>
<wire x1="54.0904" y1="49.67854375" x2="54.0904" y2="49.0474875" width="0.1524" layer="1"/>
<wire x1="54.8" y1="48.3378875" x2="54.8" y2="46.8" width="0.1524" layer="1"/>
<wire x1="54.8" y1="46.8" x2="55.7" y2="45.9" width="0.1524" layer="1"/>
<wire x1="55.7" y1="45.9" x2="58.590375" y2="45.9" width="0.1524" layer="1"/>
<wire x1="58.590375" y1="45.9" x2="60.647775" y2="43.8426" width="0.1524" layer="1"/>
<wire x1="60.647775" y1="43.8426" x2="63.82634375" y2="43.8426" width="0.1524" layer="1"/>
<wire x1="64.6689375" y1="43.00000625" x2="66.000009375" y2="43.00000625" width="0.1524" layer="1"/>
<wire x1="54.0904" y1="49.0474875" x2="54.8" y2="48.3378875" width="0.1524" layer="1"/>
<wire x1="63.82634375" y1="43.8426" x2="64.6689375" y2="43.00000625" width="0.1524" layer="1"/>
</signal>
<signal name="PWMLO1">
<contactref element="U2" pad="P$18"/>
<contactref element="U1" pad="20"/>
<wire x1="66.000009375" y1="45.000003125" x2="64.399996875" y2="45.000003125" width="0.1524" layer="1"/>
<wire x1="64.399996875" y1="45.000003125" x2="64.3382" y2="45.0618" width="0.1524" layer="1"/>
<wire x1="64.3382" y1="45.0618" x2="61.1528" y2="45.0618" width="0.1524" layer="1"/>
<wire x1="58.5952" y1="47.6194" x2="58.5952" y2="50.3" width="0.1524" layer="1"/>
<wire x1="61.1528" y1="45.0618" x2="58.5952" y2="47.6194" width="0.1524" layer="1"/>
<wire x1="58.5952" y1="50.3" x2="57.8952" y2="51" width="0.1524" layer="1"/>
<wire x1="57.8952" y1="51" x2="57.4" y2="51" width="0.1524" layer="1"/>
<wire x1="57.4" y1="51" x2="54.5" y2="51" width="0.1524" layer="1"/>
<wire x1="54.5" y1="51" x2="53.1" y2="52.4" width="0.1524" layer="1"/>
<wire x1="53.1" y1="52.4" x2="48.9" y2="52.4" width="0.1524" layer="1"/>
<wire x1="48.9" y1="52.4" x2="48.15" y2="51.65" width="0.1524" layer="1"/>
<wire x1="48.15" y1="51.65" x2="48.15" y2="51.1" width="0.1524" layer="1"/>
</signal>
<signal name="PWMHI3">
<contactref element="U2" pad="P$21"/>
<contactref element="J13" pad="4"/>
<contactref element="U1" pad="17"/>
<wire x1="66.000009375" y1="43.50000625" x2="64.59999375" y2="43.50000625" width="0.1524" layer="1"/>
<wire x1="64.59999375" y1="43.50000625" x2="63.9526" y2="44.1474" width="0.1524" layer="1"/>
<wire x1="57.74143125" y1="47.18" x2="56.1" y2="47.18" width="0.1524" layer="1"/>
<wire x1="60.77403125" y1="44.1474" x2="57.74143125" y2="47.18" width="0.1524" layer="1"/>
<wire x1="63.9526" y1="44.1474" x2="60.77403125" y2="44.1474" width="0.1524" layer="1"/>
<wire x1="49.65" y1="51.1" x2="50.0356" y2="51.4856" width="0.1524" layer="1"/>
<wire x1="52.7144" y1="51.4856" x2="54.3952" y2="49.8048" width="0.1524" layer="1"/>
<wire x1="54.3952" y1="49.8048" x2="54.3952" y2="49.17374375" width="0.1524" layer="1"/>
<wire x1="56.1" y1="47.46894375" x2="56.1" y2="47.18" width="0.1524" layer="1"/>
<wire x1="50.0356" y1="51.4856" x2="52.7144" y2="51.4856" width="0.1524" layer="1"/>
<wire x1="54.3952" y1="49.17374375" x2="56.1" y2="47.46894375" width="0.1524" layer="1"/>
</signal>
<signal name="PWMHI1">
<contactref element="U2" pad="P$17"/>
<contactref element="J13" pad="2"/>
<contactref element="U1" pad="21"/>
<wire x1="66.000009375" y1="45.5" x2="64.45434375" y2="45.5" width="0.1524" layer="1"/>
<wire x1="64.45434375" y1="45.5" x2="64.32094375" y2="45.3666" width="0.1524" layer="1"/>
<wire x1="61.27905625" y1="45.3666" x2="58.9" y2="47.74565625" width="0.1524" layer="1"/>
<wire x1="64.32094375" y1="45.3666" x2="61.27905625" y2="45.3666" width="0.1524" layer="1"/>
<wire x1="58.9" y1="47.74565625" x2="58.9" y2="50.9" width="0.1524" layer="1"/>
<wire x1="58.9" y1="50.9" x2="57.54" y2="52.26" width="0.1524" layer="1"/>
<wire x1="57.54" y1="52.26" x2="56.1" y2="52.26" width="0.1524" layer="1"/>
<wire x1="47.65" y1="51.1" x2="47.675" y2="51.125" width="0.1524" layer="1"/>
<wire x1="47.8714" y1="51.8714" x2="47.7" y2="51.7" width="0.1524" layer="1"/>
<wire x1="47.8714" y1="51.8714" x2="47.94034375" y2="51.8714" width="0.1524" layer="1"/>
<wire x1="47.94034375" y1="51.8714" x2="48.77374375" y2="52.7048" width="0.1524" layer="1"/>
<wire x1="53.67105625" y1="52.26" x2="56.1" y2="52.26" width="0.1524" layer="1"/>
<wire x1="53.22625625" y1="52.7048" x2="53.67105625" y2="52.26" width="0.1524" layer="1"/>
<wire x1="48.77374375" y1="52.7048" x2="53.22625625" y2="52.7048" width="0.1524" layer="1"/>
<wire x1="47.7" y1="51.7" x2="47.7" y2="51.15" width="0.1524" layer="1"/>
<wire x1="47.7" y1="51.15" x2="47.675" y2="51.125" width="0.1524" layer="1"/>
</signal>
<signal name="PWMHI2">
<contactref element="U2" pad="P$19"/>
<contactref element="J13" pad="3"/>
<contactref element="U1" pad="19"/>
<wire x1="66.000009375" y1="44.500003125" x2="64.468940625" y2="44.500003125" width="0.1524" layer="1"/>
<wire x1="64.468940625" y1="44.500003125" x2="64.21194375" y2="44.757" width="0.1524" layer="1"/>
<wire x1="64.21194375" y1="44.757" x2="61.02654375" y2="44.757" width="0.1524" layer="1"/>
<wire x1="58.2904" y1="49.1096" x2="57.7" y2="49.7" width="0.1524" layer="1"/>
<wire x1="58.2904" y1="47.49314375" x2="58.2904" y2="49.1096" width="0.1524" layer="1"/>
<wire x1="61.02654375" y1="44.757" x2="58.2904" y2="47.49314375" width="0.1524" layer="1"/>
<wire x1="57.7" y1="49.7" x2="56.12" y2="49.7" width="0.1524" layer="1"/>
<wire x1="56.12" y1="49.7" x2="56.1" y2="49.72" width="0.1524" layer="1"/>
<wire x1="56.1" y1="49.72" x2="55.34894375" y2="49.72" width="0.1524" layer="1"/>
<wire x1="55.34894375" y1="49.72" x2="54.134471875" y2="50.934471875" width="0.1524" layer="1"/>
<wire x1="54.134471875" y1="50.934471875" x2="52.97374375" y2="52.0952" width="0.1524" layer="1"/>
<wire x1="52.97374375" y1="52.0952" x2="49.02625625" y2="52.0952" width="0.1524" layer="1"/>
<wire x1="48.65" y1="51.71894375" x2="48.65" y2="51.1" width="0.1524" layer="1"/>
<wire x1="49.02625625" y1="52.0952" x2="48.65" y2="51.71894375" width="0.1524" layer="1"/>
</signal>
<signal name="V-W">
<contactref element="R37" pad="2"/>
<contactref element="R36" pad="1"/>
......@@ -3639,6 +3534,112 @@ design rules under a new name.</description>
<wire x1="61.2" y1="45.8767125" x2="61.2" y2="57.488" width="0.1524" layer="1"/>
<wire x1="61.2" y1="57.488" x2="61.66" y2="57.948" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PWMHIU">
<contactref element="U2" pad="P$17"/>
<contactref element="U1" pad="21"/>
<contactref element="J13" pad="2"/>
<wire x1="64.32094375" y1="45.3666" x2="64.45434375" y2="45.5" width="0.1524" layer="1"/>
<wire x1="61.27905625" y1="45.3666" x2="58.9" y2="47.74565625" width="0.1524" layer="1"/>
<wire x1="64.32094375" y1="45.3666" x2="61.27905625" y2="45.3666" width="0.1524" layer="1"/>
<wire x1="58.9" y1="47.74565625" x2="58.9" y2="50.9" width="0.1524" layer="1"/>
<wire x1="58.9" y1="50.9" x2="57.54" y2="52.26" width="0.1524" layer="1"/>
<wire x1="57.54" y1="52.26" x2="56.1" y2="52.26" width="0.1524" layer="1"/>
<wire x1="47.8714" y1="51.8714" x2="47.7" y2="51.7" width="0.1524" layer="1"/>
<wire x1="47.8714" y1="51.8714" x2="47.94034375" y2="51.8714" width="0.1524" layer="1"/>
<wire x1="47.94034375" y1="51.8714" x2="48.77374375" y2="52.7048" width="0.1524" layer="1"/>
<wire x1="53.67105625" y1="52.26" x2="56.1" y2="52.26" width="0.1524" layer="1"/>
<wire x1="53.22625625" y1="52.7048" x2="53.67105625" y2="52.26" width="0.1524" layer="1"/>
<wire x1="48.77374375" y1="52.7048" x2="53.22625625" y2="52.7048" width="0.1524" layer="1"/>
<wire x1="47.7" y1="51.7" x2="47.7" y2="51.15" width="0.1524" layer="1"/>
<wire x1="47.7" y1="51.15" x2="47.675" y2="51.125" width="0.1524" layer="1"/>
<wire x1="64.45434375" y1="45.5" x2="66.000009375" y2="45.5" width="0.1524" layer="1"/>
<wire x1="47.675" y1="51.125" x2="47.65" y2="51.1" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PWMLOU">
<contactref element="U2" pad="P$18"/>
<contactref element="U1" pad="20"/>
<wire x1="64.3382" y1="45.0618" x2="64.399996875" y2="45.000003125" width="0.1524" layer="1"/>
<wire x1="64.3382" y1="45.0618" x2="61.1528" y2="45.0618" width="0.1524" layer="1"/>
<wire x1="58.5952" y1="47.6194" x2="58.5952" y2="50.3" width="0.1524" layer="1"/>
<wire x1="61.1528" y1="45.0618" x2="58.5952" y2="47.6194" width="0.1524" layer="1"/>
<wire x1="58.5952" y1="50.3" x2="57.8952" y2="51" width="0.1524" layer="1"/>
<wire x1="57.8952" y1="51" x2="54.5" y2="51" width="0.1524" layer="1"/>
<wire x1="54.5" y1="51" x2="53.1" y2="52.4" width="0.1524" layer="1"/>
<wire x1="53.1" y1="52.4" x2="48.9" y2="52.4" width="0.1524" layer="1"/>
<wire x1="48.9" y1="52.4" x2="48.15" y2="51.65" width="0.1524" layer="1"/>
<wire x1="48.15" y1="51.65" x2="48.15" y2="51.1" width="0.1524" layer="1"/>
<wire x1="64.399996875" y1="45.000003125" x2="66.000009375" y2="45.000003125" width="0.1524" layer="1"/>
</signal>
<signal name="PWMHIV">
<contactref element="J13" pad="3"/>
<contactref element="U1" pad="19"/>
<wire x1="55.34894375" y1="49.72" x2="54.134471875" y2="50.934471875" width="0.1524" layer="1"/>
<wire x1="54.134471875" y1="50.934471875" x2="52.97374375" y2="52.0952" width="0.1524" layer="1"/>
<wire x1="52.97374375" y1="52.0952" x2="49.02625625" y2="52.0952" width="0.1524" layer="1"/>
<wire x1="48.65" y1="51.71894375" x2="48.65" y2="51.1" width="0.1524" layer="1"/>
<wire x1="49.02625625" y1="52.0952" x2="48.65" y2="51.71894375" width="0.1524" layer="1"/>
<contactref element="U2" pad="P$19"/>
<wire x1="66.000009375" y1="44.500003125" x2="64.468940625" y2="44.500003125" width="0.1524" layer="1"/>
<wire x1="64.468940625" y1="44.500003125" x2="64.21194375" y2="44.757" width="0.1524" layer="1"/>
<wire x1="64.21194375" y1="44.757" x2="61.02654375" y2="44.757" width="0.1524" layer="1"/>
<wire x1="58.2904" y1="49.1096" x2="57.7" y2="49.7" width="0.1524" layer="1"/>
<wire x1="58.2904" y1="47.49314375" x2="58.2904" y2="49.1096" width="0.1524" layer="1"/>
<wire x1="61.02654375" y1="44.757" x2="58.2904" y2="47.49314375" width="0.1524" layer="1"/>
<wire x1="57.7" y1="49.7" x2="56.12" y2="49.7" width="0.1524" layer="1"/>
<wire x1="56.12" y1="49.7" x2="56.1" y2="49.72" width="0" layer="19" extent="1-1"/>
<wire x1="55.34894375" y1="49.72" x2="56.1" y2="49.72" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PWMHIW">
<contactref element="J13" pad="4"/>
<contactref element="U1" pad="17"/>
<wire x1="49.65" y1="51.1" x2="50.0356" y2="51.4856" width="0.1524" layer="1"/>
<wire x1="52.7144" y1="51.4856" x2="54.3952" y2="49.8048" width="0.1524" layer="1"/>
<wire x1="54.3952" y1="49.8048" x2="54.3952" y2="49.17374375" width="0.1524" layer="1"/>
<wire x1="50.0356" y1="51.4856" x2="52.7144" y2="51.4856" width="0.1524" layer="1"/>
<wire x1="56.1" y1="47.46894375" x2="54.3952" y2="49.17374375" width="0.1524" layer="1"/>
<contactref element="U2" pad="P$21"/>
<wire x1="66.000009375" y1="43.50000625" x2="64.59999375" y2="43.50000625" width="0.1524" layer="1"/>
<wire x1="64.59999375" y1="43.50000625" x2="63.9526" y2="44.1474" width="0.1524" layer="1"/>
<wire x1="60.77403125" y1="44.1474" x2="57.760715625" y2="47.160715625" width="0.1524" layer="1"/>
<wire x1="57.760715625" y1="47.160715625" x2="57.74143125" y2="47.18" width="0.1524" layer="1"/>
<wire x1="63.9526" y1="44.1474" x2="60.77403125" y2="44.1474" width="0.1524" layer="1"/>
<wire x1="57.760715625" y1="47.160715625" x2="56.119284375" y2="47.160715625" width="0.1524" layer="1"/>
<wire x1="56.119284375" y1="47.160715625" x2="56.1" y2="47.18" width="0.1524" layer="1"/>
<wire x1="56.1" y1="47.18" x2="56.1" y2="47.46894375" width="0.1524" layer="1"/>
</signal>
<signal name="PWMLOV">
<contactref element="U1" pad="18"/>
<contactref element="U2" pad="P$20"/>
<wire x1="66.000009375" y1="44.000003125" x2="64.537884375" y2="44.000003125" width="0.1524" layer="1"/>
<wire x1="64.537884375" y1="44.000003125" x2="64.0856875" y2="44.4522" width="0.1524" layer="1"/>
<wire x1="64.0856875" y1="44.4522" x2="60.9002875" y2="44.4522" width="0.1524" layer="1"/>
<wire x1="57.9856" y1="47.3668875" x2="57.9856" y2="47.9144" width="0.1524" layer="1"/>
<wire x1="60.9002875" y1="44.4522" x2="57.9856" y2="47.3668875" width="0.1524" layer="1"/>
<wire x1="57.4" y1="48.5" x2="55.5" y2="48.5" width="0.1524" layer="1"/>
<wire x1="55.5" y1="48.5" x2="54.7" y2="49.3" width="0.1524" layer="1"/>
<wire x1="57.9856" y1="47.9144" x2="57.4" y2="48.5" width="0.1524" layer="1"/>
<wire x1="54.7" y1="49.3" x2="54.7" y2="49.9378875" width="0.1524" layer="1"/>
<wire x1="54.7" y1="49.9378875" x2="52.8474875" y2="51.7904" width="0.1524" layer="1"/>
<wire x1="52.8474875" y1="51.7904" x2="49.3904" y2="51.7904" width="0.1524" layer="1"/>
<wire x1="49.3904" y1="51.7904" x2="49.15" y2="51.55" width="0.1524" layer="1"/>
<wire x1="49.15" y1="51.55" x2="49.15" y2="51.1" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="PWMLOW">
<contactref element="U1" pad="16"/>
<contactref element="U2" pad="P$22"/>
<wire x1="52.58814375" y1="51.1808" x2="51.2308" y2="51.1808" width="0.1524" layer="1"/>
<wire x1="52.58814375" y1="51.1808" x2="54.0904" y2="49.67854375" width="0.1524" layer="1"/>
<wire x1="54.0904" y1="49.67854375" x2="54.0904" y2="49.0474875" width="0.1524" layer="1"/>
<wire x1="54.8" y1="48.3378875" x2="54.8" y2="46.8" width="0.1524" layer="1"/>
<wire x1="54.8" y1="46.8" x2="55.7" y2="45.9" width="0.1524" layer="1"/>
<wire x1="55.7" y1="45.9" x2="58.590375" y2="45.9" width="0.1524" layer="1"/>
<wire x1="58.590375" y1="45.9" x2="60.647775" y2="43.8426" width="0.1524" layer="1"/>
<wire x1="60.647775" y1="43.8426" x2="63.82634375" y2="43.8426" width="0.1524" layer="1"/>
<wire x1="64.6689375" y1="43.00000625" x2="66.000009375" y2="43.00000625" width="0.1524" layer="1"/>
<wire x1="54.0904" y1="49.0474875" x2="54.8" y2="48.3378875" width="0.1524" layer="1"/>
<wire x1="63.82634375" y1="43.8426" x2="64.6689375" y2="43.00000625" width="0.1524" layer="1"/>
<wire x1="51.2308" y1="51.1808" x2="50.4" y2="50.35" width="0.1524" layer="1"/>
</signal>
</signals>
<mfgpreviewcolors>
<mfgpreviewcolor name="soldermaskcolor" color="0xC8008000"/>
......
......@@ -5485,93 +5485,6 @@ high speed (Philips)</description>
<pinref part="U1" gate="G$1" pin="PA0/AREF"/>
</segment>
</net>
<net name="PWMLO2" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INL_B"/>
<wire x1="78.74" y1="20.32" x2="60.96" y2="20.32" width="0.1524" layer="91"/>
<label x="60.96" y="20.32" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC2/RXD0"/>
<wire x1="-50.8" y1="66.04" x2="-33.02" y2="66.04" width="0.1524" layer="91"/>
<label x="-48.26" y="66.04" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMLO3" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INL_C"/>
<wire x1="78.74" y1="15.24" x2="60.96" y2="15.24" width="0.1524" layer="91"/>
<label x="60.96" y="15.24" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC0/SDA"/>
<wire x1="-50.8" y1="71.12" x2="-33.02" y2="71.12" width="0.1524" layer="91"/>
<label x="-48.26" y="71.12" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMLO1" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INL_A"/>
<wire x1="78.74" y1="25.4" x2="60.96" y2="25.4" width="0.1524" layer="91"/>
<label x="60.96" y="25.4" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC4/SS"/>
<wire x1="-50.8" y1="60.96" x2="-33.02" y2="60.96" width="0.1524" layer="91"/>
<label x="-48.26" y="60.96" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMHI3" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INH_C"/>
<wire x1="78.74" y1="17.78" x2="60.96" y2="17.78" width="0.1524" layer="91"/>
<label x="60.96" y="17.78" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="J13" gate="G$1" pin="4"/>
<wire x1="40.64" y1="101.6" x2="27.94" y2="101.6" width="0.1524" layer="91"/>
<label x="27.94" y="101.6" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC1/SCL/XCK0"/>
<wire x1="-50.8" y1="68.58" x2="-33.02" y2="68.58" width="0.1524" layer="91"/>
<label x="-48.26" y="68.58" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMHI1" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INH_A"/>
<wire x1="78.74" y1="27.94" x2="60.96" y2="27.94" width="0.1524" layer="91"/>
<label x="60.96" y="27.94" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="J13" gate="G$1" pin="2"/>
<wire x1="40.64" y1="106.68" x2="27.94" y2="106.68" width="0.1524" layer="91"/>
<label x="27.94" y="106.68" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC5/XCK1/MOSI"/>
<wire x1="-50.8" y1="58.42" x2="-33.02" y2="58.42" width="0.1524" layer="91"/>
<label x="-48.26" y="58.42" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMHI2" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INH_B"/>
<wire x1="78.74" y1="22.86" x2="60.96" y2="22.86" width="0.1524" layer="91"/>
<label x="60.96" y="22.86" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="J13" gate="G$1" pin="3"/>
<wire x1="40.64" y1="104.14" x2="27.94" y2="104.14" width="0.1524" layer="91"/>
<label x="27.94" y="104.14" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC3/TXD0"/>
<wire x1="-50.8" y1="63.5" x2="-33.02" y2="63.5" width="0.1524" layer="91"/>
<label x="-48.26" y="63.5" size="1.778" layer="95"/>
</segment>
</net>
<net name="V-W" class="0">
<segment>
<pinref part="R37" gate="G$1" pin="2"/>
......@@ -5980,6 +5893,93 @@ high speed (Philips)</description>
<label x="60.96" y="30.48" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMHIU" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INH_A"/>
<wire x1="78.74" y1="27.94" x2="60.96" y2="27.94" width="0.1524" layer="91"/>
<label x="60.96" y="27.94" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC5/XCK1/MOSI"/>
<wire x1="-50.8" y1="58.42" x2="-33.02" y2="58.42" width="0.1524" layer="91"/>
<label x="-48.26" y="58.42" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="J13" gate="G$1" pin="2"/>
<wire x1="40.64" y1="106.68" x2="27.94" y2="106.68" width="0.1524" layer="91"/>
<label x="27.94" y="106.68" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMLOU" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="INL_A"/>
<wire x1="78.74" y1="25.4" x2="60.96" y2="25.4" width="0.1524" layer="91"/>
<label x="60.96" y="25.4" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC4/SS"/>
<wire x1="-50.8" y1="60.96" x2="-33.02" y2="60.96" width="0.1524" layer="91"/>
<label x="-48.26" y="60.96" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMHIV" class="0">
<segment>
<pinref part="J13" gate="G$1" pin="3"/>
<wire x1="40.64" y1="104.14" x2="27.94" y2="104.14" width="0.1524" layer="91"/>
<label x="27.94" y="104.14" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC3/TXD0"/>
<wire x1="-50.8" y1="63.5" x2="-33.02" y2="63.5" width="0.1524" layer="91"/>
<label x="-48.26" y="63.5" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U2" gate="G$1" pin="INH_B"/>
<wire x1="78.74" y1="22.86" x2="60.96" y2="22.86" width="0.1524" layer="91"/>
<label x="60.96" y="22.86" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMHIW" class="0">
<segment>
<pinref part="J13" gate="G$1" pin="4"/>
<wire x1="40.64" y1="101.6" x2="27.94" y2="101.6" width="0.1524" layer="91"/>
<label x="27.94" y="101.6" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PC1/SCL/XCK0"/>
<wire x1="-50.8" y1="68.58" x2="-33.02" y2="68.58" width="0.1524" layer="91"/>
<label x="-48.26" y="68.58" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U2" gate="G$1" pin="INH_C"/>
<wire x1="78.74" y1="17.78" x2="60.96" y2="17.78" width="0.1524" layer="91"/>
<label x="60.96" y="17.78" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMLOV" class="0">
<segment>
<pinref part="U1" gate="G$1" pin="PC2/RXD0"/>
<wire x1="-50.8" y1="66.04" x2="-33.02" y2="66.04" width="0.1524" layer="91"/>
<label x="-48.26" y="66.04" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U2" gate="G$1" pin="INL_B"/>
<wire x1="78.74" y1="20.32" x2="60.96" y2="20.32" width="0.1524" layer="91"/>
<label x="60.96" y="20.32" size="1.778" layer="95"/>
</segment>
</net>
<net name="PWMLOW" class="0">
<segment>
<pinref part="U1" gate="G$1" pin="PC0/SDA"/>
<wire x1="-50.8" y1="71.12" x2="-33.02" y2="71.12" width="0.1524" layer="91"/>
<label x="-48.26" y="71.12" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U2" gate="G$1" pin="INL_C"/>
<wire x1="78.74" y1="15.24" x2="60.96" y2="15.24" width="0.1524" layer="91"/>
<label x="60.96" y="15.24" size="1.778" layer="95"/>
</segment>
</net>
</nets>
</sheet>
</sheets>
......
......@@ -10,3 +10,14 @@ Firmware for the xmega is under development, but you can see [firmware notes for
To get spindles spinning with only a wee amount of c-programming time, I'm going to write a dirty/nasty/simple commutation scheme.
## 3-Channel Hi / Lo Side PWM with AWeX
XMega has some built in functionality for motor / h-bridge drive, namely the AWeX (waveform extension) module that runs on top of the timer/counter system (which runs PWM).
This is set-up in the code, and I've verified I have the write outputs writing to the right outputs (haha). Nice.
![pwm](images/pwms-awex-init-xmega.png)
## 6-Step Commutation
To do this quickly, I'm just going to yoke a timer to a blind 6-step commutation cycle.
\ No newline at end of file
......@@ -59,10 +59,20 @@ pin_t drvDcCal;
pin_t drvFault;
pin_t drvOCTW;
// pwm pins
pin_t lo1;
pin_t hi1;
pin_t lo2;
pin_t hi2;
pin_t lo3;
pin_t hi3;
// controller functions
// bldc_t bldc;
unsigned long timebase;
pin_t tstpin1;
pin_t tstpin2;
#endif /* HARDWARE_H_ */
\ No newline at end of file
......@@ -48,36 +48,82 @@ void encoder_init(void){
spi_start(&spiEncoder, 0);
}
void drv_init(void){
void pwm_periods(uint16_t peru, uint16_t perv, uint16_t perw){
// check overrun
(peru > 1024) ? peru = 1024 : (0);
(perv > 1024) ? perv = 1024 : (0);
(perw > 1024) ? perw = 1024 : (0);
// hi is lo, per xmega, let's undo this
peru = 1024 - peru;
perv = 1024 - perv;
perw = 1024 - perw;
// A: 3, B: 2, C: 1 - channels to board
TCC0.CCABUFL = (uint8_t) perw;
TCC0.CCABUFH = (uint8_t) (perw >> 8);
TCC0.CCBBUFL = (uint8_t) perv;
TCC0.CCBBUFH = (uint8_t) (perv >> 8);
TCC0.CCCBUFL = (uint8_t) peru;
TCC0.CCCBUFH = (uint8_t) (peru >> 8);
}
void pwm_init(void){
//
// setup awex etc
pin_init(&lo1, &PORTC, PIN4_bm, 4, 1);
pin_init(&hi1, &PORTC, PIN5_bm, 5, 1);
pin_init(&lo2, &PORTC, PIN2_bm, 2, 1);
pin_init(&hi2, &PORTC, PIN3_bm, 3, 1);
pin_init(&lo3, &PORTC, PIN0_bm, 0, 1);
pin_init(&hi3, &PORTC, PIN1_bm, 1, 1);
// compare and capture at value
uint16_t per = 1024; // at DIV1, 1024 period is 23.5kHz
// write low first, bc bussing / xmega 8-bit oddities cc datasheet @ 3.11
uint8_t perl = (uint8_t) per;
uint8_t perh = (uint8_t) (per >> 8);
TCC0.CTRLA = TC_CLKSEL_DIV1_gc;
TCC0.PERBUFL = perl;
TCC0.PERBUFH = perh;
// turnt to dual-slope pwm to have center aligned, and eventually sampling on top event
TCC0.CTRLB = TC_WGMODE_DS_T_gc;// | (1 << 7) | (1 << 6) | (1 << 5); // dual slope, and enable channels a, b, c for capture
AWEXC.CTRL = AWEX_DTICCAEN_bm | AWEX_DTICCBEN_bm | AWEX_DTICCCEN_bm;
AWEXC.DTBOTHBUF = 4; // four counts of pwm clock for deadtime
AWEXC.OUTOVEN = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5);
pwm_periods(256, 512, 768);
}
void drv_init(void){
}
void tickers_init(void){
// one 'ticker' to execute steps
// turn on TCC0, do perclk / 8
TCC0.CTRLA = TC_CLKSEL_DIV256_gc;
// sets up two timers
// compare and capture at value
uint16_t pera = 40; // ~ 200us timer to start...
uint16_t pera = 1200;
// write low first, bc bussing / xmega 8-bit oddities cc datasheet @ 3.11
uint8_t peral = (uint8_t) pera;
uint8_t perah = (uint8_t) (pera >> 8);
TCC0.PERBUFL = peral;
TCC0.PERBUFH = perah;
// turn on TCC0
TCD0.CTRLA = TC_CLKSEL_DIV256_gc;
TCD0.PERBUFL = peral;
TCD0.PERBUFH = perah;
// set cca interrupt on
TCC0.INTCTRLA = TC_OVFINTLVL_HI_gc;
TCD0.INTCTRLA = TC_OVFINTLVL_HI_gc;
// another ticker to execute accel
TCC1.CTRLA = TC_CLKSEL_DIV256_gc;
TCC1.PERBUFL = peral;
TCC1.PERBUFH = perah;
TCD1.CTRLA = TC_CLKSEL_DIV256_gc;
TCD1.PERBUFL = peral;
TCD1.PERBUFH = perah;
TCC1.INTCTRLA = TC_OVFINTLVL_HI_gc;
TCD1.INTCTRLA = TC_OVFINTLVL_HI_gc;
}
int main(void)
......@@ -95,7 +141,12 @@ int main(void)
pin_set(&stlerr);
pin_set(&stlclk);
//pin_init(&tstpin1, &PORTC, PIN5_bm, 5, 1);
//pin_init(&tstpin2, &PORTC, PIN3_bm, 3, 1);
tickers_init();
pwm_init();
// runtime globals
uint32_t tck = 0;
......@@ -114,11 +165,16 @@ int main(void)
}
ISR(TCC0_OVF_vect){
//stepper_updatesteps(&stepper);
pin_toggle(&hi1);
}
ISR(TCD0_OVF_vect){
// commutate?
//pin_toggle(&tstpin1);
}
ISR(TCC1_OVF_vect){
//stepper_updateaccel(&stepper);
ISR(TCD1_OVF_vect){