Discussion:
What is "error" 42 and what could cause collection to stop and start
(too old to reply)
mauricev
2008-06-26 23:40:07 UTC
Permalink
I am using Mac OS 10.4.11 on an Intel Mac Pro and NIDAQmxBase 3.1. I am trying to collect a single analog channel of 1024 points with I believe is a sampling rate of 25,000 with analog triggering on APFI0 of a BNC-2090 (extref connector).The collection proceeds for a while, then suddenly, DAQmxBaseStartTask stops, reporting error "42". Then after a while, it starts up again, only to fail after a few more traces, again with error 42. Then it just keeps repeating this process of stopping and starting.The error number 42 is not referenced anywhere and odd because they are ordinarily negative numbers of the form -200xxx. (I had other errors during debugging, so it is definitely capable of displaying legitimate error numbers.)This code also works fine compiled on a Mac G4 (PowerPC).
samantham
2008-06-30 13:10:07 UTC
Permalink
Hello,

I am interested to know what DAQ device your have connected to the BNC-2090 DAQ Accessory and to see a screenshot of the error message.  When the application is running on the MAC Pro is it an executable (.exe)?  Are you opening or creating any files in the application?  When running the application on the MAC Power PC are there any differences in the setup?

Here is another forum thread&nbsp;<a href="http://forums.ni.com/ni/board/message?board.id=170&amp;message.id=330591&amp;requireLogin=False" target="_blank">post</a> where error 42 was an issue.

Please summarize the DAQmxBase code or provide a screenshot of the block diagram.&nbsp; If error 42 is coming from the DAQmxBaseStartTask.vi, are you looping this vi?&nbsp; Does the same error occur when using one of the examples that download with the driver for AI?&nbsp; For example, Cont Acq&amp;Graph Voltage-Int Clk-Analog Start.vi examples will run continuous and use analog triggering.
mauricev
2008-07-02 00:40:08 UTC
Permalink
I am using a 6251 card. My program is in C++. There is no Labview involved. Sorry, I should have mentioned that the PowerPC program is running on a G4 with an MIO-16E-4 card. The only difference other than that is the trigger is on a different channel, APFI0 for the 6251 card.I am indeed in a loop repeatedly calling DAQmxBaseStartTask. The error is reported by this call. Interestingly, when I collect 9999 point of one channel, it seems OK. But as soon as I switch to two channels, total 19998 points, I get error 42. The sampling rate is 25000.I have an old copy of Labview, 7.1, which I installed. I tried running the dynamic version of Acq&amp;Graph Voltage-Int Clk-Analog Start.vi and it complains with a completely different error, Error -200220 occurred at an unidentified location: Device identifier is invalid. It seems as if it can't find the card, but I don't see any obvious place to enter the value of 1. I'd imagine it would default to 1 anyway, unless, of course, this error mean something else.The error referenced in that other post doesn't seem to be at all related.
Tom W [DE]
2008-07-02 15:40:14 UTC
Permalink
Hi Maurice-
There are several possible causes for error 42 in DAQmx Base, but based on your description it sounds like you're running into&nbsp;a memory allocation error.&nbsp; In DAQmx Base, we internally allocate acquisition buffers for AI operations.&nbsp; There is a requirement imposed by DAQmx Base that the buffer be composed of a single contiguous block of memory due to the architecture of the DMA engine that we use to interface with the hardware.&nbsp;
This allocation occurs within DAQmx Base Start Task.&nbsp; So, if you repeatedly allocate and release it is possible that memory may become fragmented to some point that does not allow for further contiguous allocation operations.&nbsp; It seems an extreme case that 40kB of contiguous memory is not available (for your 20kSample buffer), but it is possible.&nbsp; The fact that it eventually begins working again seems to indicate that other processes might be releasing memory "chunks" that then become available to DAQmx Base.&nbsp; There is no way to avoid this limitation in DAQmx Base.
Is there a reason why you need to Start and Stop repeatedly in a loop?&nbsp; In the past, to overcome this long-term limitation of DAQmx Base, I have suggested using a continuous analog input operation and using post-processing on the data to determine when analog trigger conditions are met.&nbsp; This would require you to supply the analog signal of interest to another of the AI channels and then add that channel to your scanlist.
How many iterations are you able to run before the failure occurs?&nbsp; How much RAM is available in your PowerPC machine?&nbsp; Is there significantly more available in the Intel machine?&nbsp; FYI- the fact that one machine is using E Series and another using M Series should not make a difference in this case.Message Edited by Tom W [DE] on 07-02-2008 10:37 AM
mauricev
2008-07-02 22:40:08 UTC
Permalink
It seems you have the diagnosis correct. The Intel Mac currently just has 1 GB RAM where the G4 has way more. It's a bit ironic that you are asking if I'm starting and stopping the task in a loop. I'm actually creating the task, starting it, collecting data, stopping, clearing it all in a loop. And I'm also allocating other memory and destroying it there as well. All in the same loop.That actually seems to be how we are supposed to use the functions according to my reading of DAQmxBaseClearTask in the little documentation we have. It even says this will save memory!So I've reprogrammed it not to do any memory allocation/deallocation in the loop. It just starts, collects and stops in the loop. Ironically, now it's working the way you thought I had it to begin with. But it didn't help that much. What does help is to have nothing else running when I start. I suppose more memory will really help and we will be getting that soon. Now eventually I have to handle continuous collection without a trigger and I'm wondering how this works because the documentation is pretty scanty. I start the task, collect data and then what? Will the task keep on running and collecting? Would I just be repeatedly calling DAQmxBaseReadBinaryI16? Won't I lose data in between calls or does the card do double-buffering? I assume that it's a bug that the 42 error isn't documented in the NIDAQmxbase header file and I'm also guessing the full NIDAQ driver on Windows doesn't have this problem as you specifically mentioned it as a limitation of mxbase. I sure hope one of these days, we will see that version on the Mac!
Tom W [DE]
2008-07-07 14:10:14 UTC
Permalink
Hi Maurice-
If you set up the task for "continuous" sampling then you will indeed just need to call DAQmxBaseRead multiple times.&nbsp; The&nbsp;driver will perform double-buffering and you need to choose loop rates and an appropriate number of samples to read per DAQmxBaseRead (since it will block execution until the requested number of samples are available) to avoid data loss.&nbsp; However, if any data is overwritten or lost DAQmxBaseRead will report that error condition appropriately and will halt the acquisition.
Let me know if you have other questions.&nbsp; Thanks-

Loading...