Go Down

Topic: Serial port ARDUINO NANO (Read 1 time) previous topic - next topic

nas2b

Hi all !

Firstly excuse me for my bad english..

I have a little problem, i programmed my arduinio nano v3 with mini USB and my program work normaly but only when i use the USB connection ( integrated in the arduino, i have just to put my USB wire ). :)

My application is a compass who are connected at the arduino with i²c bus, and arduino give me 3 values like : "33 -66 34"; with usb connection i have no problem but with RS232 connection ( Tx, Rx and ground ) the response are like : x97\x00\xab\x2e\xac\x66\xga\xab....... =( ; And with RS232 connection i can't update my arduino

Tha data rate are corectly configured, flow control also.. :smiley-roll-sweat:

Do you know what is the problem ? :smiley-roll:

CrossRoads

If you are trying to connect RS232 to the RX/TX lines, you need to invert them.
RS232 use a High level to indicate nothing is going on, then a Low indicates a Start Bit has occured and data is starting.

The Aruino Rx/Tx lines use a Low level when nothing is going on, and Start Bit goes high.

So you need to invert the levels.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

nas2b

Thank you for your reply.

But RS232 have just 1 protocol ? no ? i knew a problem could be the high logic level TTL or 3.3v but arduino give a high level TTL and it's the first time i hear this problem...

So i will try it, do you know any components who can do it ?

thanks a lot !

retrolefty

Quote
The Aruino Rx/Tx lines use a Low level when nothing is going on, and Start Bit goes high.


I believe you have that backwards. TTL serial uses true logic, a data bit is true high and a stop bit is equal to a data bit high and a start bit is equal to a data bit low, so the idle condition ("nothing going on") on a serial link is at a continous high (stop condition) waiting for the next start bit low.

Lefty

CrossRoads

Lefty,
I'm gonna have to pull out myscope & check again.
Maybe the device I was talking to was putting out TTL serial (low = nothing happening) and I had to invert coming in to see good data. I had worked that out last August.
Robert
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

retrolefty


Lefty,
I'm gonna have to pull out myscope & check again.
Maybe the device I was talking to was putting out TTL serial (low = nothing happening) and I had to invert coming in to see good data. I had worked that out last August.
Robert


Yes, one can once and awhile come across something using non-standard inverted logic. But standard TTL is as I stated. Simple test with just a voltmeter on the txd pin after loading this simple sketch. You will see the output is almost always +5vdc on both the send and receive arduino pins, as it's only sending one character every two seconds.

Code: [Select]
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
*/

void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);
  Serial.begin(9600);
 
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);  // wait for a second
  Serial.println("?");
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}


Lefty

Go Up