HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Sep 25, 2008, 11:31 PM
7000mw of raw power!
rich smith's Avatar
New Hampshire (not the old one)
Joined Dec 2006
5,987 Posts
David,

I know that feeling realizing that new code was not being downloaded when I thought it was. Hate it when that happens. Personally don't like Ponyprog, Dude, or any WINDOWS utilities for that matter. "Real Men" use "Real Mode" is my motto.

Still a little confused though. Current hex on your site is exactly the same as an image previously downloaded. Will try it again anyway.

Have downloaded several files called "flea101_dt1a.hex" so far, not all of them the same. Hard to tell what's what. May I suggest using different names for different files. In the world of professional programming it is considered Mortal Sin to have different files with same name. Document control issue etc.. I've separated them according to download date for now.

I'll try the new hex in the morning but have a feeling motors may still require "manual encouragement" because it's same as previous copy. Unless I had them confused before. I plan to mod another ESC or two also. I'd really like to get control of an off-the-shelf unit before going back to DIY. We'll see.

Thanks,
-Rich


Quote:
Originally Posted by David T
It's been bothering me that I could not get newly compiled versions of my code to run. I believe I know why, Ponyprog was not reloading the software automatically as expected after making changes.

I have uploaded new versions of both the asm and hex tonight. This works on my Turnigy in both RC (with a radio) and FF (no radio) modes with appropriate changes to the settings. It is in FF mode currently on my site so needs a pushbutton in place of a radio.
David.
rich smith is offline Find More Posts by rich smith
Reply With Quote
Sign up now
to remove ads between posts
Old Sep 26, 2008, 12:59 PM
Registered User
UK
Joined Aug 2000
1,082 Posts
Rich, I have only published the file 'flea101_dt1a.hex' twice on my site. I have not changed anything so it should have remained the same. I really think you need to use an LED to work out where the code fails on startup. I might then be able to help more.
David.
David T is offline Find More Posts by David T
Reply With Quote
Old Sep 26, 2008, 11:49 PM
7000mw of raw power!
rich smith's Avatar
New Hampshire (not the old one)
Joined Dec 2006
5,987 Posts
David,

Sorry, I am easily confused. Still not sure if you put up a new version or not. I definitely have two different files by that name that have not been altered since download. Thought I tried them both but will do so again to be sure.

There is an LED as you can see in my pic (a BIG one!) but this method fails me with interrupt driven code. The motor runs if pushed so startup routine (BEMF) may be trouble. Or just something peculiar about my combination of components. I know Steve and others are having mucho problems getting some 1g ESC to start with 2g motor. Others work fine.

Must admit I have not spent a lot of time recompiling. Time and geography make it difficult plus I have other projects on the front burner. Like all little children I'm hoping to have something that works dropped right into my lap. Several things to try when starting up again.

Thanks for your patience,
-Rich



Quote:
Originally Posted by David T
Rich, I have only published the file 'flea101_dt1a.hex' twice on my site. I have not changed anything so it should have remained the same. I really think you need to use an LED to work out where the code fails on startup. I might then be able to help more.
David.
rich smith is offline Find More Posts by rich smith
Reply With Quote
Old Sep 27, 2008, 04:22 AM
Registered User
UK
Joined Aug 2000
1,082 Posts
Rich, I have not changed anything. I have uploaded the same version to my site to be sure I had published matching hex and source.

I don't understand why you think interrupts will interfere with LED testing. I don't expect them to. Let me explain what I would do. There are two 'beep' functions. These currently switch a LED on and off (if fitted) when beeping the motor. Do you hear beeps and see the LED? If not, you need to get the LED working.

If the LED is working, you may want to comment out the code that activates it the LED in the beep functions so that they don't confuse further tests. Confirm that the LEDs are now not coming on.

I would then insert new temporary statements to switch the LED on at one point in the program where you expect it to reach. For example at the beginning of run_config: and make sure it comes on as expected. Then move that statement to the end of that function to ensure it completes it.

That function jumps to motor_start: so you would then need to move the statement which switches the LED on to perform separate tests with it at the beginning and end of that function.

You should eventually jump to state1: which gets a bit more complex. In the state functions I used to try to make the LED switch both on and off in various places so that I could confirm that it is moving through the states. The LED should flicker as the motor runs or stay on or stay off depending on where it gets stuck. The rate of flicker should change with rpm so vary the voltage to see this. This function branches to others so lets discuss this more when you get the time to get this far.
Regards, David.
David T is offline Find More Posts by David T
Reply With Quote
Old Sep 27, 2008, 11:51 AM
7000mw of raw power!
rich smith's Avatar
New Hampshire (not the old one)
Joined Dec 2006
5,987 Posts
David,

First, I want to thank you again for your willingness to help me. I know I'm doing something really stupid and will laugh when I look back on this.

To summarize again, the beeps, LED, and FF behave perfectly. I can hold down the button, re-init the EE, and go through the button-reset/button-run loop many times. It's just that the motor needs to be pushed 99.9% of the time so there's something up with the start routine or my hardware.

Part of the problem is I'm very bad at understanding other peoples code (that part of my brain was damaged as a baby, thanks mom). Particularly if there's a non-deterministic element like hardware ints, BEMF, unconditional gotos, etc.. Complicated by having only minutes instead of hours at a time to play with this stuff. Also loath to modify code I don't understand having blown a couple ESC already.

The run_cfg routine appears to be dealing with buttons etc. so my problem is way beyond that. Is there any simple RJMP I can add or line to comment out that would try to start the motor on reset w/o BEMF, EE, button, timeout, overcurrent, or any other stuff that's complicating things? I would like to isolate it down to the motor start routine where it seems to fail.

In other words is there any way I can get the motor to run slow (open loop)with no BEMF so I can debug FETs with a scope and don't have to keep bumping that dam button over and over?

I would just LOVE to see a motor start and do absolutely nothing else.

Thanks,
-Rich





Quote:
Originally Posted by David T
Rich, I have not changed anything. I have uploaded the same version to my site to be sure I had published matching hex and source.

I don't understand why you think interrupts will interfere with LED testing. I don't expect them to. Let me explain what I would do. There are two 'beep' functions. These currently switch a LED on and off (if fitted) when beeping the motor. Do you hear beeps and see the LED? If not, you need to get the LED working.

If the LED is working, you may want to comment out the code that activates it the LED in the beep functions so that they don't confuse further tests. Confirm that the LEDs are now not coming on.

I would then insert new temporary statements to switch the LED on at one point in the program where you expect it to reach. For example at the beginning of run_config: and make sure it comes on as expected. Then move that statement to the end of that function to ensure it completes it.

That function jumps to motor_start: so you would then need to move the statement which switches the LED on to perform separate tests with it at the beginning and end of that function.

You should eventually jump to state1: which gets a bit more complex. In the state functions I used to try to make the LED switch both on and off in various places so that I could confirm that it is moving through the states. The LED should flicker as the motor runs or stay on or stay off depending on where it gets stuck. The rate of flicker should change with rpm so vary the voltage to see this. This function branches to others so lets discuss this more when you get the time to get this far.
Regards, David.
rich smith is offline Find More Posts by rich smith
Reply With Quote
Old Sep 28, 2008, 05:22 AM
Registered User
UK
Joined Aug 2000
1,082 Posts
I don't think you should be commenting out parts of the active program. I've been trying to get you to identify where it gets to and fails. You want to use a scope so lets try another approach. The program has two ways of making the FETs switch:

1. An elapsed time is used when the motor is stationary or running very slowly. The compScanTIMEOUT constant sets this duration. A larger number (eg: 48000) will keep FETs on for longer periods during startup. Are you seeing the FETs switch after pressing the button and does this parameter change their switching frequency?

2. BEMF triggers commutation (FETs switching) when the motor is running. This part seems fine in your motors.

POWER_RANGE is currently set to 100 and sets the PWM duty cycle to 100% at full power. Reducing this should make the motor run slower (when fully up to speed). On mine I can reduce it to 40 and the motor still runs. Smaller than this and it will not run. This implies that this parameter is used in a way that is more complex and perhaps is not really meant to be changed from 100. Perhaps you can confirm with your scope whether it makes the motor run slower when set to a smaller number.

Do you fly RC or can you generate an appropriate square wave? If you do then compile the program as 'RC' (not FF). Does the motor start/FETs switch when driven by a receiver signal? An RC signal will allow you to regulate the speed over it's 0-100% duty cycle range.
Regards, David.
David T is offline Find More Posts by David T
Reply With Quote
Old Sep 28, 2008, 12:10 PM
7000mw of raw power!
rich smith's Avatar
New Hampshire (not the old one)
Joined Dec 2006
5,987 Posts
David,

Your comments are going a long way toward helping me understand the program. Thanks. It's not that I don't want to trace progress through the code, it's just that constant poking and recompiling caused smoke with motor capable supply and nothing obvious with low current supply. I am able to turn LED on and off but trying to do much more has caused disaster before. Guess I need to overcome my "fear of frying".

When I said "slow" it was not so much speed as open loop operation that was being referred to. As I described in earlier posts the RC mode performs exactly as it should except, like with FF, the motor needs a push. This hand twist must be done within a window of a few seconds to work. Maybe due to overcurrent shutdown or some other safety timeout. That's why I keep going on about the motor start routine. If I'm not mistaken doesn't the motor require some open loop (no BEMF) pulses to get going? I'd like to see this happen.

Pushing the button does not result in any activity on the FETs. Usually one can see or feel a little vibration as the motor tries to get going prior to closed loop operation. Nothing on scope either. Can you tell me where to turn on the LED to see how far it's getting?

Unfortunately my hardware setup, software tools, and internet access are scattered across 3 states which slows me down. Literally hundreds of miles apart. I have to "hide" my toys from wifey in order to stay out of divorce court and it's not fair to "play" during the day becuase I don't allow my employees to do it.

I'm beginning to think this ESC is flaky. I'll pull another few out of the bag and mod them to eliminate that possibility. Just the fact that you have recently run and verified the code on your site is the most useful clue so far.

Thanks again,
-Rich


Quote:
Originally Posted by David T
I don't think you should be commenting out parts of the active program. I've been trying to get you to identify where it gets to and fails. You want to use a scope so lets try another approach. The program has two ways of making the FETs switch:

1. An elapsed time is used when the motor is stationary or running very slowly. The compScanTIMEOUT constant sets this duration. A larger number (eg: 48000) will keep FETs on for longer periods during startup. Are you seeing the FETs switch after pressing the button and does this parameter change their switching frequency?

2. BEMF triggers commutation (FETs switching) when the motor is running. This part seems fine in your motors.

POWER_RANGE is currently set to 100 and sets the PWM duty cycle to 100% at full power. Reducing this should make the motor run slower (when fully up to speed). On mine I can reduce it to 40 and the motor still runs. Smaller than this and it will not run. This implies that this parameter is used in a way that is more complex and perhaps is not really meant to be changed from 100. Perhaps you can confirm with your scope whether it makes the motor run slower when set to a smaller number.

Do you fly RC or can you generate an appropriate square wave? If you do then compile the program as 'RC' (not FF). Does the motor start/FETs switch when driven by a receiver signal? An RC signal will allow you to regulate the speed over it's 0-100% duty cycle range.
Regards, David.
rich smith is offline Find More Posts by rich smith
Reply With Quote
Old Sep 29, 2008, 09:53 AM
7000mw of raw power!
rich smith's Avatar
New Hampshire (not the old one)
Joined Dec 2006
5,987 Posts
David,

Ok, I verified there is no FET activity when button is pressed (except every other press where beeps cause 50us pulses of course). The motor often stalls and shuts down part way through the ramp-up too. Then there's a 2s recovery as described in your docs. My guess is the overcurrent routines are failing to differentiate between startup and stall on my particular ESC. As you say on your site:

quote:
"I have found it difficult to distinguish between a
stalled motor and one that is starting slowly."

Can you suggest a safe way to disable the overcurrent routines?

Also, do you think it's ok to download hex while battery and motor are connected?

-Rich
rich smith is offline Find More Posts by rich smith
Reply With Quote
Old Sep 29, 2008, 12:54 PM
Registered User
Joined Aug 2008
1 Posts
I have seen many of the ESCs have a method to cause the motor to "beep" or play a sound. Any idea how this is done?
plaiming is offline Find More Posts by plaiming
Reply With Quote
Old Sep 29, 2008, 12:55 PM
7000mw of raw power!
rich smith's Avatar
New Hampshire (not the old one)
Joined Dec 2006
5,987 Posts
David,

WOO HOO! SUCCESS!

It's running! I found the problem!

It appears your code has trouble starting with stm8306 FETS. I built up 4 more ESCs and 3 of them ran with your hex. Looking closely I notice Turnigy uses 8306 FETs on the two that don't start and 4503 on the three that do. Unless it's incredible coincidence or there's other component changes too this was the problem. They look identical except for that.

You are a genius! This has saved me hundreds of hours of tedious debugging and many "snap-crackle-pop". Now that I have something to start with it should be a cinch porting to a .5g design like the "ebay" ESC. Thank you Thank you Thank you.

Gratefully Yours,
-Rich
-
rich smith is offline Find More Posts by rich smith
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
FAQ five(5) diy brushless ESC designs Ron van Sommeren DIY Electronics 105 Feb 13, 2014 07:39 AM
Diy brushless esc slowflyer90 DIY Electronics 66 Mar 25, 2006 07:56 AM
Best DIY Brushless ESC Kit? gfcermak DIY Electronics 10 Aug 25, 2004 01:23 AM
group order for diy Speedy-BL brushless ESC family Ron van Sommeren Electric Plane Talk 5 Jul 27, 2003 10:56 AM