SPI and reading issues
With your recent updates to the ESPHome ATM90E32 component I though it was to time to update to the latest yaml. But I started having serious problems. I started receiving SPI warnings like this one:
[16:55:23][W][atm90e32:863]: [get_phase_current_()] SPI read mismatch: expected 0x0002, got 0x2413
But the real problem was with the data.
What fixed my problem was removing interface: software from 6chan_common.yaml line 55.. This defaults to any and I believe it will choose a hardware SPI on the NodeMCU.
spi:
interface: software
clk_pin: 18
miso_pin: 19
mosi_pin: 23
Thanks for reporting this!
When you updated things, did you also switch from compiling with the Arduino IDE to ESP-IDF?
Yes I switched to ESP-IDF. My first configuration was to use your 6chan_common.yaml as a package which switched to ESP-IDF. As you may already know switching platforms requires a physical connection (USB) because the partition table needs to be updated and ESPHome can't do this wirelessly (at least not yet).
Wait a sec. I thought the advice was the other way around to switch to arduino from esp-idf. The latest common file now references type arduino instead of esp-idf
Wait a sec. I thought the advice was the other way around to switch to arduino from esp-idf. The latest common file now references type arduino instead of esp-idf
If you have more than 2 add-on boards, it's necessary to use the Arduino framework using the default spi config (which is interface: any). Hardware SPI on the esp-idf can't have more than 6 devices, and software SPI produces the results above. I'm not sure why this is happening yet.
Hardware SPI on the esp-idf can't have more than 6 devices
See https://github.com/esphome/esphome/pull/9128#issuecomment-2983430390 for a fix.
Hardware SPI on the esp-idf can't have more than 6 devices
See esphome/esphome#9128 (comment) for a fix.
Thank you so much! This is working great!
For others seeing this, if you want to use the ESP-IDF with more than 2 add-on boards you'll need to add
external_components:
- source: github://pr#9128
components: [mipi_spi, spi]
refresh: 1h
to your config until the PR gets pushed to release
with
esp32:
framework:
type: esp-idf
spi:
interface: hardware
and
release_device: true
under each - platform: atm90e32
Hardware SPI on the esp-idf can't have more than 6 devices
this is now in the latest release, 2025.7.0. All configs have been updated to reflect this and also include the optional addition of other config setups: https://github.com/CircuitSetup/Expandable-6-Channel-ESP32-Energy-Meter/tree/master/Software/ESPHome