ESP32 - Frequency Counter

Using this code direct from Github after installing the ZIP file :

#include "FreqCountESP.h"

int inputPin = 14;
int timerMs = 1000;

void setup()
{
Serial.begin(9600);
FreqCountESP.begin(inputPin, timerMs);
}

void loop()
{
if (FreqCountESP.available())
{
uint32_t frequency = FreqCountESP.read();
Serial.println(frequency);
}
}

I am getting this error .. Not sure whats wrong ?

Arduino: 1.8.16 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

C:\Users\ragun\Documents\Arduino\libraries\FreqCountESP-master\src\FreqCountESP.cpp: In function 'intr_handle_data_t* setupPcnt(uint8_t, volatile uint32_t*)':

C:\Users\ragun\Documents\Arduino\libraries\FreqCountESP-master\src\FreqCountESP.cpp:34:17: error: 'PCNT_CHANNEL_EDGE_ACTION_INCREASE' was not declared in this scope

 .pos_mode = PCNT_CHANNEL_EDGE_ACTION_INCREASE,

             ^

C:\Users\ragun\Documents\Arduino\libraries\FreqCountESP-master\src\FreqCountESP.cpp:35:17: error: 'PCNT_CHANNEL_EDGE_ACTION_HOLD' was not declared in this scope

 .neg_mode = PCNT_CHANNEL_EDGE_ACTION_HOLD,

             ^

C:\Users\ragun\Documents\Arduino\libraries\FreqCountESP-master\src\FreqCountESP.cpp: In function 'void teardownPcnt(pcnt_isr_handle_t)':

C:\Users\ragun\Documents\Arduino\libraries\FreqCountESP-master\src\FreqCountESP.cpp:73:32: error: 'pcnt_isr_unregister' was not declared in this scope
pcnt_isr_unregister(isrHandle);
^
exit status 1
Error compiling for board ESP32 Dev Module.

Based upon the code the OP posted. It is highly probable that the installed firmware on the ESP32 does not match the firmware that the code was written for,

1 Like

Compiles correctly on core 2.0.6 with old IDE.

1 Like

Oh ok ... so it looks like a firmware mismatch. Thanks !

The details on the core version must be told by the vendor who supplies the module ? I tried to run a Chip ID program and got only the following information :star_struck:
image

Let me try with another ESP32 module ( there are hundreds of variants out there and at times that by itself is a problem as we don't get correct documents for it )

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.