08-18-2011 12:12 PM
Hello,
I have a USB to Serial connection with my microcontroller (MCU) and I'm trying to communicate with it using LabVIEW. I have gone as far as seeing my COM port in MAX (it appears as COM 5) as well as in LabVIEW.
Problem:
1. Using the example Basic Serial Write and Read.vi, I dont get any ny response from the mcu (Motorolla M68HC12). Im only transmitting 4 bytes to test a connection between LV and the mcu. The example runs for a few seconds and stops with no error message, and the front panel shows 0 bytes read.
2. Using the VISA Test Panels in MAX: I get Error BFFF0015 on viRead. I researched this error and the following knowledgebase stated that; For VISA Read operations, this error may be induced by attempting to read more bits than are available at the serial port. Since LV displays zero bytes read, I'm assuming thats the reason behind this error.
Question: Am I doing something wrong? e.g. commands in LV need to be written a certain way or am I missing a step in communicating with the mcu? Any ideas/assistance will be appreciated.
Solved! Go to Solution.
08-18-2011 12:40 PM
This is a common error and more often than not, is a problem with your VISA Write, the serial port configuration, or the type of cable used.
Of course you need to write the command correctly for LabVIEW, just like you need to write it correctly for every programming language. You don't mention exactly what you are sending and what you expect to read. I would also recomend you try a standard terminal emulation program such as Hyperterminal, ProComm, TerraTerm, etc.
08-18-2011 02:26 PM - edited 08-18-2011 02:31 PM
Thanks for the information. I figured out a significant part of the problem. The characters i'm sending are in Hex, but MAX Test Panels interprates them as ASCII. I verified this in my MCU program. The following Knowledgebase showed me how to send Hexadecimal characters in the VISA Test Panels. And matching the return count in the viRead tab also helped in MAX. I believe I can now send and receive data in MAX.
Problem:
The LabVIEW example is still a dud. Highlight execution shows all is OK. Im sending the following characters: Hex: 03 FD B5 B5 or as the knowledgebase describes: \x03\xFD\xB5\xB5 (which works in MAX).
Any ideas will be appreciated.
Thanks.
08-18-2011 02:34 PM
How are you actually sending the characters? I hope you are not entering that \x string? There is nothing in LabVIEW that is going to interpret \x correctly. There have been countless posts on sending hex in LabVIEW. The easiest way is to simply right click on the string control/constant and select 'Hex Display' and simply type 03 FD B5 B5.
08-18-2011 02:41 PM
That worked. Thanks 🙂
08-18-2011 02:43 PM
(Hex display)
11-22-2011 01:45 PM
Hello there, I'm now working with a project that is using USB serial. kinda similar to the topic discussed here. Yet i don't get the solution and still getting this error of:
BFFF0015:
VI_ERROR_TMO
Timeout expired before operation completed.
I'm sending ASCII data. Any help would be much appreciated! Thanks in advance.
11-23-2011 09:43 AM
Hey kawthar,
Have you tried verifying communication in Measurement and Automation Explorer or going through the troubleshooting steps listed in the first knowledge based article mentioned in this thread? The time out error can occur for a couple different reasons. Increasing the time out or adding a wait after your VISA write might work to get your communication line functioning properly. These processes are detailed in the above mentioned article.
Were you able to communicate with your device previously or is this your first communication line to it?
Luke W
11-23-2011 09:58 AM
11-23-2011 10:22 AM
You are correct, there is not currently a driver for this manufacturer. Do you have the driver installed from the Silicon Labs website for your device?
I think this might be it: http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
It sounds like this may be necessary to have it recognized as a com port. If you recently installed a toolkit or newer version of LabVIEW (after the initial installation of this driver), you should try re-installing this driver
If you have this driver already, have you verified the commands and that they are in proper format/syntax?
Luke W