Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading and writing to FTDI chip with VISA

Hello all,

 

I've been scouring the web and the NI forum for the past couple days trying to find a solution for my problem but nothing yet.

 

I have a PIC18 micro with its UART connected to an FTDI chip which is plugged into my PC via USB. I'm trying to use labview to do some very basic reading and writing but I can't seem to get it to work. It will write data out to the chip just fine; but it wont read anything coming back. In fact it tells me that there are 0 bytes in the buffer. I've tried all of the built in labview example and none of them seem to work. I also tried the examples on the FTDI site and they don't work either. I am using DTR flow control.

 

I have a logic analyzer reading the tx/rx lines coming out of the PIC and they are as expected.

 

I can't get it to work in MAX either.

 

Does anyone have any ideas of what's going on?

 

 

 

I also noticed that even though I use some 'wait' blocks between writes, when I use my logic analyzer the waits don't happen, all the transmitted bytes are right after each other...I even bumped up the waits between each write to 5 whole seconds to see if it had anything to do with a delay getting on the bus.

 

Thanks for your help,

 

Jason

0 Kudos
Message 1 of 13
(5,967 Views)
What ftdi driver are you using? Does the connection show as a comm port in MAX? What sort of commands are you trying to send to the micro? Are you sure they are correct and properly terminated? Can you communicate with another program such as hyperterminal? Are you using the correct type of cable?
0 Kudos
Message 2 of 13
(5,956 Views)

I am using the most current driver that is available on the FTDI website. Yes my connection does show up as a COM port in MAX. I am sending simple characters; q, t, Q, etc. I have many other programs that talk to the micro just fine; I have some c# code that useing SerialPort commands to talk to the micro; I have a bootloader from Microchip that has a terminal built in that works just fine; I have TCL code that communicates just fine. My cableing should all be correct.

 

I can get labview to transmit, but it doesn't see anything as available on the read port. 

 

And I'm still curious why those 500ms delays between reads and writes don't seem to do anything.

 

I'm probing the tx/rx lines with a logic analyzer between the micro and the ftdi chip.

0 Kudos
Message 3 of 13
(5,921 Views)
Since other programs work, I suspect it's just that you are not appending a termination character. Attach an image of the block diagram and front panel please. Make sure to show typical data and show the display mode of the string control (i.e. normal, hex, \ codes).

The waits not executing could be explained if you are using the Delay function and the error wires.
0 Kudos
Message 4 of 13
(5,919 Views)

I'm using the basic serial write and read vi. Here is the lock diagram, the front panel, and captures of what occurs on the logic analyzer.

 

I've also attached what I expect as the result from another terminal application

 

 

Download All
0 Kudos
Message 5 of 13
(5,915 Views)

the remaining attachments

Download All
0 Kudos
Message 6 of 13
(5,914 Views)
You aren't sending any termination character at all. Does the micro expect a carriage return or line feed? The shipping example is set for \ Codes Display so type a \r for a carriage return or \n for a line feed. Most terminal emulation programs do this for you.
0 Kudos
Message 7 of 13
(5,897 Views)

No it does not require any termination. As you can see in the logic captures the micro is returning the expected information. 

0 Kudos
Message 8 of 13
(5,891 Views)
Then why have you set the VISA Read to expect one?
0 Kudos
Message 9 of 13
(5,875 Views)

I don't see where I have it set to do that. If I add terminatation charicater enable and set it to false it still behaves the same.

 

And again if you look at the logic capture you can see that the micro sends back both a \r and a \n so that should be hindering the read function correct?

0 Kudos
Message 10 of 13
(5,866 Views)