First of all, thanks for reading this!
I am building a stand-alone data acquisition system using a cRIO 9074 to acquire data from 50 sensors at 5 KHz. I am ONLY using the FPGA chip and no RT controller because the SD card module 9802 write quickest when implemented in this way.
The problem is I am getting a timing violation error and I am not sure what the cause is. I have attached the simple VI below which only has 1 sensor in it. Any suggestion are very welcome!
From previous forum post/support documents there are a few ways I can fix this:
Reduce data type - reducing the data type from I32 to I16 makes it work but then the clock cannot count one complete cycle, so I32 would be preferable.
Pipelining - It seems that I could use pipelining but I'm not sure how to implement it with this VI. Can anyone explain how to pipeline this VI?
I understand that I could use a producer-consumer loops to transfer the data and I have been advised to do this. However, I am not sure what it will acheive or whether this will help with the timing violation. The writing rate to the SD card is a maximum of 2MB/s and I am planning to use 25% of that so I do not feel it is needed. Any advise on this will be very appricated as well.
Thank in advance!
Can you attach .lvproj file as well, which will show how you configured the FPGA target? Are you using the default top-level clock (40Mhz) or a faster derived clock?
To pipeline this VI you would put the SD card write in parallel with the AI read. That is, read from the AI, store the output in a shift register, then write it to the file on the next loop iteration while you are reading a new AI value. I don't think producer-consumer will help you on FPGA. You can try putting the AI read and the file write in separate loops and using a FIFO to transfer the data but I'd be surprised if that fixes it. I'm not clear why you cannot use a 16-bit integer. Use an unsigned value and you'll be able to count to 50,000. Since the raw data is the same whether you use signed or unsigned values you should be able to mix the two in the array and still interpret it properly when you read the file later, assuming that the file is being saved as binary - I haven't used the SD Card Write function so I don't know how it works.