Giter Club home page Giter Club logo

Comments (22)

technyon avatar technyon commented on May 28, 2024

Hi, it should be possible to port this to the Olimex board. However, there are quite a few more boards with LAN connectivity and this is a project I'm running and financing privately - I unfortunately can't buy every hardware out there.

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

yeah, i understand that, no prob.

Maybe i can help you with stuff? i looked into your code, looks like the network stack is "modular", maybe we can write another stack for LAN8710A ?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

Sure ... thinking about maybe it's enough to just wire a LAN8710A module the same way it's wired on the board? They are fairly cheap.

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

should be. i tried flashing the firmware in hope to use the esp32 wifi, but unfortunately, the gpio pin for eth activation (gpio26) is wired to the nic chip. this leads to deactivating the wifi. which IDE do you used for developing this code?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

I'm using clion, but if your question is how to compile the code it's a cmake project. Have a look at my other project "coffeetimer", there's a howto for compiling.

Not sure about the GPIO ... I had to pick one so it was 26. We could make it configurable in software, but that has the risk of someone changing to the setting to LAN and then have an ESP that isn't reachable because the hardware is missing.

Maybe have two settings for LAN:

  • Let the user choose which GPIO switches on LAN
  • Let the user select a driver

This way also issue #36 could be addressed.

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

i have no pratical experience with cmake programs. i managed to install arduino sdk, cmake and toolchain, but i got error when trying to compile:
philipp@PF1RKYGV:~/nuki_hub-master$ Picked up JAVA_TOOL_OPTIONS:
cmake -D CMAKE_TOOLCHAIN_FILE=/home/philipp/Arduino-CMake-Toolchain-master/Arduino-toolchain.cmake .
CMake Error at /home/philipp/Arduino-CMake-Toolchain-master/Arduino/System/BoardBuildTargets.cmake:472 (message):
Arduino library BLE could not be found in
/home/philipp/nuki_hub-master;/home/philipp/nuki_hub-master;/home/philipp/Arduino;/home/philipp/.arduino15/packages/esp32/hardware/esp32/1.0.6;/home/philipp/arduino-1.8.19
Call Stack (most recent call first):
/home/philipp/Arduino-CMake-Toolchain-master/Arduino/System/BoardBuildTargets.cmake:713 (find_arduino_library)
/home/philipp/Arduino-CMake-Toolchain-master/Arduino/System/BoardBuildTargets.cmake:680 (_add_internal_arduino_library)
/home/philipp/Arduino-CMake-Toolchain-master/Arduino/System/BoardBuildTargets.cmake:183 (_link_ard_lib_list)
CMakeLists.txt:93 (target_link_arduino_libraries)

CMake Error at /home/philipp/Arduino-CMake-Toolchain-master/Arduino/System/BoardBuildTargets.cmake:166 (message):
DNSServer is not a CMake target
Call Stack (most recent call first):
CMakeLists.txt:111 (target_link_arduino_libraries)

CMake Error at CMakeLists.txt:111 (target_link_arduino_libraries):
cmake_policy PUSH without matching POP

-- Configuring incomplete, errors occurred!
See also "/home/philipp/nuki_hub-master/CMakeFiles/CMakeOutput.log".
See also "/home/philipp/nuki_hub-master/CMakeFiles/CMakeError.log".

any short hint?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024
  • you have to checkout with submodules. Run: git submodule update --init --recursive
  • You should create a subdirectory for building, usually "build":

mkdir build
cd build
cmake -D CMAKE_TOOLCHAIN_FILE=/home/philipp/Arduino-CMake-Toolchain-master/Arduino-toolchain.cmake ..

Also, please use my fork of the arduino toolchain:

https://github.com/technyon/Arduino-CMake-Toolchain

Which version of the Arduino core for ESP32 did you install?

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

EDIT: nvm. had to clear cmake cache :D

yeah, the toolchain file worked for me. i used esp32 version 1.0.6, because all of the 2.0 vers does not find a suitable CXX compiler:
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (project):
The CMAKE_CXX_COMPILER:

/home/philipp/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/xtensa-esp32-elf-g++

is not a full path to an existing compiler tool.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
See also "/home/philipp/nuki_hub/build/CMakeFiles/CMakeOutput.log".
See also "/home/philipp/nuki_hub/build/CMakeFiles/CMakeError.log".

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

i dont get it, now it compiled, but i dont know how to flash it, the directive "upload-nuki_hub" does not work, because no bootloader is generated.

another hint?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

Strange with the compiler, I didn't have that problem. Maybe just set a symbolic link? But for your purposes, 1.0.6 is fine. Pre 2.0 the WiFi problems were much more pronounced, but apart from that it's the same.

You could just copy the bootloader from the official release (basically all .bin files).

I'm using ninja though instead of make, maybe that would fix your problems. Are you on Debian or Ubuntu? In that case run:

apt install ninja-build

Then remove all files from the cmake build directory and add the option "-GNinja" to the cmake command line.

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

yeah, i was dumb. got it to work.
the initialisation of the lan module seems quite simple, should an easy task.
am i right that i have to add another "adapter" in networkDevices/ and put the init stuff in network.cpp?

or am i missing something?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

Yes, create a new device in networkDevices, then instantiate it in network.cpp.

The question is how to switch between W5500 and LAN8720. What do you think about selecting driver and GPIO in the web portal?

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

yeah, i would use wifi as standard, because every esp32 does have it. after first boot, you can decide in the webinterface which driver you want to use.
this gpio selection is nice, but in this scenario you should use this gpio as a "rescue", so setting the gpio to ground will force to default (wifi), in case you have misconfigured anything.

from nuki_hub.

pilo1337 avatar pilo1337 commented on May 28, 2024

my problem is, that i have little to no experience in CMake Projects, i managed to compile it, i tried to integrate new functions for LAN87xx devices, but i dont get it. i got the lan to initialize, but it aborted with error "ethernet_event_start" event failed.

i used the resources over here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_eth.html
seems to work, but i simply dont know how.

the important parts for my board seems to be:
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.smi_mdc_gpio_num = GPIO_NUM_23;
mac_config.smi_mdio_gpio_num = GPIO_NUM_18;
mac_config.interface = EMAC_DATA_INTERFACE_RMII;
mac_config.clock_config.rmii.clock_mode = EMAC_CLK_OUT;
mac_config.clock_config.rmii.clock_gpio = EMAC_CLK_OUT_180_GPIO;

with this i managed to get a short connection.

i dont know how to go further, anyone comments on this?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

It's a bit hard to tell like this what's the issue. Could you fork my project and check in your code so I can have a look at it? Also which library are you using to communicate with the LAN8170?

I don't think it's related to cmake ... if you have problems with cmake it's usually about getting your code to compile.

from nuki_hub.

ruimarinho avatar ruimarinho commented on May 28, 2024

Getting LAN8170 support would be amazing so I could replace my WiFi-based ESP32 by one of these Olimex boards with PoE built-in! Any additional progress so far @pilo1337?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

Hi,

I've added support for the M5Stack Atom POE which uses the W5500 chip:

https://docs.m5stack.com/en/atom/atom_poe

If I find some time I'll try to add their other ESP with Ethernet:

https://shop.m5stack.com/products/esp32-ethernet-unit-with-poe

The latter is considerably cheaper, but lacks a USB port so you have to connect a USB-serial converter.

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

@pilo1337 Can you share the full code ?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

The Olimex is finally supported !

from nuki_hub.

ruimarinho avatar ruimarinho commented on May 28, 2024

Amazing @technyon 👏 ! Will the PoE port be automatically detected or will it still require a WiFi connection to enable the ethernet component?

from nuki_hub.

technyon avatar technyon commented on May 28, 2024

You have to first connect it to wifi and then select olimex hardware. I don't really have a good way to detect that it's running on an olimex board.

from nuki_hub.

ruimarinho avatar ruimarinho commented on May 28, 2024

A different image with these pre-defined values would be great. If you use platform.io, you'd just need to compile the image for a different environment with specific build tags. Example: https://github.com/OpenEVSE/ESP32_WiFi_V4.x/blob/master/platformio.ini

from nuki_hub.

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.