Jump to content
  • 0

How to correctly acquire data from multiple Raspberry Pi DAQ Hats without getting overrun errors


RPi4-IPC

Question

Hello everyone,

I am trying to acquire data from a Raspberry Pi 4 with the following  4 daqhats simultaneously:

  • 2 x MCC172 board
  • 1 x MCC128 board
  • 1 x MCC152 board

I can acquire data from each DAQ HAT  individually without an issue. However, I am having trouble reading all data of all boards simultaneously and combining them using python on the raspberry pi. I have also tried using multiple processes using the builtin multiprocessing module in Python3.

The code I am using is a combination of the continuous measurement scripts in the examples folder found on GitHub. The only change I have made, is to use the following settings for each board:

  • 2 x MCC172 boards: scan_rate 51200 & samples_per_channel 10240 (2 x channels used for each board)
  • 1 x MCC128 boards: scan_rate 12500 & samples_per_channel 12500 (8 SE x channels used for board)
  • 1 x MCC152 boards: 5 samples for each channel per second (10 DI x channels used for board)

 

The first gathering of data takes a couple of seconds and causes the Buffer Overrun to become true for the MCC172 boards (with 51.2 kHz). The delay in the first loop does not affect the data acquisition in the other boards.

 

Are there any examples on how to read data from multiple boards simultaneously in Python? Or has anyone had the same issue and could solve it?

Thanks in advance for any answers

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello,

It's not possible to read your four boards simultaneously. By simultaneously, I mean synchronous to a common clock. Just so you know – only the two MCC 172 in your stack of boards can be synchronized - see our Python example of using multiple boards. The option flags in this example are set to EXTTRIGGER. If you want to run continuously logically OR in the CONTINUOUS flag. In the function that reads the two MCC 172, you can make it so it read the other two boards too, but they'll be running at different speeds, and you're probably not going to be able to run the MCC 172 at full speed. Once you start getting data from all three boards, you will have to devise a scheme to blend it together. I know many programmers like the Python language, but I find it slow, and because it is not multi-thread capable less desirable. C may be a better choice based on your requirements.

Best regards,
John

 

Link to comment
Share on other sites

  • 0

Hey @JRys,

Thanks for the quick and helpful reply. Perhaps I used the wrong terminology there. By simultaneous data acquisition from all boards, I meant parallel data acquision from all boards and not exact synchronized data acquisition. Is it then correct for me to assume, that it is possible to acquire data from multiple different DAQ HATs in different processes or threads at the same time, and the code I am using at the moment is not optimized for what I want it to do and it is not a hardware limitation?

Best Regards

Link to comment
Share on other sites

  • 0

Yes, it should be possible. Start an acquisition on each board one after the other, then read each board one after the other over and over. This is what the multi_hat_sychronouous_scan example does.  The MCC 152 doesn't have a scan clock; it uses individual reads in a polling fashion and is slow compared to the other boards. You should leave it out for now and focus on controlling the two MCC 172 and the one MCC 128. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...