1

I measured that the SPI-Clock of my Arduino Nano in my project didn't reach near 5V. So I quickly tested with a new one, nothing attached except a (mydaq) scope.

I measured the SPI clock:
2.5 V @ 8 Mhz;
3.6 V @ 4 Mhz;
5 V @ 1 Mhz.

I think the graph looks like that because the low max sample of the mydaq, so I dont worry to much about that. The MISO could reach about 5V but why is the clock voltage lower at higher frequencies? And how to reach 5V?

enter image description here

#include <SPI.h>

void setup() {
  SPI.begin();
  SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
}

void loop() {
  SPI.transfer(1);
}

I also tried SPI mode 2 or 3 @8Mhz, idle state was 4,7 V but Vp-p again only 1,9 V.

3
  • 5
    It's not a lower voltage. You're just trying to measure it with something that is not capable of measuring it. To read a signal of 4MHz you need minimum 8Msps. For 8MHz you need minimum 16Msps. You cannot get the voltage with just a fraction of the samples you need to recover the waveform. Plus there will be a certain amount of low pass filtering happening massively reducing the frequencies this "mydaq" thing can read.
    – Majenko
    Jan 7 at 21:07
  • 1
    @Majenko I wondered why I can reach 5V at MOSI then? but now I transfered binary 1010 1010 @ 8Mhz and the MOSI line reading also "dropped". Thank you, that made a lot of sense actually :) Time for upgrade
    – aWiseMan
    Jan 7 at 21:49
  • You can use a peak detector to get an idea of the maximum voltage, and another one for the minimum, if you don't have a high enough sampling rate. Jan 7 at 22:33

2 Answers 2

2

This is the second time the Nyquist frequency has come up in the last couple of days.

In order to accurately measure a changing signal, like you are doing, you need to sample at, at least, twice the frequency of the signal. If you don't your samples may give incorrect results because you are sampling partway up or down the curve.

To measure an 8 MHz signal, you therefore need to sample at 16 MHz, which you don't appear to be doing.

2

According to the MyDAQ specifications the analogue input has a pass-band filter of "DC to 400kHz". That means that at 400kHz the signal will be reduced by -3dB, and anything above that will be reduced even further, and the higher the frequency the more it will be reduced.

Further to that the MyDAQ samples at up to 200ksps, which means it can only capture a maximum frequency component of 100kHz.

The MyDAQ is little more than an educational toy. It's just a glorified sound card and really not worth wasting your time with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.