Skip to main content
added 561 characters in body
Source Link
Marcus Müller
  • 96.8k
  • 5
  • 140
  • 258

Your ESP32 has a "pulse counter" peripheral, which you can program to raise an interrupt every 216 rising input edges. Nice! Route your output pin back to another pin on your ESP32, and attach a "Pulse Count Controller" input signal to that pin (Chapter 17, p. 492, in the ESP32 technical reference manual), and configure the counter to count up, and the comparator to compare to 216-1 (=0xFFFF).

In that interrupt service routine, toggle another output pin; toggling the pin ever 216 input rising edges divides the clock by 216·2, so you end up with 12·106 Hz / 217 = 91.55… Hz. You could simply attach (with a voltage divider and a capacitor) that to a line in on your PC or smartphone sound card and use any audio analysis software to get a spectrum; you should get a dominant peak at 91.55 Hz. Useful software here is Audacity on the PC, or Phyfox on a phone.

The question really is whether this is worth the effort. You can buy complete, guaranteed-to-work 12 MHz oscillators with the output level you need (whatever that might be, you didn't tell us!) for cheap; example 1, example 2

Your ESP32 has a "pulse counter" peripheral, which you can program to raise an interrupt every 216 rising input edges. Nice! Route your output pin back to another pin on your ESP32, and attach a "Pulse Count Controller" input signal to that pin (Chapter 17, p. 492, in the ESP32 technical reference manual), and configure the counter to count up, and the comparator to compare to 216-1 (=0xFFFF).

In that interrupt service routine, toggle another output pin; toggling the pin ever 216 input rising edges divides the clock by 216·2, so you end up with 12·106 Hz / 217 = 91.55… Hz. You could simply attach (with a voltage divider and a capacitor) that to a line in on your PC or smartphone sound card and use any audio analysis software to get a spectrum; you should get a dominant peak at 91.55 Hz. Useful software here is Audacity on the PC, or Phyfox on a phone.

Your ESP32 has a "pulse counter" peripheral, which you can program to raise an interrupt every 216 rising input edges. Nice! Route your output pin back to another pin on your ESP32, and attach a "Pulse Count Controller" input signal to that pin (Chapter 17, p. 492, in the ESP32 technical reference manual), and configure the counter to count up, and the comparator to compare to 216-1 (=0xFFFF).

In that interrupt service routine, toggle another output pin; toggling the pin ever 216 input rising edges divides the clock by 216·2, so you end up with 12·106 Hz / 217 = 91.55… Hz. You could simply attach (with a voltage divider and a capacitor) that to a line in on your PC or smartphone sound card and use any audio analysis software to get a spectrum; you should get a dominant peak at 91.55 Hz. Useful software here is Audacity on the PC, or Phyfox on a phone.

The question really is whether this is worth the effort. You can buy complete, guaranteed-to-work 12 MHz oscillators with the output level you need (whatever that might be, you didn't tell us!) for cheap; example 1, example 2

Source Link
Marcus Müller
  • 96.8k
  • 5
  • 140
  • 258

Your ESP32 has a "pulse counter" peripheral, which you can program to raise an interrupt every 216 rising input edges. Nice! Route your output pin back to another pin on your ESP32, and attach a "Pulse Count Controller" input signal to that pin (Chapter 17, p. 492, in the ESP32 technical reference manual), and configure the counter to count up, and the comparator to compare to 216-1 (=0xFFFF).

In that interrupt service routine, toggle another output pin; toggling the pin ever 216 input rising edges divides the clock by 216·2, so you end up with 12·106 Hz / 217 = 91.55… Hz. You could simply attach (with a voltage divider and a capacitor) that to a line in on your PC or smartphone sound card and use any audio analysis software to get a spectrum; you should get a dominant peak at 91.55 Hz. Useful software here is Audacity on the PC, or Phyfox on a phone.