Re: [Emc-users] Bldc_Hal
See my little report on bldc comp on this list: http://www.mail-archive.com/emc-users@lists.sourceforge.net/msg33911.html Until now not tested: component delay_rising_edge http://www.mail-archive.com/emc-users@lists.sourceforge.net/msg34466.html Joachim -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
On 26.04.12 09:31, Gabriel Willen wrote: Andy would you care to enlighten me a little on your sign lookup table? I have an xmega laying around I have been playing with. I have it decoding and picking up the hall positions. But I'm not grasping the sign lookup table. I have read a half a dozen articles on it. In sure I will figure out, I always do but I figured maybe you could help. Also I thought about porting your bldc component, removing the real time and Hal includes and trying to make it work. But honestly I don't need all the wonderful bells and whistles you have included in yours. Just in case it's interesting, there is a much more compact method than trigonometric lookup tables, and it generates sine and cosine simultaneously, with tangent costing only an additional division, IIRC. It is called CORDIC, and wikipedia has a good go at explaining it: http://en.wikipedia.org/wiki/Cordic I haven't stopped to wade through that, but my recollection, from nearly 40 years back, is that we start with a short table of binary weighted table of arctangents, e.g artan(45°), artan(22.5°), artan(11.25°), ... down to the desired resolution. Twenty table entries gets us to 6 decimal digit angle resolution¹, because any angle can be arrived at by adding or subtracting the twenty values. (Plus some fiddling.) But why binary weighted? Because now the multiplication in the CORDIC algorithm reduces to a shift. (Queue angel chorus thunder roll.) The whole thing runs like greased lightning, even on a microcontroller. (It was used on digital calculators 40 years ago, and they nibbled at maths.) I have a CORDIC algorithm implementation, but it's in TMS9900 assembler. digression Prior to its extinction, that processor had a programmable shift operation, so it did a *2^n in one hit, rather than repeated one bit shifts, making it ideal for this kind of stuff. (Mind you, an xmega would still be one to two orders of magnitude faster than the TMS9900, which had only 3 on-chip registers. The 16 user registers were memory resident, and so could be bank switched, just by changing the Workspace Pointer to use another part of memory, with the previous WP,PC,ST registers replicated in the new R13,R14,R15.) /digression Anyway, it wouldn't be that hard to translate to AVR assembler or C. Must try that one day. Erik ¹ But a dozen table entries use up a 16 bit sine value range, so one might settle for a slightly shorter table than that. -- How many seconds are there in a year? If I tell you there are 3.155 x 10^7, you won't even try to remember it. On the other hand, who could forget that, to within half a percent, pi seconds is a nanocentury. -- Tom Duff, Bell Labs -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
On 27 April 2012 02:38, Gabriel Willen gabewil...@gmail.com wrote: Yes i have seen that video, i actually commented on it asking for the sketch. I haven't heard from him though so i assume he either doesn't want to share it or hasn't checked the comments yet. It seems to have been flagged as spam, so I didn't get a notification. I will see if I can find the sketch, though it is quite possible I din't keep that one. The vast majority of the sketch is concerned with generating a sine wave and measuring voltages to get the feedback from the Resolver. -- atp The idea that there is no such thing as objective truth is, quite simply, wrong. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
[Emc-users] Bldc_Hal
I don't know if I'm miss understanding the bldc Hal component. I have a 3 phase half bridge driver ic that uses cmos, or ttl as inputs. So I configured bldc with q for encoder, h for halls, and B for 6 bit inverting, and 6 for output signal. Is it supposed to generated sinus pwm signals on the outputs or is this a middle man for another price of hardware that would generate the pwm. The ic is a Fairchild smart power module, using a 500 for incremenatal encoded. Thanks Gabe -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
2012/4/26 Gabriel Willen gabewil...@gmail.com: Is it supposed to generated sinus pwm signals on the outputs or is this a middle man for another price of hardware that would generate the pwm. No, it does not do actual pwm generation. Mesa FPGA cards have 3-phase pwm generator module. Viesturs -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
Emc has pwmgen as a hal componant... Tecnically you could use the software pwmgen componant to generate pwm. I have run a rather large brushed servo as others have. Might be good for testing theories.. sam On Thu, 26 Apr 2012 15:59:35 +0300 Viesturs L?cis viesturs.la...@gmail.com wrote: 2012/4/26 Gabriel Willen gabewil...@gmail.com: Is it supposed to generated sinus pwm signals on the outputs or is this a middle man for another price of hardware that would generate the pwm. No, it does not do actual pwm generation. Mesa FPGA cards have 3-phase pwm generator module. Viesturs -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
On 26 April 2012 13:01, Gabriel Willen gabewil...@gmail.com wrote: Is it supposed to generated sinus pwm signals on the outputs or is this a middle man for another price of hardware that would generate the pwm. No, bldc doesn't generate PWM, it generates amplitudes for a PWM generator based on measured rotor position. It might be possible, dependent on the IC, to use a single PWMgen to control the current, and to use the 6 bits to control the gates. (sending PWM to a master-enable pin, for example) The mesa three-phase-PWM generator generates 3 pwm phases on 6 pins in exact phase and with a deadband to prevent shoot-through. I have considered adding a 3pwmgen thread to bldc, but I think that the pwm frequency available in software would be rather too low for bldc use. -- atp The idea that there is no such thing as objective truth is, quite simply, wrong. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
Excellent that is what I figured. Thanks Gabe On Apr 26, 2012 8:02 AM, Viesturs Lācis viesturs.la...@gmail.com wrote: 2012/4/26 Gabriel Willen gabewil...@gmail.com: Is it supposed to generated sinus pwm signals on the outputs or is this a middle man for another price of hardware that would generate the pwm. No, it does not do actual pwm generation. Mesa FPGA cards have 3-phase pwm generator module. Viesturs -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
Andy would you care to enlighten me a little on your sign lookup table? I have an xmega laying around I have been playing with. I have it decoding and picking up the hall positions. But I'm not grasping the sign lookup table. I have read a half a dozen articles on it. In sure I will figure out, I always do but I figured maybe you could help. Also I thought about porting your bldc component, removing the real time and Hal includes and trying to make it work. But honestly I don't need all the wonderful bells and whistles you have included in yours. Thanks Gabe On Apr 26, 2012 8:35 AM, andy pugh bodge...@gmail.com wrote: On 26 April 2012 13:01, Gabriel Willen gabewil...@gmail.com wrote: Is it supposed to generated sinus pwm signals on the outputs or is this a middle man for another price of hardware that would generate the pwm. No, bldc doesn't generate PWM, it generates amplitudes for a PWM generator based on measured rotor position. It might be possible, dependent on the IC, to use a single PWMgen to control the current, and to use the 6 bits to control the gates. (sending PWM to a master-enable pin, for example) The mesa three-phase-PWM generator generates 3 pwm phases on 6 pins in exact phase and with a deadband to prevent shoot-through. I have considered adding a 3pwmgen thread to bldc, but I think that the pwm frequency available in software would be rather too low for bldc use. -- atp The idea that there is no such thing as objective truth is, quite simply, wrong. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 4/26/2012 9:31 AM, Gabriel Willen wrote: But I'm not grasping the sign lookup table. I have read a half a dozen articles on it. In sure I will figure out, I always do but I figured maybe you could help. I'm still learning LinuxCNC, but I can help with sine look-up tables. The basic concept is very simple...you create a table in RAM where the address represents degrees (or where you are on the circle) and at each address you place the sine of that degree value. That way you can do the complex sine calculations ahead of time and perform a sine calculation using an indexed memory read. Using a full circle for your look-up table is wasteful, however, so typically some folding is done to increase the resolution or reduce the memory required. That's where it begins to get a bit more confusing. Folding around the X and Y coordinates is easy. You can simply invert the address and/or the output and use 90 degrees of sine table to represent 360 degrees of output. It is also possible to fold around the 45 degree axis, but this requires a bit more math. So, if you have a 256 entry table representing a full circle, then your angle is represented as an 8-bit value with a step resolution of 360 / 256, or apx. 1.4 degrees per binary unit. If you fold around the x axis, you can create a sine table with twice as much resolution because it only has to represent 180 degrees (apx. .7 degrees per binary unit), and your angle value is now nine bits. To use the folded table, you use the lower 8-bits of your angle to look up a value from your table. If the MSB of your angle value is zero, the angle is between zero and 180 degrees, so you're done. If the MSB of your angle is one, you need to transform the value you read by 180 degrees. For a sine look-up, that means you invert the output value you read from your table (90 degrees = +1.0, 180 degrees = -1.0). Folding around the Y axis is similar. Your 8 bit look-up table now represents 90 degrees, and your angle value grows to 10 bits. The MSB still represents the 0/180 degree transform (invert the data read from the table), and bit 9 now represents a 90 degree transform. Thinking about 0 to 180 degrees, to transform 90-180 degrees to the 0-90 degree range, you have to subtract 90 from your desired angle. Or in other words, the sine value for 91 degrees is the same as the value for 89 degrees. In binary land, the easy way to do this is to simply invert the index value based on bit 9. So, to sum up, with a 90 degree look-up table, you get the following: // Calculate index for look-up table if Angle[msb-1] = 1 sine_index = not Angle[msb-2 downto 0] else sine_index = Angle[msb-2 downto 0] fi // Look up our sine value Value = Sine_Table[sine_index] // Calculate output value if Angle[msb] = 1 Output = 0 - Value else Output = Value fi - -- Charles Steinkuehler char...@steinkuehler.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+ZY28ACgkQLywbqEHdNFyloQCdFbhQkx2NNKDuFAbaeiD4bCGG gWUAn3NUFIjqYd38vmDdunEqwsPRlOvy =Fu31 -END PGP SIGNATURE- -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
Andy, Yes i have seen that video, i actually commented on it asking for the sketch. I haven't heard from him though so i assume he either doesn't want to share it or hasn't checked the comments yet. Gabe On Thu, Apr 26, 2012 at 10:48 AM, andy pugh bodge...@gmail.com wrote: On 26 April 2012 15:31, Gabriel Willen gabewil...@gmail.com wrote: Andy would you care to enlighten me a little on your sign lookup table? I am not sure what you mean. bldc uses normal maths functions to work out the sine values. Are you asking about how the Hall-sensor table works? Have you seen: http://youtu.be/oyeJfNg3NfQ -- atp The idea that there is no such thing as objective truth is, quite simply, wrong. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] Bldc_Hal
Gabe, That video is Andy's, in case you didn't know. Martin Andy, Yes i have seen that video, i actually commented on it asking for the sketch. I haven't heard from him though so i assume he either doesn't want to share it or hasn't checked the comments yet. Gabe On Thu, Apr 26, 2012 at 10:48 AM, andy pugh bodge...@gmail.com wrote: On 26 April 2012 15:31, Gabriel Willen gabewil...@gmail.com wrote: Andy would you care to enlighten me a little on your sign lookup table? I am not sure what you mean. bldc uses normal maths functions to work out the sine values. Are you asking about how the Hall-sensor table works? Have you seen: http://youtu.be/oyeJfNg3NfQ -- atp The idea that there is no such thing as objective truth is, quite simply, wrong. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users