FT232RL Receiving data from RxD

Status
Not open for further replies.

marecki

Newbie level 1
Joined
Feb 6, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,291
Hello,
I want to receive and read data from pin RxD in FT232RL device. To get that I connect line TxD and RxD. In that situation on RxD I should get that what I transmitted from TxD. I send a simple frame of 8 bit data. The transmission works because LED-s connected to the CBUS0 and CBUS1 turn on. Turning on the LED connected to the CBUS1 line means that data frame was given to the input but not necessarily received and written in buffer.
And here is my question. How to successfully receive data frame and how buffer in FT232RL works? Is it working independently from executed code and stores the data frame when it is detected on RxD? Perhaps I should start some function from library D2XX to permit reading? Functions that were called: FT_Open, FT_SetBaudRate, FT_SetDataCharacteristics, FT_Write, FT_GetStatus, FT_Read, FT_Close.
My code:
Code:
void Write (void)
{
	FT_STATUS ftStatus = 2;
	DWORD BytesWritten;
	char TxBuffer[1] = {0}; // Contains data to write to device
	int to_send = 16;			// Data to send
	TxBuffer[0] = (char) to_send;
 
 
	DWORD EventDWord;
	DWORD TxBytes;
	DWORD RxBytes;
	DWORD BytesReceived;
	char RxBuffer[1] = {0};
 
 
	// Sending data frame
	ftStatus = FT_Write(ftHandle, TxBuffer, sizeof(TxBuffer), &BytesWritten);
	if (ftStatus == FT_OK)
	{
		cout << "Data transmitted" << endl;
	}
	else
	{

	}
 
 
	FT_GetStatus(ftHandle,&RxBytes,&TxBytes,&EventDWord);
	if (ftStatus == FT_OK)
	{
		cout << "Status device readed" << endl;
	}
 
	//if (RxBytes > 0)
	//{
		ftStatus = FT_Read(ftHandle,RxBuffer,RxBytes,&BytesReceived);
		if (ftStatus == FT_OK)
		{
			cout << "Data readed" << endl;
			for (unsigned int i = 0; i<300; i++)
			{
				cout << "containing of buffor ==> " << i << "     "<< (int) RxBuffer[i] << endl;
			}
		}
		else
		{

		}
	//}
	getchar();
	getchar();
}
Sorry for my english
 

I was working with FT245rl recently. The FT232rl you have is a usb to serial converter.It gets data from usb
and converts to serial.Then it can transmit with TxD connected to RxD of something else, like a microcontroller.
The RxD is the receiver so it can be connected to TxD of a pic for example.
With this connection you can't program a microcontroller.You need to program the chip you connect to FT or only send data ???


Perhaps I should start some function from library D2XX to permit reading? Functions that were called: FT_Open, FT_SetBaudRate, FT_SetDataCharacteristics, FT_Write, FT_GetStatus, FT_Read, FT_Close.

I don't think you can do that.For receiving data to Ft you need to have a program in the chip where is connected
that transmits data to FT.
So where is your FT connected??
You need a code like that in the other chip

Code:
unsigned char PortVal;

void main(void){
     //TX micro
     ADCON1 = 7; //Disable comparators
     TRISA = 0x3F; //inputs
     TRISC.F6 = 0; //TX output pin
     TRISC.F7 = 1; //RX input pin

     USART_Init(9600); //Initialize USART module at 9600bps
     do{
        PortVal = PORTA; //Read value off PORTA
        USART_Write(PortVal); //Send PORTA value through USART to Rx micro
        delay_ms(200); //Wait 200ms before sending next value
     }while(1);
     
}

And then you receive the data to FT through Rxd.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…