Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The library is not compatible with last idf-release_v5.1 #11

Open
woodlist opened this issue Apr 13, 2024 · 2 comments
Open

The library is not compatible with last idf-release_v5.1 #11

woodlist opened this issue Apr 13, 2024 · 2 comments

Comments

@woodlist
Copy link

woodlist commented Apr 13, 2024

Please update the library. It has too many compatible issues.
The compilation output is:
`c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: In function 'void onHLim(void*)':
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:25:39: warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
25 | *(volatile uint32_t )backupCounter += PCNT_HIGH_LIMIT;
| ^
In file included from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/xtensa/include/xt_utils.h:16,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/esp_hw_support/include/esp_cpu.h:16,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/esp_hw_support/include/spinlock.h:11,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:74,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/freertos/FreeRTOS-Kernel/include/freertos/portable.h:59,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/freertos/FreeRTOS-Kernel/include/freertos/FreeRTOS.h:71,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-rc3\cores\esp32/Arduino.h:33,
from c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.h:4,
from c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:1:
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:16:19: error: 'PCNT_UNIT_0' was not declared in this scope; did you mean 'PCNT_UNIT'?
16 | #define PCNT_UNIT PCNT_UNIT_0
| ^~~~~~~~~~~
C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-442a798083/esp32/include/esp_common/include/esp_bit_defs.h:79:42: note: in definition of macro 'BIT'
79 | #define BIT(nr) (1UL << (nr))
| ^~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:26:26: note: in expansion of macro 'PCNT_UNIT'
26 | PCNT.int_clr.val = BIT(PCNT_UNIT); // Clear the interrupt.
| ^~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: At global scope:
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:30:8: error: 'pcnt_isr_handle_t' does not name a type; did you mean 'pcnt_unit_handle_t'?
30 | static pcnt_isr_handle_t setupPcnt(uint8_t pin, volatile uint32_t backupCounter) {
| ^~~~~~~~~~~~~~~~~
| pcnt_unit_handle_t
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:52:24: warning: ignoring attribute 'section (".iram1.3")' because it conflicts with previous 'section (".iram1.1")' [-Wattributes]
52 | void IRAM_ATTR onTimer()
| ^
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.h:17:16: note: previous declaration here
17 | void IRAM_ATTR onTimer();
| ^~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: In function 'void onTimer()':
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:16:19: error: 'PCNT_UNIT_0' was not declared in this scope; did you mean 'PCNT_UNIT'?
16 | #define PCNT_UNIT PCNT_UNIT_0
| ^~~~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:57:26: note: in expansion of macro 'PCNT_UNIT'
57 | pcnt_get_counter_value(PCNT_UNIT, &pulseCount);
| ^~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:57:3: error: 'pcnt_get_counter_value' was not declared in this scope
57 | pcnt_get_counter_value(PCNT_UNIT, &pulseCount);
| ^~~~~~~~~~~~~~~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: At global scope:
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:69:6: error: variable or field 'teardownPcnt' declared void
69 | void teardownPcnt(pcnt_isr_handle_t isrHandle)
| ^~~~~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:69:19: error: 'pcnt_isr_handle_t' was not declared in this scope; did you mean 'pcnt_unit_handle_t'?
69 | void teardownPcnt(pcnt_isr_handle_t isrHandle)
| ^~~~~~~~~~~~~~~~~
| pcnt_unit_handle_t
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:90:23: warning: ignoring attribute 'section (".iram1.4")' because it conflicts with previous 'section (".iram1.0")' [-Wattributes]
90 | void IRAM_ATTR onRise()
| ^
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.h:16:16: note: previous declaration here
16 | void IRAM_ATTR onRise();
| ^~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: In function 'void onRise()':
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:93:18: warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
93 | _FreqCountESP::sCount++;
| ~~~~~~~~~~~~~~~^~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: In member function 'void _FreqCountESP::_begin(uint8_t, uint8_t)':
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:119:16: error: 'setupPcnt' was not declared in this scope
119 | mIsrHandle = setupPcnt(mPin, &_FreqCountESP::sCount);
| ^~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:125:5: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
125 | timerAlarmEnable(mTimer);
| ^~~~~~~~~~~~~~~~
| timerAlarm
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: In member function 'void _FreqCountESP::begin(uint8_t, uint16_t, uint8_t, uint8_t)':
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:134:22: error: too many arguments to function 'hw_timer_t
timerBegin(uint32_t)'
134 | mTimer = timerBegin(hwTimerId, 80, true);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-rc3\cores\esp32/esp32-hal.h:84,
from C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-rc3\cores\esp32/Arduino.h:36:
C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-rc3\cores\esp32/esp32-hal-timer.h:35:13: note: declared here
35 | hw_timer_t timerBegin(uint32_t frequency);
| ^~~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:135:23: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t
, void (
)())'
135 | timerAttachInterrupt(mTimer, &onTimer, true);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\woodl\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-rc3\cores\esp32/esp32-hal-timer.h:50:6: note: declared here
50 | void timerAttachInterrupt(hw_timer_t *timer, void (*userFunc)(void));
| ^~~~~~~~~~~~~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:136:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
136 | timerAlarmWrite(mTimer, timerMs * 1000, true);
| ^~~~~~~~~~~~~~~
| timerWrite
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp: In member function 'void _FreqCountESP::end()':
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:167:3: error: 'teardownPcnt' was not declared in this scope
167 | teardownPcnt(mIsrHandle);
| ^~~~~~~~~~~~
c:\Users\woodl\Documents\Arduino\libraries\FreqCountESP\src\FreqCountESP.cpp:172:5: error: 'timerAlarmDisable' was not declared in this scope
172 | timerAlarmDisable(mTimer);
| ^~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1`

@cbaum44
Copy link

cbaum44 commented Aug 20, 2024

I second that. The issue with the timer functions stems from an update in the ESP32 API, where several changes were made from 2.x to 3.0. A changelog can be found here: https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html#timer
New documentation about the updated timer functions can be found here: https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/api/timer.html

Affected functions in FreqCountESP.cpp are (at least):
_FreqCountESP::_begin
_FreqCountESP::begin
_FreqCountESP::end()

In my specific case the compilation errrors are only about the timer functions, i.e. similar to the above, but only the part starting from the message pointing at line 125 and onwards. An update to the new timer functions would be greatly appreciated.

@cbaum44
Copy link

cbaum44 commented Aug 20, 2024

In the meantime, I found a possible workaround for anyone with similar issues. In my case, where the problem is only related to the timer function, I was able to get my project using the FreqCountESP library to compile (and work) again by reverting back to the previous API 2.0.17. Here are the steps to follow:

  1. Revert the API of ESP32 by Espressif to 2.0.17 within Arduino IDE's Boards Manager. This link gives detailed instructions how to do this: https://forum.arduino.cc/t/downgrade-from-v3-0-x-to-v2-0-x/1272211
  2. Try to compile your code now, if you're lucky it works and you're done.
  3. If you're unlucky and get the "ZigbeeMode error" looking like this: Invalid FQBN: getting build properties for board esp32:esp32:esp32: invalid option 'ZigbeeMode' you need to clear the cache of the IDE. This can be done by simply deleting a folder, the following link provides instructions of how to delete the specific folder on a windows system: https://forum.arduino.cc/t/invalid-fqbn-getting-build-properties-for-board-esp32esp32-invalid-option-zigbeemode/1243433

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants