01-17-2011 10:13 PM
Hi,
We have code that is compiled for use in both 32-bit and 64-bit versions of a program. When running the 32-bit code there is no problem controlling the hardware. When running the 64-bit code the DAQmxErrorBufferTooSmallForString error message is returned in some of the calls to query for the device attributes. The device we are attempting to control is a USB-6259 and the OS is Win 7 x64.
I don't think that this problem is really that the buffer is too small since the same code works fine in the 32-bit version and the buffer is sufficiently large (8K) that there really shouldn't be any possibility for this error to occur.
Below is the complete list of calls that I am making through the NI-DAQmx API.
Best regards and I really hope that someone can figure this out,
Pete
00000000 0.00000000 [840] DAQmxGetSystemInfoAttribute(DAQmx_Sys_DevNames, ["Dev1"]) = DAQmxSuccess
00000001 0.00035768 [840] DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_AI_PhysicalChans, [""]) = DAQmxErrorBufferTooSmallForString
00000002 0.00057210 [840] DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_AO_PhysicalChans, ["Dev1/ao0, Dev1/ao1, Dev1/ao2, Dev1/ao3"]) = DAQmxSuccess
00000003 0.00085378 [840] DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_DO_Lines, ["Dev1/port0/line0, Dev1/port0/line1, Dev1/port0/line2, Dev1/port0/line3, Dev1/port0/line4, Dev1/port0/line5, Dev1/port0/line6, Dev1/port0/line7, Dev1/port0/line8, Dev1/port0/line9, Dev1/port0/line10, Dev1/port0/line11, Dev1/port0/line12, Dev1/port0/line13, Dev1/port0/line14, Dev1/port0/line15, Dev1/port0/line16, Dev1/port0/line17, Dev1/port0/line18, Dev1/port0/line19, Dev1/port0/line20, Dev1/port0/line21, Dev1/port0/line22, Dev1/port0/line23, Dev1/port0/line24, Dev1/port0/line25, Dev1/port0/line26, Dev1/port0/line27, Dev1/port0/line28, Dev1/port0/line29, Dev1/port0/line30, Dev1/port0/line31, Dev1/port1/line0, Dev1/port1/line1, Dev1/port1/line2, Dev1/port1/line3, Dev1/port1/line4, Dev1/port1/line5, Dev1/port1/line6, Dev1/port1/line7, Dev1/port2/line0, Dev1/port2/line1, Dev1/port2/line2, Dev1/port2/line3, Dev1/port2/line4, Dev1/port2/line5, Dev1/port2/line6, Dev1/port2/line7"]) = DAQmxSuccess
00000004 0.00127711 [840] DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_DI_Lines, [""]) = DAQmxErrorBufferTooSmallForString
00000005 0.00146339 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000006 0.00207268 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line0", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000007 0.00613461 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000008 0.00698645 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000009 0.00708250 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000010 0.00732182 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000011 0.00746703 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000012 0.00789165 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line1", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000013 0.01199886 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000014 0.01285717 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000015 0.01294804 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000016 0.01316892 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000017 0.01331025 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000018 0.01373423 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line2", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000019 0.01762249 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000020 0.01873176 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000021 0.01882231 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000022 0.01903738 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000023 0.01917611 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000024 0.01959945 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line3", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000025 0.02349773 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000026 0.02448152 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000027 0.02457175 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000028 0.02478552 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000029 0.02492394 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000030 0.02534889 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line4", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000031 0.02987134 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000032 0.03087227 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000033 0.03099192 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000034 0.03121378 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000035 0.03135737 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000036 0.03180528 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line5", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000037 0.03584716 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000038 0.03670255 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000039 0.03679440 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000040 0.03701011 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000041 0.03715014 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000042 0.03757671 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line6", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000043 0.04146950 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000044 0.04232716 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000045 0.04241771 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000046 0.04263245 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
00000047 0.04277249 [840] DAQmxCreateTask("", ["0000000008D0C320"]) = DAQmxSuccess
00000048 0.04319808 [840] DAQmxCreateDOChan(0000000008D0C320, "Dev1/port1/line7", NULL, DAQmx_Val_ChanForAllLines) = DAQmxSuccess
00000049 0.04713130 [840] DAQmxStartTask(0000000008D0C320) = DAQmxSuccess
00000050 0.04820370 [840] DAQmxWriteDigitalScalarU32(0000000008D0C320, 1, 0, 0, 0000000000000000) = DAQmxSuccess
00000051 0.04829489 [840] DAQmxStopTask(0000000008D0C320) = DAQmxSuccess
00000052 0.04851254 [840] DAQmxClearTask(0000000008D0C320) = DAQmxSuccess
01-25-2011 03:24 PM
Hi Pete,
It is very interesting the fact that your program only errors out when you run it on Win7 x64. As of the function that you are using, the prototype for it is the following:
int32 DAQmxGetDeviceAttribute (const char deviceName[], int32 attribute, void *value, ...);
According to the NI LabWindows CVI Help, you must determine the buffer size needed to allocate the device attributes. If the attribute you pass is a char* or float64*, this parameter is the size of the buffer you pass in. If you pass 0 for this parameter, the function returns the size of the buffer needed to allocate. It might be worthwhile to pass this parameter so that we can find what buffer size is it expecting. It might even be useful if you try to run this program on another Win 7 x64 machine, for the sake of testing.
02-09-2011 07:18 PM
Hi Efrain,
It is interesting that the errors only occur on Win7 x64!!! I've changed my code so that it now queries for the buffer size. Here it what happens now:
DAQmxGetSystemInfoAttribute(DAQmx_Sys_DevNames, NULL) = 5
DAQmxGetSystemInfoAttribute(DAQmx_Sys_DevNames, ["Dev1"]) = DAQmxSuccess
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_AI_PhysicalChans, NULL) = 341
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_AI_PhysicalChans, [""]) = DAQmxErrorBufferTooSmallForString
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_AO_PhysicalChans, NULL) = 39
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_AO_PhysicalChans, [""]) = DAQmxErrorBufferTooSmallForString
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_DO_Lines, NULL) = 885
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_DO_Lines, [""]) = DAQmxErrorBufferTooSmallForString
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_DI_Lines, NULL) = 885
DAQmxGetDeviceAttribute("Dev1", DAQmx_Dev_DI_Lines, [""]) = DAQmxErrorBufferTooSmallForString
From the buffer sizes it looks like the data is available. We have seen the problem on multiple computers. I am at a loss why no one else has reported this problem. Maybe its an issue with the particular model ("NI-USB 6259") on this particular platform?
As a side note, before I changed my code to query for the buffer size, the call to DAQmxGetSystemInfoAttribute(DAQmx_Sys_DevNames, buffer) would return the buffer size when I passed in a non-null buffer parameter value.
Best regards,
Pete
02-11-2011 11:10 AM - edited 02-11-2011 11:11 AM
Hi Pete,
Thank you for the information. It looks like you have suitable buffer sizes from the test you ran. Can you tell me which version of DAQmx do you have installed? We only added Windows 7 64 bit support until we realeased DAQmx 9.0.2.
02-11-2011 01:48 PM
Hi Efrain,
I'm using 9.2.2 and I've tried 9.2.3 and I see the same problem there as well.
Best regards,
Pete
02-24-2011 11:13 AM
FYI: I have just discovered that if I query using DAQmxGetDeviceAttribute() immediately after it just returned the DAQmxErrorBufferTooSmallForString error then the it succeeds and I have my string.