BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 9:12 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Sat Apr 02, 2011 9:03 pm 
Offline
Citizen

Joined: Tue Jan 25, 2011 9:40 am
Posts: 10
Hello,

I'm setting up a small four wheel bot with two 2X10A Robo Claws. I can successfully send commands to each board separately at addresses 128 and 129 using packet serial mode. My wiring attempt for talking to both consist of splitting the tx, rx, and gnd leads from the ttl source and connecting each three splits to the two boards. My Problem arises when they are both plugged in at the same time. The commands sent do not successfully provoke the boards to do their thing. I can see that the status light indicates that they have gotten commands on the line, but nothing happens. If I unplug either of the controllers from the split I can once again successfully talk to them. Is a different wiring job needed or different packet structure?

Thanks!

Kent


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Mon Apr 04, 2011 12:35 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Lets see your wiring and your code. Maybe that will help us figure out whats going on.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Mon Apr 04, 2011 3:30 pm 
Offline
Citizen

Joined: Tue Jan 25, 2011 9:40 am
Posts: 10
I purposefully included a detailed description. Is there any reason that splitting the wire as I have done should not work?


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Tue Apr 05, 2011 10:59 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
By asking for the wiring I should have said, "picture of the boards wired up." You'd be surprised how often a problem is found that wasn't described in the detailed descriptions someone posts or a problem was not obvious to the person reading the detailed descriptions. I'm tying to get myself on the same page as you as quickly as I can so posting the code you are using and picture, if you can, of the boards wired up to whatever you are using to talk to it would be helpful.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Tue Apr 05, 2011 8:57 pm 
Offline
Citizen

Joined: Tue Jan 25, 2011 9:40 am
Posts: 10
Here are images of the wiring.

Thanks for the support!

Image
Image

Kent


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Wed Apr 06, 2011 8:47 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
That looks like a usb to serial adapter with a max232 level converter circuit? Do you have access to a oscillascope? It's possible there is some kind of voltage divider happening between all the boards.

Also, even if you don't have a scope, disconnect the S2 line from both boards and send simple commands that require to feedback and tell me what happens. This will tell us if the problem is primarily in the S1 or S2 lines.

I also still would like to see your code that sends commands to the boards.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Wed Apr 06, 2011 11:16 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Am I seeing both RoboClaw's (red and yellow) TX and RX wires in parallel?

Typically you can't just tie two TTL sources together, there will be contention. OK if the two TX's are gated, and only xmit after being addressed. RS-422 and RS-485, of course, are designed for this.

What's the RoboClaw got for it's XMIT circuitry just the uP (Nathan)?

I see three RoboClaws in the simple serial example of the manual, with What looks like SEPERATE TX (serial out) lines. (about page 25).

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Wed Apr 06, 2011 1:44 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Alan,

Packetized serial is setup for busing, it only transmits if it receives a command that requires it, otherwise the pin is left tristated. So you can connect all the roboclaws at one time.

In simple serial it allows you to use one transmit line to all the robo claws and then use a seperate pin for each as a slave select line, when slave select is enabled. Otherwise yes, you'd need individual transmit lines for simple serial mode.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Wed Apr 06, 2011 2:44 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Thanks for the clarification Nathan!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Wed Apr 06, 2011 7:15 pm 
Offline
Citizen

Joined: Tue Jan 25, 2011 9:40 am
Posts: 10
Ok,

I have done some more thorough testing and it seems that there might be a buffer issue. I was able to talk to both boards and drive all four motors with the rx lines connected, but! I had to write the commands several times to successfully get the message across. Should I be sending null bits to clear the buffers? I made sure to keep an eye on the boards status light, which did not flicker every time my program was supposed to be sending off a packet.

Ideas??

I'm using the C code that was posted here a while back for testing... writing my full driver at the moment in C++
Code:
#include <stdio.h>   /* Standard input/output definitions */
#include <string.h>  /* String function definitions */
#include <unistd.h>  /* UNIX standard function definitions */
#include <fcntl.h>   /* File control definitions */
#include <errno.h>   /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */

int fd;

int setSpeed();


int main(int argc, char **argv) {

   unsigned char sCmd[256];
   unsigned char encbuf[64];
   ssize_t enc;
   char c;

//  Open the port and initialize  //
   fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
   if (fd == -1) {
      perror("open_port: Unable to open /dev/ttyUSB0 - ");
      return 1;
   } else {
      fcntl(fd, F_SETFL, 0);
   }

   InitPort(fd);


   cCmd[0] = 0;


 
   //  Address, Cmd, Value, CHK SUM  //   
   //  int Speed = 100;
   //  Motor 1  //
   sCmd[0] = 129;
   sCmd[1] = 0;
   sCmd[2] = 90;
   //sCmd[2] = ((Speed >> 0) & 0xFF);
   //sCmd[3] = ((Speed >> 8) & 0xFF);
   //sCmd[4] = ((Speed >> 16) & 0xFF);
   //sCmd[5] = ((Speed >> 24) & 0xFF);
   //sCmd[6] = (sCmd[0]+sCmd[1]+sCmd[2]+sCmd[3]+sCmd[4]+sCmd[5]) & 0x7F;
   sCmd[3] = (sCmd[0] + sCmd[1] + sCmd[2]) & 0x7F;

   //  Error checking  //
   printf("This is: %x\n",sCmd[0]);
   printf("This is: %x\n",sCmd[1]);
   printf("This is: %x\n",sCmd[2]);
   printf("This is: %x\n",sCmd[3]);
   //printf("This is: %x\n",sCmd[4]);
   //printf("This is: %x\n",sCmd[5]);
   //printf("This is: %x\n",sCmd[6]);
   /////////////////////////////////
     
   //  write data to the port  //
   if (!writeport(fd, sCmd, 7)) {
      printf("write failed\n");
      close(fd);
      return 1;
   }


   
}

int writeport(int fd, char * chars, int NBytes) {
   int n = write(fd, chars, NBytes);
   if (n < 0) {
      fputs("write failed!\n", stderr);
      return 0;
   }
   return 1;
}


int InitPort(int fd) {
   struct termios config;
   
   config.c_iflag &= ~(IGNBRK | BRKINT | ICRNL | INLCR | PARMRK | INPCK | ISTRIP | IXON);
    config.c_oflag = 0;
    //
    // No line processing:
    // echo off, echo newline off, canonical mode off,
    // extended input processing off, signal chars off
    //
    config.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
    //
    // Turn off character processing
    // clear current char size mask, no parity checking,
    // no output processing, force 8 bit input
    //
    config.c_cflag &= ~(CSIZE | PARENB);
    config.c_cflag |= CS8;
    config.c_cflag |= (CLOCAL | CREAD);
    //
    // One input byte is enough to return from read()
    // Inter-character timer off
    //
    config.c_cc[VMIN]  = 1;
    config.c_cc[VTIME] = 0;
    //
    // Communication speed (simple version, using the predefined
    // constants)
    //
    if(cfsetispeed(&config, B9600) < 0 || cfsetospeed(&config, B9600) < 0)
        printf("Baud not set \n " );

    //
    // Finally, apply the configuration
    //
    if(tcsetattr(fd, TCSAFLUSH, &config) < 0)
        printf( "Config Not Applied \n");
   return 1;
}


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Sun Oct 23, 2011 7:06 pm 
Offline
Citizen

Joined: Tue Jan 25, 2011 9:40 am
Posts: 10
Any replies to this would be appreciated

Does there need to be delay between the writes to each address?


Attachments:
resized_in.jpg
resized_in.jpg [ 299.04 KiB | Viewed 319 times ]
resized_out.jpg
resized_out.jpg [ 257.55 KiB | Viewed 319 times ]
Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Mon Oct 24, 2011 9:53 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Try adding a delay between packets being sent to the different controllers. One thing you may want to try to see if there is some kind of buffer corruption is send some NULL bytes on the bus between cmds instead of pausing.

Also just to clarify, if you remove one roboclaw from the bus and run the same program does the other robocalw function correctly or still miss some of the commands sent to it? That would definitely indicate a buffer corruption issue.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Fri Oct 28, 2011 12:32 am 
Offline
Citizen

Joined: Mon Oct 03, 2011 12:02 pm
Posts: 6
Another thing to check is TTL signaling level of your USB to serial adapter. Some models are 3.3V only and RoboClaw is 5V, right?

Paul


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Fri Oct 28, 2011 10:16 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
3.3v is still enough even with 5v devices.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Addressing two 2X10A Robo Claw's from single ttl source
PostPosted: Tue Nov 01, 2011 10:53 am 
Offline
Citizen

Joined: Tue Jan 25, 2011 9:40 am
Posts: 10
Ok so the verdict is...

I can successfully talk to both, but with a minimum delay of 1 second. I tried micro seconds from 10 - 100000 in increments of power of 10 with no luck until approaching 1 second. Sending off null bytes in between commands to each board did not help either..

Thoughts?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO