Society of Robots - Robot Forum

Software => Software => Topic started by: taba93 on December 13, 2009, 07:14:15 AM

Title: Misc with Axon and Sabertooth
Post by: taba93 on December 13, 2009, 07:14:15 AM
Hi all,

I would like only to know if this method could teorically work.
I have the Axon and the Sabertooth 2x10 motor controller.
I have connected the Uart2 Tx Pin to the S1 port of the Sabertooth and the G Pin to the 0V port of the Sabertooth. I have set the switches of the Axon with the same method of page 13 of the Sabertooth datasheet -> http://www.dimensionengineering.com/datasheets/Sabertooth2x10.pdf (http://www.dimensionengineering.com/datasheets/Sabertooth2x10.pdf) (the 38400 baud rate) and I've written this simple code:

Eurex_rr.c file:


//SoR Include
#include "SoR_Utils.h" //includes all the technical stuff
#include "hardware.c" //declare hardware variables and ports
//#include "CMUcam.c" //not yet written
#include "sensors.c" //sensor libraries for sonar, sharp IR, etc.
#include "misc.c" //includes libraries for various hardware and other useful stuff
#include "axon_DAQ.c" //use the Axon like a data acquisition device
//#include "Blackfin_Axon.c" //files for Blackfin Robot camera
#include "control.c" //your code goes in here
//#include "servo_controller.c" //Axon servo controller
//#include "axon_test.c" //include this is doing a function test for the Axon
//#include "axon_oscope_test.c" //include this is doing a function test for the Axon


int main(void)
   {
         while (1 == 1){
          sabertooth (40,179);
         }
         }

and I compile it in a hex file and I must now only upload it to the Axon microcontroller. Is this going to work?
Thank you, bye bye
Title: Re: Misc with Axon and Sabertooth
Post by: Admin on December 14, 2009, 05:45:15 AM
Quote
I have set the switches of the Axon with the same method of page 13 of the Sabertooth datasheet
Axon doesn't have switches :P
(I know what you meant, just making fun thats all :P)

Quote
while (1 == 1)
should be:
while(1)


Otherwise on quick glance it all looks fine.
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 14, 2009, 06:43:14 AM
Yeah I know!  ;D I'll try and I will tell you later!
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 15, 2009, 02:35:31 PM
I tried it today. First I've uploaded to the Axon the axon_tst.hex file to try the UART ports and it all looks fine cause the motor began to move (this means that the connections are fine).
After that, I compiled my "Eurex_rr.c" file doing "Build" in Avr Studio and I've upload it to the axon. The result was that the motors didn't move. First I thought that I've done some errors in my file or in the "misc.c" file but there were no errors. So I tried to put in my code this line: "LED_on();" only to know if it works but the led didn't turn on and I don't know why.
Are there some errors?  ??? bye
Title: Re: Misc with Axon and Sabertooth
Post by: Invicta on December 16, 2009, 08:06:40 AM
taba93

I could not help but notice that you have an INCLUDE line:

#include "control.c" //your code goes in here

I could be wrong but is not "control.c" the default example source file. You have created your own file "Eurex_rr.c" which replaces "control.c". Therefore to have it as in INCLUDE may be causing some confusion.

Hope this helps

Invicta

Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 17, 2009, 09:26:41 AM
Hi invicta,
I tried this but it doesn't work. What I'm doing wrong?
@Admin only to know is it possible to have the source of the axon_tst.hex file (I mean the c file?) cause if I upload this file it works!
Thank you
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 17, 2009, 09:39:22 AM
I forgot to say a thing. In my opinion the problem is the code (but it is strange cause you say me that should work) or the compilation but that seem to work too!
Title: Re: Misc with Axon and Sabertooth
Post by: Admin on December 17, 2009, 11:26:47 PM
Put various rprintf("testA");'s in various places. This will tell you where your code stopped working.

Also, add a 50ms delay after
          sabertooth (40,179);
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 18, 2009, 12:35:13 AM
Ok , I'll try, but it is really strange, cause if I do only an easy thing like:

while(1){
           LED_on();
}

it doesn't work!
Title: Re: Misc with Axon and Sabertooth
Post by: Admin on December 18, 2009, 01:23:57 AM
Does the demo code that comes with the Axon work fine?

When you check it with a multimeter, everything works fine? Are you sure you are uploading the correct .hex file?
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 18, 2009, 07:11:42 AM
Which demo code? I only upload the various precompiled programs from this site to the axon and they work. When I go in hyperterminal for example I receive the rprintf results of the axon_tst.hex file.
When I check it with a multimeter it doesn't work at all if I upload my compiled file. If I upload instead one of your compiled programs it works perfectly.
Title: Re: Misc with Axon and Sabertooth
Post by: Admin on December 18, 2009, 08:39:25 AM
Start with the demo photovore code, then selectively modify it to match what you want.

I just noticed you aren't initializing the UART, you aren't initializing timers, nor are you configuring ports. :P

Quote
When I check it with a multimeter it doesn't work at all if I upload my compiled file.
What do you mean? Is the voltage 5V and the battery something higher?
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 18, 2009, 08:46:05 AM
1. ok I'll try. I must initialize ports using the function configuration_ports(); or something like that? (I don't remember the name precisly  :P)
2. nono, the UART port (for example) is 0V...instead with your precompiled program the voltage is 5V!

thank you a lot!
Title: Re: Misc with Axon and Sabertooth
Post by: taba93 on December 23, 2009, 08:15:50 AM
Ok, now it works! thanks for the help. Happy holidays!