Reading DS18b20 sensors using ESP-IDF using a ESP32 with a 26 MHx XTAL

jgrocha
Posts: 4
Joined: Thu Dec 06, 2018 7:10 pm

Reading DS18b20 sensors using ESP-IDF using a ESP32 with a 26 MHx XTAL

Postby jgrocha » Sun Jan 06, 2019 12:21 am

I'm able to read DS18B20 sensors using the example code provided in this repository https://github.com/DavidAntliff/esp32-ds18b20-example.

It works well using a standard Espressif ESP32-WROOM-32 (aka ESP32-DevKitC), which uses a 40 MHz XTAL.

I'm not able to run the same example using an Allnet-IOT-WLAN https://www.allnet.de/lp/iot-wlan-display/, which uses a 26 MHz XTAL.

I suspect that the problem is related with RMT initialization. The initialization is using:

Code: Select all

rmt_tx.clk_div = 80;
I've tried different settings for clk_div with no luck. File is: https://github.com/DavidAntliff/esp32-o ... /owb_rmt.c

Does anyone know how to use the DS18B20 sensor with ESP-IDF, using a board with a 26 MHz XTAL, instead of more standard 40 MHz one?

ESP32-WROOM-32 output (working)

I (0) cpu_start: Starting scheduler on APP CPU.
Find devices:
0 : d4000008e40d7428
1 : f8000008e3632528
Found 2 devices
Device 1502162ca5b2ee28 is not present

Temperature readings (degrees C): sample 1
0: 22.3 0 errors
1: 21.8 0 errors

Temperature readings (degrees C): sample 2
0: 22.3 0 errors
1: 21.9 0 errors

Allnet-IOT-WLAN output (not working)


I (0) cpu_start: Starting scheduler on APP CPU.
Find devices:
Found 0 devices
E (6780) owb_rmt: rx_items == 0
E (6880) owb_rmt: rx_items == 0
E (6980) owb_rmt: rx_items == 0

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Reading DS18b20 sensors using ESP-IDF using a ESP32 with a 26 MHx XTAL

Postby WiFive » Sun Jan 06, 2019 7:44 am

Apb clock should be 80mhz for both crystals, so maybe there is another problem such as the pin you are using is connected to something else internally

jgrocha
Posts: 4
Joined: Thu Dec 06, 2018 7:10 pm

Re: Reading DS18b20 sensors using ESP-IDF using a ESP32 with a 26 MHx XTAL

Postby jgrocha » Sun Jan 06, 2019 11:03 am

Thank you @WiFive. I've check both logs (for the Allnet-IOT-OLED and the standard ESP32-WROOM-32) and both seem to use the same 80 MHz clock source for the RMT initialization.

ESP32-WROOM-32 log (working):

Code: Select all

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
Allnet-IOT-OLED log (not working):

Code: Select all

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
I'll try to find the problem with this Allnet-IOT-OLED board.

jgrocha
Posts: 4
Joined: Thu Dec 06, 2018 7:10 pm

Re: Reading DS18b20 sensors using ESP-IDF using a ESP32 with a 26 MHx XTAL

Postby jgrocha » Sun Jan 06, 2019 3:10 pm

Sorry for the noise. The board came with a inverted/mirrored pinout diagram! I've already alert the store. Everything is working now and there is no difference in the RTM initialization.

Who is online

Users browsing this forum: No registered users and 70 guests