### structure, first good test

parent f6679490
 # MachineKit BLDC Driver See: [Circuit Development](https://gitlab.cba.mit.edu/jakeread/mkbldcdriver/tree/master/circuit), and [Code Development](https://gitlab.cba.mit.edu/jakeread/mkbldcdriver/tree/master/embedded) ## Background, Motivation This project is largely a follow-on to [my Teensy-Powered Brushless Motor Controller](https://github.com/jakeread/tesc), and with this new work, may the TESC project RIP. A moment of silence. TESC, April 2016 - August 2016 *As the world turns, so did those motors. Once around is never enough* Eulagies aside, I am still motivated to do this. Brushless motors are the go-to motive force for electromechanical systems. By that I mean that just about any time you see a robot-like thing, or machine, moving about, there's a big likelihood that the thing doing-the-moving has a brushless motor in it's guts - or some variant thereof (stepper motors count as BLDCs in my books). #### A few things to understand: **(1) Electric Motors move by rotating a magnetic field** - we have something with magnets, and something else with electromagnets, we use the electromagnets to rotate the field, we pull the magnets along. Rotating the field is called *Commutating* or *Commutation*. **(2) Brushed Motors rotate the magnetic field using 'brushes'** - these are mechanical switches that use the motor's own rotation to change the magnetic field. Super neat. [Here's a link to Sparkfun's explanation](https://learn.sparkfun.com/tutorials/motors-and-selecting-the-right-one/dc-brush-motors---the-classic) And a GIF. While the rotor rotates, different switches are connected to current, and the coils - to - pads relationship is set up such that the current will cause the motor to rotate. Pardon my abbreviated explanation. ![brushed-dc](https://gitlab.cba.mit.edu/jakeread/mkbldcdriver/raw/master/images/brushed-dc.gif) Brushes are awesome - and make motors very simple. You just pump voltage (so current) through the rotor, and things happen. However, there are resistive losses at the brushes, as well as friction losses. With the advent of transistor technology (for switching logic AND for switching big power) we can do this electronically - use a computer (or simple timer) to switch the phases. **(3) Brushless Motors rotate the magnetic field with switches** - so we can make the coils stationary, and 'artificially' switch the direction and timing of current flowing through them. Here's a nice GIF of sinusoidal commutation (where phase currents follow a nice, smooth wave). ![bldc-animation](https://gitlab.cba.mit.edu/jakeread/mkbldcdriver/raw/master/images/bldc-motor-vectors.gif) We can see the three current vectors (that translate into a combined magnetic field vector). We also have a simpler type of switching, where we only turn two of the three phases on at a time. You can see an example of that [here](https://www.youtube.com/watch?v=oFI7VW6WGR4) - including a nice diagram of the switch setup. #### Where it gets complicated: - Circuit design to switch big voltages / currents - Closed loop control on current in motor - Sensing: rotor position, electrical phase, offsets, shunt amplifiers oh my! #### Towards accessible robotics Mostly the motivation for me to go through this is (1) to train myself in the field, and (2) to help others along a similar journey, not just cobbling bits together, but understanding how and why they work. This is ongoing work! \ No newline at end of file
 ... ... @@ -140,10 +140,6 @@ Here we go, a sinusoidal PWM: I think I'm ready to check all of my other motor controller IO's - like, do I need to assert, also, an enable pin? I forget. Then I'll plug it in, and flip the switch, ho-ha! Yep - I just have on extra PIO to add, an Enable Pin. Set this up. I also took a minute to make this test stand, wire up all of the high power lines etc... - img ## UART OK, I'm going to bring up the UART. I have a block of code for this from my networks project that I'll try bringing in. ... ... @@ -191,6 +187,6 @@ Note - the handler does not distinguish between an RXReady event and the other i Some ARM Documentation is [here](http://infocenter.arm.com/help/index.jsp) - navigate to Cortex-M7 Documentation, the latest revision, and look for NVIC. ## Hardware, Awaken! From here, I brought up the hardware - a satisfying adventure. Go [here](https://gitlab.cba.mit.edu/jakeread/mkbldcdriver/tree/master/circuit) for that. OK, this is satisfactory, for now, for register banging. I'm going to try bringing the hardware up now, i.e. turning the motor on. \ No newline at end of file Then I worked (briefly) on implementing a control interface for this using mods. That should be [here](http://fab.cba.mit.edu/classes/863.17/CBA/people/jakeread/) in week 12. \ No newline at end of file
No preview for this file type
No preview for this file type
 ... ... @@ -135,7 +135,7 @@ :100850007F43C7F8283259F825309B01A8FB0323B2 :10086000DB09043323F07F43C7F8483259F82630B8 :100870009B01A8FB0323DB09043323F07F43C7F864 :1008800068324FF2CE10194B98470D48184B9847D5 :10088000683241F2F820194B98470D48184B9847A9 :100890000028C3D00A48174B9847C2E7C10340005D :1008A0002D02400050180E40EB0140007D06400034 :1008B0006906400070144020000E0E40F301400015 ... ...
 ... ... @@ -19,21 +19,21 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY 7 .debug_info 00009e32 00000000 00000000 000214c3 2**0 CONTENTS, READONLY, DEBUGGING 8 .debug_abbrev 00001541 00000000 00000000 0002b2f5 2**0 8 .debug_abbrev 00001532 00000000 00000000 0002b2f5 2**0 CONTENTS, READONLY, DEBUGGING 9 .debug_loc 00001263 00000000 00000000 0002c836 2**0 9 .debug_loc 00001263 00000000 00000000 0002c827 2**0 CONTENTS, READONLY, DEBUGGING 10 .debug_aranges 00000430 00000000 00000000 0002da99 2**0 10 .debug_aranges 00000430 00000000 00000000 0002da8a 2**0 CONTENTS, READONLY, DEBUGGING 11 .debug_ranges 00000390 00000000 00000000 0002dec9 2**0 11 .debug_ranges 00000390 00000000 00000000 0002deba 2**0 CONTENTS, READONLY, DEBUGGING 12 .debug_macro 00017323 00000000 00000000 0002e259 2**0 12 .debug_macro 00017323 00000000 00000000 0002e24a 2**0 CONTENTS, READONLY, DEBUGGING 13 .debug_line 0000656d 00000000 00000000 0004557c 2**0 13 .debug_line 0000656d 00000000 00000000 0004556d 2**0 CONTENTS, READONLY, DEBUGGING 14 .debug_str 0006cca6 00000000 00000000 0004bae9 2**0 14 .debug_str 0006cca6 00000000 00000000 0004bada 2**0 CONTENTS, READONLY, DEBUGGING 15 .debug_frame 00000964 00000000 00000000 000b8790 2**2 15 .debug_frame 00000964 00000000 00000000 000b8780 2**2 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: ... ... @@ -1366,7 +1366,7 @@ __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) 40087a: f023 437f bic.w r3, r3, #4278190080 ; 0xff000000 40087e: f8c7 3268 str.w r3, [r7, #616] ; 0x268 delay_us(period * 10); 400882: f24f 10ce movw r0, #61902 ; 0xf1ce 400882: f241 20f8 movw r0, #4856 ; 0x12f8 400886: 4b19 ldr r3, [pc, #100] ; (4008ec ) 400888: 4798 blx r3 if(pin_get_state(&stlr)){ // ? ... ...
 ... ... @@ -3573,7 +3573,7 @@ OUTPUT(atsams70-bldc.elf elf32-littlearm) .debug_info 0x000072eb 0x55b src/ASF/sam/utils/cmsis/sams70/source/templates/system_sams70.o .debug_info 0x00007846 0x25ec src/main.o .debug_abbrev 0x00000000 0x1541 .debug_abbrev 0x00000000 0x1532 .debug_abbrev 0x00000000 0x12d src/tinyport.o .debug_abbrev 0x0000012d 0x230 src/ASF/sam/drivers/wdt/wdt.o .debug_abbrev 0x0000035d 0x232 src/pin.o ... ... @@ -3583,7 +3583,7 @@ OUTPUT(atsams70-bldc.elf elf32-littlearm) .debug_abbrev 0x00000dca 0x1a4 src/ASF/common/boards/user_board/init.o .debug_abbrev 0x00000f6e 0x153 src/ASF/sam/utils/cmsis/sams70/source/templates/gcc/startup_sams70.o .debug_abbrev 0x000010c1 0x102 src/ASF/sam/utils/cmsis/sams70/source/templates/system_sams70.o .debug_abbrev 0x000011c3 0x37e src/main.o .debug_abbrev 0x000011c3 0x36f src/main.o .debug_loc 0x00000000 0x1263 .debug_loc 0x00000000 0xca src/tinyport.o ... ...
 ... ... @@ -135,7 +135,7 @@ S21440084059F824309B01A8FB0323DB09043323F02B S2144008507F43C7F8283259F825309B01A8FB03236D S214400860DB09043323F07F43C7F8483259F8263073 S2144008709B01A8FB0323DB09043323F07F43C7F81F S21440088068324FF2CE10194B98470D48184B984790 S214400880683241F2F820194B98470D48184B984764 S2144008900028C3D00A48174B9847C2E7C103400018 S2144008A02D02400050180E40EB0140007D064000EF S2144008B06906400070144020000E0E40F3014000D0 ... ...
No preview for this file type
 ... ... @@ -181,7 +181,7 @@ int main (void) startupflash(); uint8_t scalar = 64; // 0 -> 255 (these will be chars from serial) uint8_t period = 255; // us between ++ in phase uint8_t period = 20; // us between ++ in phase uint32_t phaseu = 0; // 0 -> 1023 uint32_t phasev = 341; // advanced 120 degrees ... ...

158 KB

2.7 MB

399 KB

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!