Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Aspects error

I know I've posted this question before, but I still haven't found the answer.  So any help would be greatly appreciated.
 
I'm using the Visa Com library to communicate with a device via a com port.  I have a National Instruments Serial card (RS 485).  Everything works great, I can read and write to the COM port just fine.  But, when I turn off my device and then turn it back on again, and then try tro read from the port, I get an "Invalid Aspect(s)" exception, with the error code 0x8004006b.  This error persists until I manually reset my device.  I don't think the problem is the device, because when I check the number of bytes received before reading, it shows that the device has responded with the correct number of bytes.  But when I go to actually read those bytes, I get the "Invalid Aspects" error. 
 
Now, the strange thing is that when I put a breakpoint in the code and look at the IMessage object AFTER receiving the Invalid Aspects error, it shows the object as undefined or something (I've attached an image of this so you can see for yourself.) 
 
I've tried everything from dumping the buffers to creating a new IMessage session.  Nothing seems to help, except two things: 1) resetting the device manually, and 2) putting a 10 second wait before reading from the serial port.   Unfortunately, none of these solutions are acceptable for my project, because I cannot always be to reset the device manually, and I can't wait 10 seconds every time I read because I lose a lot of data that way.
 
So please, if anyone has ever dealt with this, or if you have any guesses as to what the problem may be, I'd be really greatful for some advice.
 
 
Oh, and does anyone know how to check the status of a serial session? I mean if I knew what's going on in the driver, or what what the status of the COM port is before and after reading from it, I might be able to figure out what causes the "Invalid Aspects" error.
 
Thanks,
 
Goharik
0 Kudos
Message 1 of 13
(5,234 Views)
Oops, forgot to attach the files.  Here they are.  The first one is my code, the second one is a screen-capture of the Watch window after receiving th "Invalid Aspects" error.
 
Thanks again,
goharik
Download All
0 Kudos
Message 2 of 13
(5,227 Views)
Hi goharik,

A few more things would be helpful in troubleshooting this.

1) Use a serial port monitor to take a capture of the data on the serial bus. This will help us know what the actual errors are you're getting on the bus.

http://www.hhdsoftware.com/sermon.html

2) Post a spy capture from NI-Spy so we can see what errors our drivers are seeing.

From that we should be able to see the problem a little easier.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 3 of 13
(5,213 Views)

Dear Matt,

I am attaching the NI-SPI log from my program (the upload tool didn't let me attach the .spy file, so I'm attaching the text version as well as an image of what the spy capture screen looked like).

It seems like the Invalid Aspects error is bing caused by something called a "framing error"....  Can you explain what that is?  Or why it could be happening?  As I said before, I get the "Invalid Aspects" error only when I power off my device and then power it on.  And the "Invalid Aspects" error message seems to correspond with the "A framing Error Occured" message that I saw in the NI-SPI log.

I haven't installed a serial monitor software yet, but I will do that soon, and post the results.

Thank you,

Goharik

Download All
0 Kudos
Message 4 of 13
(5,205 Views)
Hi Goharik,

Framing errors are generally caused by problems with baud rates, data bits, stop bits, etc... so the setup of the frames coming across the bus. Hopefully when you post the serial monitor results we can take a look and see what's causing the errors you're seeing. You may be getting half a frame at some point instead of getting a full frame, and this could possibly be causing the framing errors you're seeing.

Regards,
Matt S.

Message Edited by Matt_S. on 02-02-2006 05:00 PM


LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 5 of 13
(5,190 Views)
Hi Matt,
 
Well, here are the results from HHD Serial Monitor.  It looks like I'm getting an "84" from the UUT, and the Serial Monitor software has no trouble reading that byte.  But when VISA tries to read it , it throws a "Framing error" and "Invalid Aspects error".  Can you please help me figure out what's going on?  I've attached a screenshot of what the HHD sotware captured, but if you need a different view of the captured data, please tell me.
 
Goharik
Download All
0 Kudos
Message 6 of 13
(5,177 Views)
Hi Goharik,

We can't do a lot with just the screenshots from these programs. Try to zip the HDD file and the NI-Spy file and post the zip file. Then we can check some of the additional information these programs collect.

Also, one thing that can cause Framing errors when you unplug a device is incorrect 485 termination. Verify that your termination resistors have been put in correctly on both the device side and the PCI card side. Correcting this may resolve the problem you're seeing.

Hope this helps! If not, just post the zip file with both log files and we'll take a look at them.

Regards,
Matt S.

Message Edited by Matt_S. on 02-06-2006 05:42 PM


LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 7 of 13
(5,158 Views)

Dear Matt,

Here is the captured data from my program.  I only have a free version of the HHD Serial Port Monitor software, and it will not allow me to log data.  So I had to export the captured data to alternate formats.  I hope this will give you a good idea of what is happenning.  As you can see, the framing error only happens when I receive an "84" response from the device.   Now, since the serial monitor clearly has no problem reading from the Com3 port, I am starting to think that the problem might be with my setup of the VISA Serial Session.  Any ideas? 

 

Thanks,

goharik

0 Kudos
Message 8 of 13
(5,120 Views)
Ooops, forgot the files again.... 
0 Kudos
Message 9 of 13
(5,115 Views)
It seems kind of wierd that your device typically responds with one byte, but after you turn your device off you are reading 8 bytes. Is your device returning 8 bytes or should it be returning 8 bytes and is 0x84 a valid byte for your device to return. When the device boots up it may just send garbage out or it may be using a different baud rate until you reset it or wait for it to initialize.

It is also very possible that your device is in an uninitialized state and that is why you have to wait 10 seconds. Even if the Serial monitor returns the 8 bytes it is very possible that the serial monitor isn't checking for errors and it still brings up the question of is 8 bytes of 0x84 valid. In most cases VISA is just reporting what it sees.

I would question your device before questioning the VISA driver. Especially sense VISA shouldn't care how long you wait after restarting your device and VISA doesn't care if you reset your device, but it obviously would affect your device and possibly how it responds to commands.

You may not have the equipment, but I would be interested in seeing what your device does to the serial lines when it is restarted and to see what the actual bits looks like on the serial lines. I bet they are not what you expect.

This is just my opinion.

-Josh
0 Kudos
Message 10 of 13
(5,093 Views)