| View previous topic :: View next topic |
| Author |
Message |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Mon Dec 21, 2009 5:48 pm Post subject: V3 request for help via email |
|
|
I got a request via email to look into the following:
Hello,
i'm trying to get the openservo v3 board bought from robotfuzz working, but without success.
The Aim is to controll a few servos with a XMega through a TWI-Levelhifter with mosfets, but because it didn't work at the first tests, i now use a Arduino for testing.
The reason for that is because at http://www.openservo.com/forums/viewtopic.php?t=942 there is sample code, and therefore twi should be the right speed and work... just to minimise possible sources of errors.
With a oszilloscope i can see, that there seems to be TWI-Traffic, and a fairly simple TWI-Monitor (built out of a ATTiny2313) shows that only almost the expectet values are transmitted (Slave-Adress is set as 0x10)
| Quote: |
<20,10,07,d0,>
<20,10,13,88,>
|
This is my first problem. The second one is the Firmware for OpenServoV3 itself.
I got OpenServo_V3 from CVS. (Besides: OpenServo_V3-Dev doesn't compile in AVR-Studio)
In openservo.h i checkd that the Slave-Adress is 0x10
| Code: |
#define REG_DEFAULT_TWI_ADDR 0x10
|
In config.h i changed to the following:
| Code: |
#define TWI_CHECKED_ENABLED 0
#define CURVE_MOTION_ENABLED 1
#define MAIN_MOTION_TEST_ENABLED 1
#define PULSE_CONTROL_ENABLED 0
#define SWAP_PWM_DIRECTION_ENABLED 0
#define HARDWARE_TYPE HARDWARE_TYPE_HITEC_HS_475HB
|
I've got a HS-645MG, but that should work for first time, too.
I enabled Motion_test, because i'd like to try the servo alone first.
But as you can guess, nothing is moving.
I've got a AVRISPMKII and stepped through the program; reading ADC is correct; but nothing moves.
http://www.openservo.com/TWIProtocol
Corresponding to the Values above the following is happening cyclic:
TIMER-Register is written to a value (for example 8 to 11)
POSITION-Register is written to zero
VELOCITY-Register is written to zero
POWER-Register is written to zero
Why is this?
Best Regards ulstech _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Mon Dec 21, 2009 5:55 pm Post subject: |
|
|
The V3 supports clock stretching, so pretty much any speed is workable. I can't see why a speed issue would cause a problem.
| Quote: | | This is my first problem. |
So you are not getting a response back from the OpenServo?
Here are some things to look at:
Are you running at 6.2v or above?
You have the TWI connectors the right way around?
| Quote: | The second one is the Firmware for OpenServoV3 itself.
I got OpenServo_V3 from CVS. (Besides: OpenServo_V3-Dev doesn't compile in AVR-Studio)
|
V3-dev is very very dev at the moment. There is no guarantee that the alpha code will work out of CVS.
| Quote: |
In config.h i changed to the following:
Code:
#define TWI_CHECKED_ENABLED 0
#define CURVE_MOTION_ENABLED 1
#define MAIN_MOTION_TEST_ENABLED 1
#define PULSE_CONTROL_ENABLED 0
#define SWAP_PWM_DIRECTION_ENABLED 0
#define HARDWARE_TYPE HARDWARE_TYPE_HITEC_HS_475HB
I've got a HS-645MG, but that should work for first time, too.
I enabled Motion_test, because i'd like to try the servo alone first.
But as you can guess, nothing is moving.
|
Okay, that looks good. Remember you will need to set a P and a D value for the servo to ewven think about moving. Make sure you have some reasonable values set for this (P=0x600 D=0x100 for example.)
Regards,
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
ulstech
Joined: 21 Dec 2009 Posts: 2
|
Posted: Mon Dec 21, 2009 9:11 pm Post subject: |
|
|
Thank you for posting my Mail, Barry!
| Quote: | | So you are not getting a response back from the OpenServo? |
I didn't try to read registers, it's strange that there is no call of the TWI ISR when debugging with jtagicemkII. Therefore I didn't try it. I'll try it out tomorrow, but i don't think it will help...
| Quote: | | Are you running at 6.2v or above? |
For testing i use a laboratory power supply.
First i tried 6V, then 6.5V and 7V. I set the current limit to 2 Ampere (because the scematic says rated for 2A at current monitor).
| Quote: | | You have the TWI connectors the right way around? |
The Board itself is running with no problems, the connector at the Servo has connection to the corret pins and i didn't find a open circuit.
Could it be, that my pullup is to low? I use 5k6 resistors. But with the "fake" OpenServo (m88 without all the hardware around) TWI worked...
| Quote: | | Quote: | The second one is the Firmware for OpenServoV3 itself.
I got OpenServo_V3 from CVS. (Besides: OpenServo_V3-Dev doesn't compile in AVR-Studio)
|
V3-dev is very very dev at the moment. There is no guarantee that the alpha code will work out of CVS.
|
Ah, ok, no problem at all. I just would have sayd it in case you didn't knew it.
| Quote: |
| Quote: |
In config.h i changed to the following:
Code:
#define TWI_CHECKED_ENABLED 0
#define CURVE_MOTION_ENABLED 1
#define MAIN_MOTION_TEST_ENABLED 1
#define PULSE_CONTROL_ENABLED 0
#define SWAP_PWM_DIRECTION_ENABLED 0
#define HARDWARE_TYPE HARDWARE_TYPE_HITEC_HS_475HB
I've got a HS-645MG, but that should work for first time, too.
I enabled Motion_test, because i'd like to try the servo alone first.
But as you can guess, nothing is moving.
|
Okay, that looks good. Remember you will need to set a P and a D value for the servo to ewven think about moving. Make sure you have some reasonable values set for this (P=0x600 D=0x100 for example.)
|
I set the Hardwaretype to HS475 - therefore the following is set:
| Code: |
#define DEFAULT_PID_PGAIN 0x0600
#define DEFAULT_PID_DGAIN 0x0C00
#define DEFAULT_PID_IGAIN 0x0000
#define DEFAULT_PID_DEADBAND 0x01
#define DEFAULT_MIN_SEEK 0x0060
#define DEFAULT_MAX_SEEK 0x03A0
#define DEFAULT_PWM_FREQ_DIVIDER 0x0040
|
Just for myself, that i got it right: if i enable MAIN_MOTION_TEST_ENABLED, the Servo itself should move alone just by apply power, right?
Best Regards, ulstech |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Mon Dec 21, 2009 9:36 pm Post subject: |
|
|
Hi,
| Quote: |
I use 5k6 resistors
|
Should be okay, but you could try another value.
Let us know if you get a read off the device ok. I'm not hopeful if the ISR isn't firing.
| Quote: | | Just for myself, that i got it right: if i enable MAIN_MOTION_TEST_ENABLED, the Servo itself should move alone just by apply power, right? |
Yes. Using the configuration you have uploaded, I see no problem. I can only think you might want to look at the compiler flags, although these are hard coded into the AVR studio.
I assume you reflashed the V3? If so, did you leave the bootloader in there?
If you still have problems, I can send you a default V3 flash file to upload.
Cheers _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
ulstech
Joined: 21 Dec 2009 Posts: 2
|
Posted: Tue Dec 22, 2009 11:56 pm Post subject: |
|
|
Ok, today i really became confused.
I assembled another OS3 Board and TWI-Communication worked from the start. Then i wanted to test, weather twi_registers_write() gets the right values for the right register to write. But it seems like -Os was choosen as Optimization Level. I changed it to -O0 and verified that TWI-Communication just works correct. After flashing this firmware to the Servo which didn't work the last time, it began to adjust the motor beyond the limit. I didn't change anything in Firmware except setting the initial -OS to O0.
I do think, that there is still something wrong with the first board - it consumes about 200mA in Idle - compared to the 20mA of the new assembled one.
I didn't built in the new one to a real Servo, but testing with a Oscilloscope at the output for the Motor and a Poti manually connected there is about a value range for position of about 50 to 800 or so. I just tried out this few values testing; the real ones might be quite a few more.
Only last Problem i've got at the moment is, that i wonder weather there is a builtin value or something to limit the current for the motor by software. I shure know, that limitin with laboratory power supply is much better, but for adjusting the servo it would help a lot, and this would also be good for the time using the servo with a battery supply.
| Quote: | | I assume you reflashed the V3? If so, did you leave the bootloader in there? |
As far as i remember, there were lockbits set for the bootloader. Therefore it should still be on the ATMega, but i can't use it because i haven't got the OSIF or something like that..
| Quote: | | If you still have problems, I can send you a default V3 flash file to upload. |
Before i flashed the device, i took a backup. Is this with the original values form CVS-Firmware? I mean Slave-Adress 0x10, proportional and derivative zero?
Best Regards
ulstech |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|