Open milesfrankland opened 4 years ago
yeah, this is fucked up. my current solution is a hack - faster uCs should not need the loop-counting. I hope i find some time in the near future to update this lib.
The same issue with the Trinket M0 (SAMD21E18A). The onewire lib as well as this OneWireHub lib both indicate compatibility with the SAMD21G18A.
I found this pull request for the OneWire library that seemed to resolve some compatibility issues but unfortunately more errors still persist after implementing the same fix.
Compiling .pio\build\adafruit_trinket_m0\lib9b2\OneWireHub\DS2431.cpp.o In file included from .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\OneWireItem.h:4, from .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\BAE910.h:8, from .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\BAE910.cpp:1: .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\OneWireHub.h: In function 'constexpr timeOW_t operator""_us(long long unsigned int)': .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\OneWireHub.h:13:1: error: the value of 'SystemCoreClock' is not usable in a constant expression 13 | } | ^
I can't seem to find a better library for slave emulation but all seem to be out of date. What am I missing? Has something better than OneWire come along?
Hey đź‘‹,
I have the same issue with the STM32F0 board when trying to emulate the DS2431. Thanks for all the work so far! I'd love to help because this sits on the critical path for my application, but I'm not proficient in C++. Let me know if I can assist in any other way, please.
Cheers! A
In file included from Documents/Arduino/libraries/OneWireHub/src/OneWireItem.h:4,
from Documents/Arduino/libraries/OneWireHub/src/DS2431.h:9,
from /private/var/folders/0h/tvr3mlyx0wl3rbpljhckvy_h0000gn/T/.arduinoIDE-unsaved2023631-2135-1t8d9vt.d3dzg/sketch_jul31a/sketch_jul31a.ino:9:
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h: In function 'constexpr timeOW_t operator""_us(long long unsigned int)':
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:13:1: error: the value of 'SystemCoreClock' is not usable in a constant expression
13 | }
| ^
In file included from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f030x6.h:103,
from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h:125,
from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/stm32/stm32_def.h:28,
from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/stm32/clock.h:19,
from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/wiring_time.h:23,
from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/wiring.h:38,
from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/Arduino.h:36,
from /private/var/folders/0h/tvr3mlyx0wl3rbpljhckvy_h0000gn/T/arduino/sketches/45D704DEBA72B1C0696EBD061C77E0F8/sketch/sketch_jul31a.ino.cpp:1:
Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h:56:17: note: 'uint32_t SystemCoreClock' is not const
56 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
| ^~~~~~~~~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h: In function 'constexpr timeOW_t timeUsToLoops(uint16_t)':
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:20:1: error: the value of 'SystemCoreClock' is not usable in a constant expression
20 | }
| ^
Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h:56:17: note: 'uint32_t SystemCoreClock' is not const
56 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
| ^~~~~~~~~~~~~~~
In file included from Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:22:
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h: At global scope:
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:27:59: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
27 | constexpr timeOW_t ONEWIRE_TIME_RESET_TIMEOUT = { 5000_us }; // for not hanging to long in reset-detection, lower value is better for more responsive applications, but can miss resets
| ^~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:28:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
28 | constexpr timeOW_t ONEWIRE_TIME_RESET_MIN[2] = { 430_us, 48_us }; // should be 480
| ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:29:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
29 | constexpr timeOW_t ONEWIRE_TIME_RESET_MAX[2] = { 960_us, 80_us }; // from ds2413
| ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:32:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
32 | constexpr timeOW_t ONEWIRE_TIME_PRESENCE_TIMEOUT = { 20_us }; // probe measures 25us, duration of high state between reset and presence
| ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:33:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
33 | constexpr timeOW_t ONEWIRE_TIME_PRESENCE_MIN[2] = { 160_us, 8_us }; // was 125
| ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:34:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
34 | constexpr timeOW_t ONEWIRE_TIME_PRESENCE_MAX[2] = { 480_us, 32_us }; // should be 280, was 480
| ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:37:58: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
37 | constexpr timeOW_t ONEWIRE_TIME_MSG_HIGH_TIMEOUT = { 15000_us }; // there can be these inactive / high timeperiods after reset / presence, this value defines the timeout for these
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:38:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
38 | constexpr timeOW_t ONEWIRE_TIME_SLOT_MAX[2] = { 135_us, 30_us }; // should be 120, measured from falling edge to next falling edge
| ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:41:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
41 | constexpr timeOW_t ONEWIRE_TIME_READ_MIN[2] = { 20_us, 4_us }; // should be 15, was 30, says when it is safe to read a valid bit
| ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:42:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
42 | constexpr timeOW_t ONEWIRE_TIME_READ_MAX[2] = { 60_us, 10_us }; // low states (zeros) of a master should not exceed this time in a slot
| ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:43:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
43 | constexpr timeOW_t ONEWIRE_TIME_WRITE_ZERO[2] = { 30_us, 8_us }; // the hub holds a zero for this long
| ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
| ^~~~~~~~
exit status 1
Compilation error: exit status 1
Digging deeper into this issue, I have questions :)
at the moment the lib relies sole on loop-counting for timing, no direct access to interrupt or timers, NOTE: if you use an uncalibrated architecture the compilation-process will fail with an error, look at ./examples/debug/calibrate_by_bus_timing for an explanation
So, If I'd manage to spec the STM32F0 board in https://github.com/orgua/OneWireHub/blob/main/src/platform.h with the TMP_HACK
enabled it might work, right?
Also, can the board do something else apart from just being 1-wire slave? I mean execute some other code e.g. delay()
.
I'm trying to include onewirehub into an existing ESP32 based PlatformIO project. When adding the lib_deps for OnewireHub I'm getting errors in OneWireHubConfig.h in line 47 and following
constexpr timeOW_t ONEWIREHUB_TIME_RESET_TIMEOUT = {5000_us};
Error Message:
constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
I'm not sure if this is OT, but it atleast seems to be an comparable issue..
These are the errors:
Compiles fine for AVR stuff though!