analogdevicesinc / libm2k

A C++ library (bindings for Python and C#) for interfacing with the ADALM2000
http://analogdevicesinc.github.io/libm2k
GNU Lesser General Public License v2.1
34 stars 32 forks source link

How to set sampling frequencies <100k? #342

Closed Modiug closed 9 months ago

Modiug commented 1 year ago

I entered the same issue in gr-m2k. I guess this applies to libm2k as well?

When I set a "Sampling frequency" of 10k, I get this: "RuntimeError: ERR: Runtime - Device: Cannot set the number of kernel buffers"

I tried different "Buffer sizes" and "Kernel buffers", but to no avail. I was able to set "Sampling freqency" to 100k and "Oversampling ratio" to 8, which gives an effective sample rate of 12.5k. But using an "Oversampling ratio" of 10 again leads to the above error message.

Could somebody point out the limits and relationsships between "Sampling frequency", "Buffer size" and "Kernel buffers"?

NanoExplorer commented 10 months ago

I think that this is more of a gnuradio issue than a libm2k issue, since I can set these values just fine with the python bindings of libm2k.

m2k = libm2k.m2kOpen()
ain = m2k.getAnalogIn()
ain.setKernelBuffersCount(10)
ain.enableChannel(0,True)
ain.enableChannel(1,True)
ain.setSampleRate(100000)
ain.setOversamplingRatio(10)

All of these run just fine for me, again on Python. It would help the folks over at gr-m2k if you shared your code (or a screenshot of the settings dialog in gnuradio) so that they might be able to reproduce the issue...

I take it you've already tried the settings listed here: https://wiki.analog.com/university/tools/m2k/libm2k/gr-m2k and only changing the sampling frequency?

Modiug commented 10 months ago

I can confirm that your code snippet works for me. However GNU Radio Companion from radioconda-2023.11.06-Windows-x86_64 has still the same issue. I'll leave a comment with the gr-m2k team.

adisuciu commented 10 months ago

This will be fixed in the latest version of libm2k. We're preparing a release asap.

Modiug commented 10 months ago

Oh, ok. I understood from @NanoExplorer it could not be reproduced in libm2k directly. Anyway, thanks a lot!

AlexandraTrifan commented 9 months ago

The latest libm2k release v0.8.0 was published. https://github.com/analogdevicesinc/libm2k/releases/tag/v0.8.0 This release fixes the above mentioned issue.