esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

CanBus does not work (esp-idf) #4377

Open Domepo opened 1 year ago

Domepo commented 1 year ago

The problem

Problem

I can't get canbus/twai to run regularly.

When I connect an oscilloscope I cannot read RX and TX signals of the microcontroller from GPIO22/23. Only after I set the framework from arduino to esp-idf, I got signals, which the TJA1050 then turned into a CanBus signal.

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf
    version: latest

But after I tried to upload the program again it didn't work and I got the following error:

fatal: not a git repository (or any of the parent directories): .git
CMake Error at /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/tool_version_check.cmake:36 (message):

  Tool doesn't match supported version from list ['esp-2022r1-11.2.0']:
  /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc

  Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first):
  /Users/xxx/.platformio/packages/framework-espidf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
  /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/build.cmake:380 (include)
  /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/build.cmake:599 (__build_process_project_includes)
  /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/project.cmake:440 (idf_build_process)
  CMakeLists.txt:3 (project)

I also ran idf.py fullclean in the correct project directory, but that did nothing. The error disappears when I set the esp-idf version to recommended, but then I get no RX/TX signals.

So how do I get Canbus to work?

Shematic

canbus_esp32_5v (but TX/RX connected to GPIO22/23)

Which version of ESPHome has the issue?

2023.3.2

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

esp32doit-devkit-v1

Component causing the issue

canbus

Example YAML snippet

esphome:
  name: test

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf
    version: latest

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

canbus:
  - platform: esp32_can
    tx_pin: GPIO23
    rx_pin: GPIO22
    can_id: 4
    bit_rate: 125kbps

interval:
  - interval: 200ms
    then:
    # Example Data
      - canbus.send:
          can_id: 0x359
          data: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]

wifi:
  ssid: "xxx"
  password: "xxx"

Anything in the logs that might be useful for us?

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.50001.0 (5.0.1) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.9.0 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Reading CMake configuration...
-- Found Git: /usr/bin/git (found version "2.39.2 (Apple Git-143)") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /Users/xxx/.esphome/build/test/sdkconfig.test
/Users/xxx/.esphome/build/test/sdkconfig.test:206 CONFIG_MCPWM_ISR_IN_IRAM was replaced with CONFIG_MCPWM_ISR_IRAM_SAFE
/Users/xxx/.esphome/build/test/sdkconfig.test:285 CONFIG_ESP32_DEFAULT_CPU_FREQ_80 was replaced with CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80
/Users/xxx/.esphome/build/test/sdkconfig.test:286 CONFIG_ESP32_DEFAULT_CPU_FREQ_160 was replaced with CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160
/Users/xxx/.esphome/build/test/sdkconfig.test:287 CONFIG_ESP32_DEFAULT_CPU_FREQ_240 was replaced with CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240
/Users/xxx/.esphome/build/test/sdkconfig.test:288 CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ was replaced with CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ
/Users/xxx/.esphome/build/test/sdkconfig.test:289 CONFIG_ESP32_SPIRAM_SUPPORT was replaced with CONFIG_SPIRAM
/Users/xxx/.esphome/build/test/sdkconfig.test:292 CONFIG_ESP32_ULP_COPROC_ENABLED was replaced with CONFIG_ULP_COPROC_ENABLED
/Users/xxx/.esphome/build/test/sdkconfig.test:293 CONFIG_ESP32_ULP_COPROC_RESERVE_MEM was replaced with CONFIG_ULP_COPROC_RESERVE_MEM
/Users/xxx/.esphome/build/test/sdkconfig.test:294 CONFIG_ESP32_DEBUG_OCDAWARE was replaced with CONFIG_ESP_DEBUG_OCDAWARE
/Users/xxx/.esphome/build/test/sdkconfig.test:295 CONFIG_ESP32_BROWNOUT_DET was replaced with CONFIG_ESP_BROWNOUT_DET
/Users/xxx/.esphome/build/test/sdkconfig.test:296 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_0
/Users/xxx/.esphome/build/test/sdkconfig.test:297 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1
/Users/xxx/.esphome/build/test/sdkconfig.test:298 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2
/Users/xxx/.esphome/build/test/sdkconfig.test:299 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3
/Users/xxx/.esphome/build/test/sdkconfig.test:300 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4
/Users/xxx/.esphome/build/test/sdkconfig.test:301 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5
/Users/xxx/.esphome/build/test/sdkconfig.test:302 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6
/Users/xxx/.esphome/build/test/sdkconfig.test:303 CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 was replaced with CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7
/Users/xxx/.esphome/build/test/sdkconfig.test:304 CONFIG_ESP32_BROWNOUT_DET_LVL was replaced with CONFIG_ESP_BROWNOUT_DET_LVL
/Users/xxx/.esphome/build/test/sdkconfig.test:305 CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 was replaced with CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
/Users/xxx/.esphome/build/test/sdkconfig.test:306 CONFIG_ESP32_TIME_SYSCALL_USE_RTC was replaced with CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC
/Users/xxx/.esphome/build/test/sdkconfig.test:307 CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 was replaced with CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
/Users/xxx/.esphome/build/test/sdkconfig.test:308 CONFIG_ESP32_TIME_SYSCALL_USE_NONE was replaced with CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE
/Users/xxx/.esphome/build/test/sdkconfig.test:309 CONFIG_ESP32_RTC_CLK_SRC_INT_RC was replaced with CONFIG_RTC_CLK_SRC_INT_RC
/Users/xxx/.esphome/build/test/sdkconfig.test:310 CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS was replaced with CONFIG_RTC_CLK_SRC_EXT_CRYS
/Users/xxx/.esphome/build/test/sdkconfig.test:311 CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC was replaced with CONFIG_RTC_CLK_SRC_EXT_OSC
/Users/xxx/.esphome/build/test/sdkconfig.test:312 CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 was replaced with CONFIG_RTC_CLK_SRC_INT_8MD256
/Users/xxx/.esphome/build/test/sdkconfig.test:313 CONFIG_ESP32_RTC_CLK_CAL_CYCLES was replaced with CONFIG_RTC_CLK_CAL_CYCLES
/Users/xxx/.esphome/build/test/sdkconfig.test:314 CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY was replaced with CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY
/Users/xxx/.esphome/build/test/sdkconfig.test:315 CONFIG_ESP32_XTAL_FREQ_40 was replaced with CONFIG_XTAL_FREQ_40
/Users/xxx/.esphome/build/test/sdkconfig.test:316 CONFIG_ESP32_XTAL_FREQ_26 was replaced with CONFIG_XTAL_FREQ_26
/Users/xxx/.esphome/build/test/sdkconfig.test:317 CONFIG_ESP32_XTAL_FREQ_AUTO was replaced with CONFIG_XTAL_FREQ_AUTO
/Users/xxx/.esphome/build/test/sdkconfig.test:318 CONFIG_ESP32_XTAL_FREQ was replaced with CONFIG_XTAL_FREQ
/Users/xxx/.esphome/build/test/sdkconfig.test:320 CONFIG_ESP32_NO_BLOBS was replaced with CONFIG_APP_NO_BLOBS
/Users/xxx/.esphome/build/test/sdkconfig.test:321 CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS was replaced with CONFIG_APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS
/Users/xxx/.esphome/build/test/sdkconfig.test:322 CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS was replaced with CONFIG_APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS
/Users/xxx/.esphome/build/test/sdkconfig.test:395 CONFIG_OTA_ALLOW_HTTP was replaced with CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP
/Users/xxx/.esphome/build/test/sdkconfig.test:519 CONFIG_ESP_TASK_WDT was replaced with CONFIG_ESP_TASK_WDT_INIT
/Users/xxx/.esphome/build/test/sdkconfig.test:694 CONFIG_HAL_ASSERTION_SILIENT was replaced with CONFIG_HAL_ASSERTION_SILENT
-- Configuring incomplete, errors occurred!
See also "/Users/xxx/.esphome/build/test/.pioenvs/test/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any of the parent directories): .git
CMake Error at /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/tool_version_check.cmake:36 (message):

  Tool doesn't match supported version from list ['esp-2022r1-11.2.0']:
  /Users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc

  Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first):
  /Users/xxx/.platformio/packages/framework-espidf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
  /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/build.cmake:380 (include)
  /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/build.cmake:599 (__build_process_project_includes)
  /Users/xxx/.platformio/packages/framework-espidf/tools/cmake/project.cmake:440 (idf_build_process)
  CMakeLists.txt:3 (project)

Additional information

Device: ESP-WROOM-3.2

Manfredi9 commented 7 months ago

Have you fixed the problem?