hamedtorky / arbotix

Automatically exported from code.google.com/p/arbotix
0 stars 0 forks source link

Unable to initialize other serial ports when using BioloidController library #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Include Bioloid Controller library in Arduino sketch
2. Attempt to initialize either Serial, Serial2, or Serial3 (using Arduino
Mega)

What is the expected output? What do you see instead?

I expect that I'd be able to read and write to the other serial ports on
the controller, but when trying to initialize them, I get the following
error compiling: ...\hardware\libraries\Bioloid/ax12.cpp:67: first defined here

This happens with Serial, Serial2, and Serial3.

What version of the product are you using? On what operating system?
Using the currently available ax12.cpp/.h and bioloidcontroller.cpp/.h with
Arduino Mega on Windows XP 32-bit.

Original issue reported on code.google.com by ken.horn...@gmail.com on 21 Jan 2010 at 5:15

GoogleCodeExporter commented 9 years ago
Next week I'm also going to try to connect an Arduino Mega to an AX-12, I still 
wish to 
be able to use the other serial ports (especially the one connected to the USB 
port). So I 
will start writing some software this weekend to see if I'm also going to be 
bitten by 
this.

Original comment by mlangenb...@gmail.com on 13 Feb 2010 at 10:35

GoogleCodeExporter commented 9 years ago
Just FYI, I don't have a mega to test on, so this won't be fixed in-house at 
Vanadium.

-Fergs

Original comment by MFergs7@gmail.com on 19 Feb 2010 at 8:19

GoogleCodeExporter commented 9 years ago
I should point out -- the ArbotiX core is a MODIFIED sanguino core. In 
particular, we
have disabled the Serial1 ISR inside the core, and provide our own, faster 
version in
the ArbotiX core. 

You won't be able to just use the library, because it includes an ISR. You'll 
either
have to edit the Mega core to remove the Serial1 instance, or edit the AX-12 
driver
to use the default Serial1 and drop your bus speed from 1MBps to deal with the 
slower
ISR.

-Fergs

Original comment by MFergs7@gmail.com on 19 Feb 2010 at 8:26

GoogleCodeExporter commented 9 years ago
So I fixed this by opening 
'/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/ardui
no/HardwareSerial.cpp' and commenting the following lines.

SIGNAL(SIG_USART1_RECV)
{
  unsigned char c = UDR1;
  store_char(c, &rx_buffer1);
}

This disables the existing Serial1 handling. Now I am able to use Serial, 
Serial2 and 
Serial3 in combination with a Dynamixel AX-12 connected to tx1 & rx1.

By the way, thanks for the library. It's working great for me! 

Original comment by mlangenb...@gmail.com on 19 Feb 2010 at 8:38

GoogleCodeExporter commented 9 years ago

Original comment by MFergs7@gmail.com on 17 Aug 2010 at 7:51