Go to Post It all seems like good clean fun until someone drops a Phaeton 65 meters. - Rick TYler [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-28-2007, 10:51 PM
weinbergmath's Avatar
weinbergmath weinbergmath is offline
Mentor to China FTC/FLL, FRC1230
AKA: Evan Weinberg
FRC #1230
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Hangzhou, China
Posts: 22
weinbergmath is a splendid one to beholdweinbergmath is a splendid one to beholdweinbergmath is a splendid one to beholdweinbergmath is a splendid one to beholdweinbergmath is a splendid one to beholdweinbergmath is a splendid one to beholdweinbergmath is a splendid one to beholdweinbergmath is a splendid one to behold
Vex/Arduino Serial Port Help

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
  #2   Spotlight this post!  
Unread 05-30-2008, 05:54 PM
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,345
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Vex/Arduino Serial Port Help

Quote:
Originally Posted by weinbergmath View Post
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'.
Wow Evan, sounds like you are doing what I plan on doing this summer. (I know this is somewhat obsolete considering the new controller we will have in 2009, but I still like the challenge and the learning it provides.)

I think your communication problem stems from your wiring. If you are sending the "k" from the Vex to the Arduino, then you output on the Vex should be Tx, and your input on the Arduino should be Rx. It looks like you have the two backward.

I would love to see your Sketches for the Arduino. It would save me a ton of time. Either way, I'll figure it out. I also plan on adding a gyro input to the Arduino and sending the encoders and rotation orientation to the Vex via serial stream.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #3   Spotlight this post!  
Unread 05-30-2008, 08:43 PM
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,379
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Vex/Arduino Serial Port Help

I've had good luck connecting things to the serial ports. As noted above you need to take the VEX TX and put it to the other device RX.

I have a breakout box that puts an LED on the line and at low baud rates I can see the LED flicker as the characters go by.

When looking for characters from the Arduino (TX) port to the VEX input (RX) port check the USART status buffer. It will tell you if you got frame errors (bitrates wrong).

Good luck,
Foster
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming the vex microcontroller to respond to commands on the serial port crashoverride02 Programming 1 10-20-2006 02:17 PM
Serial Port Help? StargateFan Programming 12 07-05-2006 02:06 PM
Programming Vex Starter Kit To Recieve From Serial Port firetrap FIRST Tech Challenge 0 09-26-2005 05:27 PM
TTL port to a serial port on a demo board ImmortalAres Programming 16 07-09-2005 11:44 PM
USB to 9-pin serial port (HELP!!) n00b Technical Discussion 10 02-01-2004 09:25 PM


All times are GMT -5. The time now is 08:11 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi