Giter Site home page Giter Site logo

OneWireHub on ESP32 PROBLEM about onewirehub HOT 4 OPEN

lisdaniel avatar lisdaniel commented on June 12, 2024
OneWireHub on ESP32 PROBLEM

from onewirehub.

Comments (4)

eychei avatar eychei commented on June 12, 2024 1

Hi,

I did have the same issue and tried so many options to get this working.
The library just works fine with my esp8266 but not with my esp32.
Error was always:

error: call to non-constexpr function 'uint32_t getCpuFrequencyMhz()'

So looking into
\Arduino15\packages\esp32\hardware\esp32\2.0.6\cores\esp32\Arduino.h
and comparing to
\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\Arduino.h

I found the difference in the following line
esp8266:
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
esp32:
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )

and here is the SOLUTION:

Open File:
\Arduino15\packages\esp32\hardware\esp32\2.0.6\cores\esp32\Arduino.h
change
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
to
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )

Thats it now it compiles without errors.

-e

from onewirehub.

GeorgeIoak avatar GeorgeIoak commented on June 12, 2024 1

Relying on the fact that the GPIO_DEBUG_PIN should go low for 1ms upon bootup I experimented with changing VALUE_IPL and found that by changing from the default of 39 to 51 I was able to dial the pulse width to 1.0ms:
image

The code is now working as expected on this old ESP32_DEVKIT_V1 module with flash frequency set to 80MHz and CPU frequency set to 240MHz in the Arduino IDE.

from onewirehub.

GeorgeIoak avatar GeorgeIoak commented on June 12, 2024

I ran into this problem trying to get OneWireHub running on a ESP32. Although the change mentioned does allow the code to compile I cannot get it to work on a ESP32 (2 different boards). If I switch to an old Arduino board the code and hardware works as expected but I need OneWireHub running on a ESP32 for it's WiFi.

The Readme says this works with ESP32 but perhaps some changes have broken that ability?

from onewirehub.

GeorgeIoak avatar GeorgeIoak commented on June 12, 2024

In the readme I saw this comment:

during hub-startup it issues a 1ms long high-state (you can check the instruction-per-loop-value for your architecture with this)

So I hooked up a scope and checked and I'm measuring a pulse at boot up of 1.3ms instead of 1ms with a ESP32 Dev Module:

image

I tried to run the calibration but that just kept throwing panic errors.

I have this hooked up to a master and I was under the impression that I should get more pulses but that's not happening, only the initial one during boot up.

from onewirehub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.