diff --git a/circuit/README.md b/circuit/README.md index a57a8716a553944be06277e7dfe5e8ce3168de4a..ec9b2e88050e0edecacdfdc0b74cc96942f0baee 100644 --- a/circuit/README.md +++ b/circuit/README.md @@ -8,6 +8,14 @@ The circuit uses a DRV8302 to drive CSD88584 (or CSD88599) half-bridges, which a Power is bussed to the board with two M3 Screw Terminals. The board includes room for a 16mm (?) diameter capacitor, and I'll normally use a 1000uF 35V cap here, or as big as I can fit happily. +## Tackling Noise on the BLDC Driver + +OK, this is concerning! I have lots of noise coming through the SPI lines, I'm a bit worried if these are causing errors: + + + +This perhaps means I need to run that SPI cable with a differential driver, to be honest this would be dissapointing. + ## Notes - label lights @@ -17,7 +25,7 @@ Power is bussed to the board with two M3 Screw Terminals. The board includes roo - might have to go to DRV8320 - newer, available - CSD88548 is CSD88599 but more amps less volts, use these - - use RDT RTD for BLDC - 223-1563-1-ND + - use RDT RTD for temp - 223-1563-1-ND - phy RS422 and bring back buck - do 24v fan 40mm on M3 Terminals! silk lands for heatsink 1.1" square diff --git a/circuit/atkbldcdriver/atkbldcdriver.brd b/circuit/atkbldcdriver/atkbldcdriver.brd index fc5a79f4a7a6a09554cd870ee49b04f7885b9c05..d5170bb3210703680ae494babffa004833dd034d 100644 --- a/circuit/atkbldcdriver/atkbldcdriver.brd +++ b/circuit/atkbldcdriver/atkbldcdriver.brd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE eagle SYSTEM "eagle.dtd"> -<eagle version="9.0.0"> +<eagle version="9.1.1"> <drawing> <settings> <setting alwaysvectorfont="no"/> @@ -962,6 +962,9 @@ design rules under a new name.</description> <param name="checkRestrict" value="1"/> <param name="checkStop" value="0"/> <param name="checkValues" value="0"/> +<param name="checkNames" value="1"/> +<param name="checkWireStubs" value="1"/> +<param name="checkPolygonWidth" value="0"/> <param name="useDiameter" value="13"/> <param name="maxErrors" value="50"/> </designrules> @@ -3570,19 +3573,18 @@ design rules under a new name.</description> <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="55.34894375" y1="49.72" 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="64.21194375" y1="44.757" x2="61.02654375" y2="44.757" 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> @@ -3638,6 +3640,13 @@ design rules under a new name.</description> <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"/> +<mfgpreviewcolor name="silkscreencolor" color="0xFFFEFEFE"/> +<mfgpreviewcolor name="backgroundcolor" color="0xFF282828"/> +<mfgpreviewcolor name="coppercolor" color="0xFFFFBF00"/> +<mfgpreviewcolor name="substratecolor" color="0xFF786E46"/> +</mfgpreviewcolors> </board> </drawing> <compatibility> diff --git a/circuit/atkbldcdriver/eagle.epf b/circuit/atkbldcdriver/eagle.epf index e04a85b1a1c47aa0d45d630c7e4002ff865ab5a2..bbc506275c2251b4a18ab29818c3b2c4c1738809 100644 --- a/circuit/atkbldcdriver/eagle.epf +++ b/circuit/atkbldcdriver/eagle.epf @@ -1,5 +1,5 @@ [Eagle] -Version="09 00 00" +Version="09 01 01" Platform="Windows" Globals="Globals" Desktop="Desktop" @@ -19,37 +19,21 @@ UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries/eagle/sensor.lbr" UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries/eagle/tag-connect-2030.lbr" UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries_jake/eagle/sparkfun/SparkFun-Connectors.lbr" UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries_jake/eagle/jake/tag-connect-2050.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/Comparators.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/Digital.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/FilterProducts.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/Misc.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/Opamps.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/Optos.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/PAsystem.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/PowerProducts.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/References.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/SpecialFunctions.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/capmeter.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/diode.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/lt-spice-simulation.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/lt-supply.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/rload.lbr" -UsedLibrary="C:/EAGLE 8.3.2/lbr/ltspice/sym.lbr" UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries_jake/eagle/marekr/borkedlabs-passives.lbr" UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries_jake/eagle/sparkfun/SparkFun-DiscreteSemi.lbr" [Win_1] -Type="Board Editor" -Number=1 -File="atkbldcdriver.brd" -View="41.6112 50.1586 52.4556 59.1904" -WireWidths=" 0.0762 0.127 0.15 0.508 0.6096 0.8128 2.54 1.016 1.27 0.3048 0.254 0.2 0.4064 0.1016 0.2032 0.1524" +Type="Schematic Editor" +Number=3 +File="atkbldcdriver.sch" +View="-191.424 46.8832 11.2038 138.852" +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.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6 0.3" +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.4 0.45 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.5 0.25 0.35 0.3" -HoleDrills=" 0.2 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.3" -TextSizes=" 0.254 0.3048 0.4064 0.8128 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 0.6096" +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" @@ -58,17 +42,17 @@ 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=3 -WireBendSet=0 +WireBend=0 +WireBendSet=31 WireCap=1 MiterStyle=0 PadShape=0 ViaShape=1 PolygonPour=0 -PolygonRank=3 +PolygonRank=0 PolygonThermals=1 PolygonOrphans=0 -TextRatio=10 +TextRatio=8 DimensionUnit=1 DimensionPrecision=2 DimensionShowUnit=0 @@ -80,20 +64,22 @@ SwapLevel=0 ArcDirection=0 AddLevel=2 PadsSameType=0 -Layer=1 +Layer=91 +Views=" 1: -191.424 46.8832 11.2038 138.852" +Sheet="1" [Win_2] -Type="Schematic Editor" -Number=3 -File="atkbldcdriver.sch" -View="-250.34 -67.9039 169.828 122.802" -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" +Type="Board Editor" +Number=1 +File="atkbldcdriver.brd" +View="45.5333 30.9446 77.9146 57.9135" +WireWidths=" 0.0762 0.127 0.15 0.508 0.6096 0.8128 2.54 1.016 1.27 0.3048 0.254 0.2 0.4064 0.1016 0.2032 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" +PadDrills=" 0.2 0.25 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 0.3" 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" +ViaDrills=" 0.2 0.4 0.45 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.5 0.25 0.35 0.3" +HoleDrills=" 0.2 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.3" +TextSizes=" 0.254 0.3048 0.4064 0.8128 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 0.6096" 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" @@ -102,17 +88,17 @@ 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 +WireBend=1 +WireBendSet=0 WireCap=1 MiterStyle=0 PadShape=0 ViaShape=1 PolygonPour=0 -PolygonRank=0 +PolygonRank=3 PolygonThermals=1 PolygonOrphans=0 -TextRatio=8 +TextRatio=10 DimensionUnit=1 DimensionPrecision=2 DimensionShowUnit=0 @@ -124,16 +110,14 @@ SwapLevel=0 ArcDirection=0 AddLevel=2 PadsSameType=0 -Layer=91 -Views=" 1: -250.34 -67.9039 169.828 122.802" -Sheet="1" +Layer=1 [Win_3] Type="Control Panel" Number=0 [Desktop] -Screen="1920 1080" +Screen="3840 1080" Window="Win_1" Window="Win_2" Window="Win_3" diff --git a/datasheet/ENG_DS_NI1000SOT_A.pdf b/datasheet/ENG_DS_NI1000SOT_A.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bee8060c126c9e70c38fc970ad11c32e6d132af6 Binary files /dev/null and b/datasheet/ENG_DS_NI1000SOT_A.pdf differ diff --git a/embedded/atkbldcdriver/atkbldcdriver/main.c b/embedded/atkbldcdriver/atkbldcdriver/main.c index 06de01e01aced7d936959b696b037a988df0fb7b..cf24a05e5315f322786a934b94b4006f35e55ad7 100644 --- a/embedded/atkbldcdriver/atkbldcdriver/main.c +++ b/embedded/atkbldcdriver/atkbldcdriver/main.c @@ -103,7 +103,7 @@ void pwm_init(void){ 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.DTBOTHBUF = 2; // four counts of pwm clock for deadtime AWEXC.OUTOVEN = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5); pwm_periods(0, 0, 0); @@ -138,13 +138,13 @@ void tickers_init(void){ // sets up two timers // compare and capture at value - uint16_t perStartSpeed = 150; // 75 should be 10kHz for commutation, 150 for 5kHz + uint16_t perStartSpeed = 1024; // write low first, bc bussing / xmega 8-bit oddities cc datasheet @ 3.11 uint8_t perSl = (uint8_t) perStartSpeed; uint8_t perSh = (uint8_t) (perStartSpeed >> 8); // turn on TCC0 - TCD0.CTRLA = TC_CLKSEL_DIV64_gc; + TCD0.CTRLA = TC_CLKSEL_DIV8_gc; TCD0.PERBUFL = perSl; TCD0.PERBUFH = perSh; @@ -193,7 +193,7 @@ int main(void) bldc_init(&bldc); // on startup, speed (if clcomm) and duty //bldc_setTargetSpeed(&bldc, 1000); - bldc_setDuty(&bldc, 40); + bldc_setDuty(&bldc, 30); // startup the driver drv_init(); // and enable the gate @@ -230,9 +230,9 @@ int8_t comTable[6][3] = { // divisor is # of poles on motor / 2 (for each n/s pair, one set of 3 coils per full rotation) const static uint16_t enc_resolution = ENC_RESOLUTION; const static uint8_t enc_reverse = 0; // 1 or 0, for reverse op -const static uint16_t enc_modulo = ENC_RESOLUTION / 4; // 2805 in this case: divisor is # poles / 2 -const static uint16_t enc_offset = 60; // start at midpoint - adjust -ve or +ve from -const static uint16_t enc_steplength = ENC_RESOLUTION / 4 / 6; +const static uint16_t enc_modulo = ENC_RESOLUTION / 7; // divisor is # poles / 2 +const static uint16_t enc_offset = 0; // start at midpoint - adjust -ve or +ve from +const static uint16_t enc_steplength = ENC_RESOLUTION / 7 / 6; static uint16_t enc_reading = 0; static uint16_t enc_adjusted = 0; static uint16_t enc_phase = 0; @@ -248,6 +248,8 @@ ISR(TCD0_OVF_vect){ // offset and modulo to bring to in-phase relative location if(enc_reverse){ enc_adjusted = enc_resolution - enc_reading; + } else { + enc_adjusted = enc_reading; } enc_adjusted += enc_offset; // add offset enc_adjusted %= enc_resolution; // wrap to resolution diff --git a/images/logic-spi-noise-bldcv05-pwm.png b/images/logic-spi-noise-bldcv05-pwm.png new file mode 100644 index 0000000000000000000000000000000000000000..e42a5d7aec34a6c818995922415654e57d33dc1b Binary files /dev/null and b/images/logic-spi-noise-bldcv05-pwm.png differ