DavidAntliff / esp32-ds18b20-example

ESP32-compatible example for Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
MIT License
108 stars 34 forks source link

ESP32 with 26MHx XTAL #4

Closed jgrocha closed 5 years ago

jgrocha commented 5 years ago

Hi,

This library works fine with my Expressif ESP32-WROOM-32 (ake ESP32-DevKitC). This ESP32 uses a 40 MHz XTAL.

I've tried to run the same code in another ESP32 with OLED which uses a 26 MHz XTAL. It does not recognize the DS18B20 sensors.

I think the problem is related with the RMT initialization. I've tried other values for the rmt_tx.clk_div (by changing esp32-ds18b20-example/components/esp32-owb/owb_rmt.c). The default is rmt_tx.clk_div = 80;.

Does anyone tested this library with another ESP32 with a 26 MHz XTAL?

jgrocha commented 5 years ago

The debug output for the ESP 32 Allnet-IOT-OLED is:

I (0) cpu_start: Starting scheduler on APP CPU.
D (299) heap_init: New heap initialised at 0x3ffe0440
D (309) heap_init: New heap initialised at 0x3ffe4350
D (319) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (2319) owb_rmt: owb_rmt_initialize: gpio_num: 25, tx_channel: 1, rx_channel: 0
D (2319) rmt: Rmt Tx Channel 1|Gpio 25|Sclk_Hz 80000000|Div 80|Carrier_Hz 0|Duty 35
D (2319) intr_alloc: Connected src 47 to int 13 (cpu 0)
D (2319) rmt: Rmt Rx Channel 0|Gpio 25|Sclk_Hz 80000000|Div 80|Thresold 77|Filter 30
D (2329) owb: use_crc 1
Find devices:
D (2339) owb_rmt: _is_present 0
Found 0 devices
E (2439) owb_rmt: rx_items == 0
D (2439) owb_rmt: _is_present 0
E (2539) owb_rmt: rx_items == 0
D (2539) owb_rmt: _is_present 0
E (2639) owb_rmt: rx_items == 0

The debug output for the ESP32-WROOM-32 is:

I (0) cpu_start: Starting scheduler on APP CPU.
D (297) heap_init: New heap initialised at 0x3ffe0440
D (307) heap_init: New heap initialised at 0x3ffe4350
D (317) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (2317) owb_rmt: owb_rmt_initialize: gpio_num: 27, tx_channel: 1, rx_channel: 0
D (2317) rmt: Rmt Tx Channel 1|Gpio 27|Sclk_Hz 80000000|Div 80|Carrier_Hz 0|Duty 35
D (2317) intr_alloc: Connected src 47 to int 13 (cpu 0)
D (2317) rmt: Rmt Rx Channel 0|Gpio 27|Sclk_Hz 80000000|Div 80|Thresold 77|Filter 30
D (2327) owb: use_crc 1
Find devices:
D (2337) owb_rmt: _is_present 1
  0 : d4000008e40d7428
D (2367) owb_rmt: _is_present 1
  1 : f8000008e3632528
Found 2 devices
jgrocha commented 5 years ago

Sorry for the noise. I was using a wrong pinout diagram. There are no issues with a different XTAL frequency.