weinbergmath
28-12-2007, 22:51
Hi everyone,
I've been working on an idea I've had for a while now of using an Arduino board as a navigation coprocessor for our team's FRC robot. The board works quite well for its current purpose, which is to read encoder counts, calculate distance, orientation, and potentially other important quantities related to navigation. My plan is to have the board output this data to the serial port using the same format as the CMU camera, allowing me to use and tweak Kevin Watson's code for grabbing camera data for this application.
Right now I am prototyping this on a Vex RC using the TTL serial port and the camera software written for the edubot that HAS previously worked with the camera. (We used it last year for prototyping.) I have connected the grounds between the Arduino and Vex and the Vex rx pin to the Arduino TX output. As a test, I sent the letter 'k' continuously through serial port 2, and wrote another program on the arduino to turn on an led when it receives a 'k'.
The problem is (as you might have guessed) that the two are not talking to each other in this simple test. I have configured the arduino at 9600 bps, 8-N-1 as is default in the serial port software for serial port two. I have tested the serial port with another arduino board at both 9600 and 115200 bps to show that the serial port functions. I have also tried 115200 bps out of the vex from both serial ports one and two.
By connecting a dumb terminal to the output, I've been able to read directly the output of the vex serial port. On serial port one, the characters come out correctly when I call "Write_Serial_Port_One('k'), but the serial data is clearly not read by the arduino since the LED does not go on. With serial port two, things become a bit more strange - the only way to send the 'k' is by sending the character code in Write_Serial_Port_Two(), and not with 'k' in the parentheses. When I call Write_Serial_Port_Two('k') it sends a blank character, and this is independent of the speed I tell it to send at.
I guess the deal breaker is that I can't verify that the serial ports are communicating, and without this, there's no chance the arduino can send the data back to the RC.
My question for the experts: If the pins are correctly connected (RX to TX, grounds connected together) and the port speeds are the same, is there anything ELSE that would also have to be configured to make two serial ports talk to each other? Is there a reason why the Write_Serial_Port functions would not be able to send a character ('k') out of serial port 2, but would be able to out of serial port 1?
Please let me know if you can think of things to try....
Thanks!
Evan
I've been working on an idea I've had for a while now of using an Arduino board as a navigation coprocessor for our team's FRC robot. The board works quite well for its current purpose, which is to read encoder counts, calculate distance, orientation, and potentially other important quantities related to navigation. My plan is to have the board output this data to the serial port using the same format as the CMU camera, allowing me to use and tweak Kevin Watson's code for grabbing camera data for this application.
Right now I am prototyping this on a Vex RC using the TTL serial port and the camera software written for the edubot that HAS previously worked with the camera. (We used it last year for prototyping.) I have connected the grounds between the Arduino and Vex and the Vex rx pin to the Arduino TX output. As a test, I sent the letter 'k' continuously through serial port 2, and wrote another program on the arduino to turn on an led when it receives a 'k'.
The problem is (as you might have guessed) that the two are not talking to each other in this simple test. I have configured the arduino at 9600 bps, 8-N-1 as is default in the serial port software for serial port two. I have tested the serial port with another arduino board at both 9600 and 115200 bps to show that the serial port functions. I have also tried 115200 bps out of the vex from both serial ports one and two.
By connecting a dumb terminal to the output, I've been able to read directly the output of the vex serial port. On serial port one, the characters come out correctly when I call "Write_Serial_Port_One('k'), but the serial data is clearly not read by the arduino since the LED does not go on. With serial port two, things become a bit more strange - the only way to send the 'k' is by sending the character code in Write_Serial_Port_Two(), and not with 'k' in the parentheses. When I call Write_Serial_Port_Two('k') it sends a blank character, and this is independent of the speed I tell it to send at.
I guess the deal breaker is that I can't verify that the serial ports are communicating, and without this, there's no chance the arduino can send the data back to the RC.
My question for the experts: If the pins are correctly connected (RX to TX, grounds connected together) and the port speeds are the same, is there anything ELSE that would also have to be configured to make two serial ports talk to each other? Is there a reason why the Write_Serial_Port functions would not be able to send a character ('k') out of serial port 2, but would be able to out of serial port 1?
Please let me know if you can think of things to try....
Thanks!
Evan