go_away

Author Topic: Misc with Axon and Sabertooth  (Read 2008 times)

0 Members and 1 Guest are viewing this topic.

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Misc with Axon and Sabertooth
« 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 (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

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Misc with Axon and Sabertooth
« Reply #1 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.

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #2 on: December 14, 2009, 06:43:14 AM »
Yeah I know!  ;D I'll try and I will tell you later!

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #3 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

Offline Invicta

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 1
Re: Misc with Axon and Sabertooth
« Reply #4 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


Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #5 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

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #6 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!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Misc with Axon and Sabertooth
« Reply #7 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);

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #8 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!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Misc with Axon and Sabertooth
« Reply #9 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?

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #10 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.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Misc with Axon and Sabertooth
« Reply #11 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?

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #12 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!

Offline taba93Topic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: Misc with Axon and Sabertooth
« Reply #13 on: December 23, 2009, 08:15:50 AM »
Ok, now it works! thanks for the help. Happy holidays!

 


Get Your Ad Here