Go Down

Topic: UART/ TX Question (Read 593 times) previous topic - next topic

miladnkw

Hi folks :)

Bellow is a simple code which I am using to send 3 bytes of data as following

byte 0 :0x7B (this value is a hexadecimal)
byte 1: 0xCC
byte 2: 0x9C

Code: [Select]

byte array_Buff [3]  ;
int i;

// SETUP *************************************************************************
void setup()
{
  Serial.begin(9600);      // start serial communication at 9600bps
 // pinMode(a_Out, OUTPUT);
 // Serial1.begin(9600);     // start serial1 communication at 9600bps
 i=0;
} // End Setup


// LOOP *************************************************************************
void loop()
{
array_Buff [0]= B01111011;
array_Buff [1]= 0xCC;
array_Buff [2]= 0x9C;

while(i<1) {
 Serial.write(array_Buff ,3 );
 i++;
}

}  // End Loop.


My question is that,

does the arduino pulls down the TX by itself in order to let the other device know it is sending information? If not? How could I signal the beginning of data transfer ?


Thank You,

Budvar10

#1
Mar 20, 2017, 08:22 am Last Edit: Mar 21, 2017, 08:15 am by Budvar10
No, it doesn't. The Rx and Tx are independent. The Tx waits for incoming data (interrupt routine) while the Rx is sending. You can use another pin for signalling the beginning of data transfer. e.g DTR signal.
 
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

Robin2

No, it doesn't. The Rx and Tx are independent. The Tx waits for incoming data (interrupt routine) while the Rx is sending. You can use another pin for signalling the beginning of data transfer. e.g DTR signal.
I suspect you have that back to front :)

And I am not sure that the initial "No" is correct either


does the arduino pulls down the TX by itself in order to let the other device know it is sending information? If not? How could I signal the beginning of data transfer ?
In Serial communication the TX line is HIGH in the idle state. The start bit is, in effect, when that is pulled LOW by the TXing device

However I don't understand why you are asking this question. Normally "it just works" and there is no need to enquire about the inner workings. What are you trying to do that has given rise to your question?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

miladnkw

Hey Robin,
I believe you are right. My understanding is that the serial.Write() takes care of pulling down the TX line and initiating the transfer signal. As for what I am doing, I am trying to interface an Arduino with a FPGA so I need to count for the beginning signal on the receiver side (FPGA).

Robin2

#4
Mar 20, 2017, 02:29 pm Last Edit: Mar 20, 2017, 02:29 pm by Robin2
My understanding is that the serial.Write() takes care of pulling down the TX line and initiating the transfer signal. As for what I am doing, I am trying to interface an Arduino with a FPGA so I need to count for the beginning signal on the receiver side (FPGA).
I think you need to find a web page that describes the bit-sequence of a Serial byte. You can assume that the Arduino does it properly. The trick is to test the status of the line in the middle of each bit period having been alerted by the line going from HIGH to LOW at the beginning of the start bit.

The code in Yet Another Software Serial was written to receive (and transmit) serial data without using the USART. It may (or may not) help to illustrate the subject for you.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Budvar10

I suspect you have that back to front :)
:-* Shame on me! Please, ignore my post.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

Go Up