Author Topic: Axon baud problem  (Read 5049 times)

0 Members and 1 Guest are viewing this topic.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Axon baud problem
« on: July 26, 2008, 03:00:13 PM »
General Axon question: I'm testing sending output to hyperterminal via UART2 via my usb to serial adapter.  Should I be getting clear output (i.e. be able to read the initializing statement), or is it more likely that I'll get gibberish output.  I'm experiencing the latter, and pretty sure I have the baud set everywhere correctly.
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #1 on: July 26, 2008, 04:10:33 PM »
Giberish means your baud is set wrong.

Here is your checklist, basically 3 places to set it:

hyperterminal
hardware settings in system devices
axon software

edit:
Quote
output to hyperterminal via UART2 via my usb to serial adapter
wait . . . why?! uart1 offers a USB output already . . . and uart2 is a serial output . . .
« Last Edit: July 26, 2008, 04:28:56 PM by Admin »

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: Axon baud problem
« Reply #2 on: July 26, 2008, 07:16:39 PM »
maybe he wants to use both uarts, or he's just testing his adapter.
make sure the adapter has the correct settings on the driver page (hardware / device manager)
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #3 on: July 28, 2008, 05:12:00 AM »
Because I'm testing whatever I can... since as you know, I'm still not getting useful data sent to my servo controller...  I know my adapter works fine.

I get gibberish if I have the correct baud. Absolutely nothing appears if I have mismatched bauds.
I

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
Re: Axon baud problem
« Reply #4 on: July 28, 2008, 07:49:45 AM »
you sure you have the same flow control options at either end?

dunk.

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Axon baud problem
« Reply #5 on: July 28, 2008, 10:57:26 PM »
hardware settings in system devices
This step has no effect on the serial communication.  Baud settings of the port under the device manager don't get used when another program (e.g. hyperterm) is opening the serial connection.  All you need to do is set hyperterm (or whatever terminal program you are using) to the desired baud and open the connection.  If the microcontroller is configured to use that same baud, the two will be able to communicate.

- Ben

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: Axon baud problem
« Reply #6 on: July 29, 2008, 12:11:25 AM »
I doubt it. How does the converter know what baud rate to expect from the microcontroller? An open com connection provides no mechanism of conveying this information to a driver. I believe that hardware page sets this value.
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline bens

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 332
  • Helpful? 3
Re: Axon baud problem
« Reply #7 on: July 29, 2008, 01:44:13 AM »
It gets the information from the program that opens the port.  The hardware configuration in the device manager is irrelevant.  I can say this for certain about the CP2102, which I believe is the same USB-to-UART bridge used on the Axon.

For example, I just connected an Orangutan USB Programmer (a device that uses a CP2102 USB-to-UART bridge) to my computer, opened the device manager, and noted that the properties for the device (which happens to be on COM7) have it configured for 9600 baud.  I then opened hyperterm and connected to COM7 at 115.2k baud, at which point I was able to communicate with the on-board mega168, which is preconfigured to communicate at 115.2k baud.

As an additional point of reference, I am able to do the same thing by writing a custom C# application that communicates over a virtual serial port (and this C# program can use a buad that is not the same as the one listed under the device manager's port properties).  The only serial port setting under the device manager that matters (or at least has ever mattered in anything I've done thus far) is the number of the COM port.  In my experiences, the baud is determined by the particular software that opens the port, but you should be able to easily test this for yourself.

- Ben

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: Axon baud problem
« Reply #8 on: July 29, 2008, 10:54:04 AM »
That's interesting, I always assumed the hardware page sends this settings to the converter. I'll do some tests, I don't have an USB/UART converter handy.
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #9 on: July 30, 2008, 11:55:10 AM »
I'm having no success with all manner of baud rates.

I tested with this piece of code on the axon:
Code: [Select]
       LED_on();
uartSetBaudRate(2, 115200);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello1");
uartSetBaudRate(2, 57600);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello2");
uartSetBaudRate(2, 38400);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello3");
uartSetBaudRate(2, 19200);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello4");
uartSetBaudRate(2, 9600);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello5");
uartSetBaudRate(2, 4800);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello6");
uartSetBaudRate(2, 2400);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello7");
uartSetBaudRate(2, 110);
delay_ms(500);
rprintfInit(uart2SendByte);
delay_ms(500);
rprintf("Hello8");
        light_off();

I then toggled the baud rate through that range in hypertrm every couple of power ons to see what output I'd get.  UART1 works fine, of course....
« Last Edit: July 30, 2008, 12:02:15 PM by Gertlex »
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #10 on: July 30, 2008, 12:05:56 PM »
Hmmmm so the uart 1 (USB) works fine. This means hyperterminal and the Axon are working . . .

Quote
output to hyperterminal via UART2 via my usb to serial adapter
I suspect your adapter is causing the problem . . . what adapter are you using? Do you have something else to test the adaptor with, like the $50 Robot?

Hook up the adaptor to your PC, but not to the Axon. Cross tx and rx. See if hyperterminal can send data to itself (just see if it repeats what you type).

Your code looks correct to me . . .
Code: [Select]
rprintfInit(uart2SendByte);//select uart2
uartSetBaudRate(2, 38400);//select baud
rprintf("Hello2");//say hello


edit: Admin said something dumb, like confusing uart 1 and 2 . . . so I reworded this post.
« Last Edit: July 30, 2008, 05:58:26 PM by Admin »

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: Axon baud problem
« Reply #11 on: July 30, 2008, 02:39:55 PM »
if you are using several adapters, make sure they all use the same voltage spec: TTL or RS232.
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #12 on: July 30, 2008, 08:54:04 PM »
Ok... the setup:

Provided USB cable from laptop's USB port to UART1.

USB to Serial Adapter from laptop's USB to a nullmodem adapter to a surface mount male D9 connector (this gives me pins that I can connect to easily).  Then Pin 5 to UART2 ground, Pin 3 (RX) to UART2 TX.

I would classify the usb-serial adapter as RS232... which also qualifies as serial

Two instances of Hyperterminal open, one for UART1, the other for UART2.

....

And how would I directly wire UART2 to my computer with the included cable?  o_O

Is using UART1 for serial as simple as cutting open another cable with a USB Mini-B connector and splicing wires?  I kinda doubt it... (But I do have multiple wires of this type)

I almost think you have UART2 and UART1 confused.

...

Does the Axon's UARTs use TTL?  Is there such a thing as a TTL to RS232 adapter? (stupid question, when I can google it...; answer is yes.)  Something like this?: http://www.scienceprog.com/simple-ttl-to-rs232-adapter/

And TTL doesn't qualify as serial, does it?
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #13 on: July 30, 2008, 09:25:29 PM »
the specs on your adaptor:
http://sewelldirect.com/usbtoserial_specs.asp
Quote
Supports RS232 serial interface


Quote
USB to Serial Adapter from laptop's USB to a nullmodem adapter to a surface mount male D9 connector (this gives me pins that I can connect to easily).  Then Pin 5 to UART2 ground, Pin 3 (RX) to UART2 TX.

Found your problem . . .
USB=>adaptor=>RS232=> missing adaptor! => serial TTL

Basically, you have a USB to RS232 adaptor, but RS232 isn't compatible with the TTL for UART. You either need a USB to TTL adaptor, or a RS232 to TTL adaptor (like the max232).

I think that answers all your other questions, too :P

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #14 on: July 30, 2008, 09:27:22 PM »
I'm glad I wandered off on this tangent of testing.  I ultimately revealed my key misunderstanding by doing so!

Now to order such an adapter, or the necessary components.  Probably before I go to sleep ;)

Thanks.

EDIT: Can I get a verification that the item below will do the job?
http://alldav.com/index.php?main_page=product_info&cPath=9&products_id=11
And would I need to provide power to VCC?
« Last Edit: July 30, 2008, 09:33:02 PM by Gertlex »
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #15 on: July 30, 2008, 09:52:01 PM »
I don't have a datasheet on your alldav part, but it appears you need to apply 5V/Gnd to it from the Axon. It will do the job.

I have this in combination with my USB to RS232 adaptor:
http://www.sparkfun.com/commerce/product_info.php?products_id=133
It comes with wires which could make it easier for you . . . but my wires dry rotted within a year (I know, like wtf?! :P)

I also use my wireless bluetooth for TTL to USB communication.

Or direct USB to TTL (but you also need to buy a cable for it):
http://www.sparkfun.com/commerce/product_info.php?products_id=199
http://www.sparkfun.com/commerce/product_info.php?products_id=718
I use the CP2102 and CP2103 often, too.
« Last Edit: July 30, 2008, 09:56:36 PM by Admin »

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #16 on: July 30, 2008, 10:02:18 PM »
Soldering wires isn't a problem for me, at least.

Also while I'm at it, where do you buy your servo style connectors and the pins for them? Or more importantly, perhaps... what are those connectors called? (Molex, maybe? but that seems to be a manufacturer and generically applied to a variety of connectors)

Having had a multitude of MP3 players over the years, and similar stuff, I have quite a few of the necessary cables already :)
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #18 on: July 30, 2008, 10:23:58 PM »
;D
http://www.societyofrobots.com/electronics_wire_connector.shtml


I have this cute tendency to look at all the pictures you provide.  And then look at the text under a picture if I have questions x_x

(aka I've missed those links multiple times)
I

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #19 on: August 02, 2008, 04:57:47 PM »
I got the Serial-TTL adapter today.  And it works!

But it didn't work at first.  I hooked Axon UART2 TX to adapter RX, but that didn't work.  Then I noticed the arrows on the adapter; it's RX points away from the serial connector, while the TX points to the serial connector... Such suggested that maybe I needed to switch which wire went to where, and success! (aka TX to TX and RX to RX in this unconventional case)
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #20 on: August 02, 2008, 05:11:12 PM »
Great! When you get the code refined/commented, send it over and I'll add it to the Axon library.

Quote
TX to TX and RX to RX
Yea I hate it when they do this . . . I put current limiting resistors on the Axon to prevent people from frying the UART accidently.

Its really 'to-Tx to Tx' and 'to-Rx to Rx' ;D

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #21 on: August 02, 2008, 10:52:50 PM »
Great! When you get the code refined/commented, send it over and I'll add it to the Axon library.

Quote
TX to TX and RX to RX
Yea I hate it when they do this . . . I put current limiting resistors on the Axon to prevent people from frying the UART accidently.

Its really 'to-Tx to Tx' and 'to-Rx to Rx' ;D
Nah. I think it's really 'from-Tx to Tx' and 'to-Rx to Rx' :P

I'm not sure there's any brilliant software involved (haven't tested the MiniSSC yet), but I can state that I setup the wiring with the Vcc terminal on the adapter connected to the +3.3v pin.
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #22 on: August 03, 2008, 07:50:35 AM »
Quote
I setup the wiring with the Vcc terminal on the adapter connected to the +3.3v pin.
hmmmm well the uart is doing a 0 to 5V signal, so probably better you don't use the 3.3V for that. You might fry the USB if you aren't careful with the 3.3V line.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 744
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Axon baud problem
« Reply #23 on: August 03, 2008, 08:09:03 AM »
Fry which part? Something on the Axon, or on the adapter?  Certainly, the adapter has (3v-5.5v) printed on it.  Should I use one of the regulated 5v pins instead?
I

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon baud problem
« Reply #24 on: August 03, 2008, 08:32:10 AM »
Well, you are power it with 3.3V, but the UART sends it 0V and 5V signals.

I don't have a datasheet of your adaptor, but at some point something could be shorting 1.7V (5V-3.3V).

And the 3.3V power supply could be being sourced 1.7V (negative current).

Better to take power from the middle row of the ADC headers (regulated 5V) to be safe.

 


Get Your Ad Here

data_list