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

Device not detected with ESP IDF v4.2 #19

Closed physiii closed 4 years ago

physiii commented 4 years ago

Using ESP-IDF commit 71dc5eb276041679da34dddc08e90dd3042df065 (Mon Apr 27 11:43:48 2020)

Actions:

connect power, gnd, and data to ds18b20. Put 4k7 pullup for data git clone --recursive https://github.com/DavidAntliff/esp32-ds18b20-example.git cd esp32*;make all flash monitor

Output:

Found 0 devices Device 1502162ca5b2ee28 is not present

Scope: SDS00011 SDS00012

I tried on two sensors with same results.

Are the sensors bad or is there something else I need to try before ordering more?

DavidAntliff commented 4 years ago

Hi, I'm sorry to hear you're having issues with this example.

There are a lot of counterfeit DS18B20 devices around, but as far as I know they should at least be detected.

Try a single device first, and try lowering the 4k7ohm resistor to 3k3ohm as well. But only change one thing at a time.

You can try turning on debugging for the "ds18b20" and "owb" components (see the first few lines of main()) and paste the console output here.

You could also test your devices with another library, such as an Arduino one. If it works there, then it should work with this library too.

Ignore the warning about Device 1502162ca5b2ee28 is not present - that's just a part of the example that shows how to detect if a specific device is present, and that ID corresponds to one of my devices.

I'd like to help so please try a few things and post back here.

DavidAntliff commented 4 years ago

Oh, you do need to run idf.py menuconfig and select the correct GPIOs - make sure that the data GPIO for the devices matches what you've set there. See this.

physiii commented 4 years ago

David, thanks for the reply.

I double checked, IO is set right otherwise I wouldn't see data on the scope.

Tested with an arduino library and it worked right away so that points to this library or esp-idf.

Output with debugging:

I (31) boot: ESP-IDF v4.2-dev-1235-g71dc5eb27 2nd stage bootloader
I (31) boot: compile time 06:07:43
I (31) boot: chip revision: 1
I (35) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (42) boot.esp32: SPI Speed      : 40MHz
I (47) boot.esp32: SPI Mode       : DIO
I (51) boot.esp32: SPI Flash Size : 8MB
I (56) boot: Enabling RNG early entropy source...
I (61) boot: Partition Table:
I (65) boot: ## Label            Usage          Type ST Offset   Length
I (72) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (80) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (87) boot:  2 factory          factory app      00 00 00010000 00100000
I (95) boot: End of partition table
I (99) boot_comm: chip revision: 1, min. application chip revision: 0
I (106) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x07018 ( 28696) map
I (126) esp_image: segment 1: paddr=0x00017040 vaddr=0x3ffb0000 size=0x02228 (  8744) load
I (130) esp_image: segment 2: paddr=0x00019270 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

I (133) esp_image: segment 3: paddr=0x00019678 vaddr=0x40080400 size=0x069a0 ( 27040) load
I (153) esp_image: segment 4: paddr=0x00020020 vaddr=0x400d0020 size=0x160ac ( 90284) map
0x400d0020: _stext at ??:?

I (188) esp_image: segment 5: paddr=0x000360d4 vaddr=0x40086da0 size=0x04564 ( 17764) load
0x40086da0: prvAddNewTaskToReadyList at /home/andy/esp/esp-idf/components/freertos/tasks.c:1131

I (202) boot: Loaded app from partition at offset 0x10000
I (202) boot: Disabling RNG early entropy source...
I (202) cpu_start: Pro cpu up.
I (206) cpu_start: Application information:
I (211) cpu_start: Project name:     esp32-ds18b20-example
I (217) cpu_start: App version:      33fcdd2-dirty
I (223) cpu_start: Compile time:     May  2 2020 06:07:36
I (229) cpu_start: ELF file SHA256:  b05425913f1d6405...
I (235) cpu_start: ESP-IDF:          v4.2-dev-1235-g71dc5eb27
I (241) cpu_start: Starting app cpu, entry point is 0x4008110c
0x4008110c: call_start_cpu1 at /home/andy/esp/esp-idf/components/esp32/cpu_start.c:286

I (232) cpu_start: App cpu up.
I (252) heap_init: Initializing. RAM available for dynamic allocation:
I (259) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (265) heap_init: At 3FFB2B08 len 0002D4F8 (181 KiB): DRAM
I (271) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (277) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (284) heap_init: At 4008B304 len 00014CFC (83 KiB): IRAM
I (290) cpu_start: Pro cpu start user code
I (308) spi_flash: detected chip: gd
I (309) spi_flash: flash io: dio
I (309) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Find devices:
Found 0 devices
Device 1502162ca5b2ee28 is not present

No DS18B20 devices detected!
Restarting now.
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:6940
load:0x40078000,len:14332
ho 0 tail 12 room 4
load:0x40080400,len:3980
entry 0x40080680I (31) boot: ESP-IDF v4.2-dev-1235-g71dc5eb27 2nd stage bootloader
DavidAntliff commented 4 years ago

Sorry, I should have been a bit clearer - not only do you need to uncomment the two debugging lines in app_main.c: https://github.com/DavidAntliff/esp32-ds18b20-example/blob/master/main/app_main.c#L45

You also need to set, within menuconfig, Component Config > Log Output > Default Log Verbosity > Debug, otherwise it won't show application logging due to a compile-time check.

If it's working you should see lines in the log starting with "ds18b20: " and "owb: ".

We had a situation a few months ago where sensors worked in Arduino but not with this library due to timing issues with a particular ESP32 - the ESP32 clock was running slow which meant that the library's timing was incorrect. I added 10% extra timing tolerance to deal with that, but maybe it's worse than we thought? Do you have another ESP32 you can try? The Arduino library does not use RMT (a timing peripheral in the ESP32) so it may be more accommodating.

What ESP32 platform are you using? What version of the IDF?

physiii commented 4 years ago

I use ESP-WROOM-32D modules on various pcb designs. I've tried two different modules with same results. Tried with clock at 80/160/240 Mhz.

IDF version: ESP-IDF v4.2-dev-1235-g71dc5eb27

Module ID's

FCC ID: 2AC72-ESPWROOM32D
IC: 21098-ESPWROOM32
CMIT ID: 2017DP6053

Debug output:

I (30) boot: ESP-IDF v4.2-dev-1235-g71dc5eb27 2nd stage bootloader
I (30) boot: compile time 21:35:29
I (30) boot: chip revision: 1
I (34) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (42) boot.esp32: SPI Speed      : 40MHz
I (46) boot.esp32: SPI Mode       : DIO
I (51) boot.esp32: SPI Flash Size : 8MB
I (55) boot: Enabling RNG early entropy source...
I (61) boot: Partition Table:
I (64) boot: ## Label            Usage          Type ST Offset   Length
I (72) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (79) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (86) boot:  2 factory          factory app      00 00 00010000 00100000
I (94) boot: End of partition table
I (98) boot_comm: chip revision: 1, min. application chip revision: 0
I (105) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x079b4 ( 31156) map
I (126) esp_image: segment 1: paddr=0x000179dc vaddr=0x3ffb0000 size=0x022b0 (  8880) load
I (130) esp_image: segment 2: paddr=0x00019c94 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

I (135) esp_image: segment 3: paddr=0x0001a09c vaddr=0x40080400 size=0x05f7c ( 24444) load
I (154) esp_image: segment 4: paddr=0x00020020 vaddr=0x400d0020 size=0x1678c ( 92044) map
0x400d0020: _stext at ??:?

I (189) esp_image: segment 5: paddr=0x000367b4 vaddr=0x4008637c size=0x05068 ( 20584) load
0x4008637c: xQueueGenericCreate at /home/andy/esp/esp-idf/components/freertos/queue.c:388

I (204) boot: Loaded app from partition at offset 0x10000
I (204) boot: Disabling RNG early entropy source...
I (205) cpu_start: Pro cpu up.
I (208) cpu_start: Application information:
I (213) cpu_start: Project name:     esp32-ds18b20-example
I (219) cpu_start: App version:      33fcdd2-dirty
I (225) cpu_start: Compile time:     May  2 2020 21:35:20
I (231) cpu_start: ELF file SHA256:  e5b8ae4f065bf036...
I (237) cpu_start: ESP-IDF:          v4.2-dev-1235-g71dc5eb27
I (243) cpu_start: Starting app cpu, entry point is 0x4008112c
0x4008112c: call_start_cpu1 at /home/andy/esp/esp-idf/components/esp32/cpu_start.c:286

I (0) cpu_start: App cpu up.
D (254) memory_layout: Checking 7 reserved memory ranges:
D (259) memory_layout: Reserved memory range 0x3ffae000 - 0x3ffae6e0
D (265) memory_layout: Reserved memory range 0x3ffb0000 - 0x3ffb2b90
D (272) memory_layout: Reserved memory range 0x3ffe0000 - 0x3ffe0440
D (278) memory_layout: Reserved memory range 0x3ffe3f20 - 0x3ffe4350
D (285) memory_layout: Reserved memory range 0x40070000 - 0x40078000
D (291) memory_layout: Reserved memory range 0x40078000 - 0x40080000
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

D (297) memory_layout: Reserved memory range 0x40080000 - 0x4008b3e4
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

D (304) memory_layout: Building list of available memory regions:
D (310) memory_layout: Available memory region 0x3ffae6e0 - 0x3ffb0000
D (317) memory_layout: Available memory region 0x3ffb2b90 - 0x3ffb8000
D (323) memory_layout: Available memory region 0x3ffb8000 - 0x3ffc0000
D (330) memory_layout: Available memory region 0x3ffc0000 - 0x3ffc2000
D (336) memory_layout: Available memory region 0x3ffc2000 - 0x3ffc4000
D (343) memory_layout: Available memory region 0x3ffc4000 - 0x3ffc6000
D (350) memory_layout: Available memory region 0x3ffc6000 - 0x3ffc8000
D (356) memory_layout: Available memory region 0x3ffc8000 - 0x3ffca000
D (363) memory_layout: Available memory region 0x3ffca000 - 0x3ffcc000
D (369) memory_layout: Available memory region 0x3ffcc000 - 0x3ffce000
D (376) memory_layout: Available memory region 0x3ffce000 - 0x3ffd0000
D (383) memory_layout: Available memory region 0x3ffd0000 - 0x3ffd2000
D (389) memory_layout: Available memory region 0x3ffd2000 - 0x3ffd4000
D (396) memory_layout: Available memory region 0x3ffd4000 - 0x3ffd6000
D (402) memory_layout: Available memory region 0x3ffd6000 - 0x3ffd8000
D (409) memory_layout: Available memory region 0x3ffd8000 - 0x3ffda000
D (416) memory_layout: Available memory region 0x3ffda000 - 0x3ffdc000
D (422) memory_layout: Available memory region 0x3ffdc000 - 0x3ffde000
D (429) memory_layout: Available memory region 0x3ffde000 - 0x3ffe0000
D (435) memory_layout: Available memory region 0x3ffe0440 - 0x3ffe3f20
D (442) memory_layout: Available memory region 0x3ffe4350 - 0x3ffe8000
D (449) memory_layout: Available memory region 0x3ffe8000 - 0x3fff0000
D (455) memory_layout: Available memory region 0x3fff0000 - 0x3fff8000
D (462) memory_layout: Available memory region 0x3fff8000 - 0x3fffc000
D (468) memory_layout: Available memory region 0x3fffc000 - 0x40000000
D (475) memory_layout: Available memory region 0x4008b3e4 - 0x4008c000
D (482) memory_layout: Available memory region 0x4008c000 - 0x4008e000
D (488) memory_layout: Available memory region 0x4008e000 - 0x40090000
D (495) memory_layout: Available memory region 0x40090000 - 0x40092000
D (501) memory_layout: Available memory region 0x40092000 - 0x40094000
D (508) memory_layout: Available memory region 0x40094000 - 0x40096000
D (514) memory_layout: Available memory region 0x40096000 - 0x40098000
D (521) memory_layout: Available memory region 0x40098000 - 0x4009a000
D (528) memory_layout: Available memory region 0x4009a000 - 0x4009c000
D (534) memory_layout: Available memory region 0x4009c000 - 0x4009e000
D (541) memory_layout: Available memory region 0x4009e000 - 0x400a0000
I (548) heap_init: Initializing. RAM available for dynamic allocation:
D (555) heap_init: New heap initialised at 0x3ffae6e0
I (560) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (566) heap_init: New heap initialised at 0x3ffb2b90
I (571) heap_init: At 3FFB2B90 len 0002D470 (181 KiB): DRAM
I (577) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (584) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (590) heap_init: New heap initialised at 0x4008b3e4
I (595) heap_init: At 4008B3E4 len 00014C1C (83 KiB): IRAM
I (601) cpu_start: Pro cpu start user code
D (613) clk: RTC_SLOW_CLK calibration value: 3333069
D (623) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (623) intr_alloc: Connected src 17 to int 3 (cpu 0)
D (624) intr_alloc: Connected src 24 to int 9 (cpu 0)
D (629) FLASH_HAL: extra_dummy: 1
D (632) spi_flash: trying chip: issi
D bus_lock: SPI dev changed from 0 to 0
D (639) spi_flash: trying chip: gd
D bus_lock: SPI dev changed from 0 to 0
I (646) spi_flash: detected chip: gd
D bus_lock: SPI dev changed from 0 to 0
I (654) spi_flash: flash io: dio
D bus_lock: SPI dev changed from 0 to 0
I (662) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (0) cpu_start: Starting scheduler on APP CPU.
D (677) heap_init: New heap initialised at 0x3ffe0440
D (687) heap_init: New heap initialised at 0x3ffe4350
D (697) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (2697) intr_alloc: Connected src 47 to int 13 (cpu 0)
D (2697) owb: use_crc 1
Find devices:
Found 0 devices
D (2737) rmt: RMT[0] ERR
D (2737) rmt: status: 0x0c000000
D (2737) rmt: RMT[0] ERR
D (2737) rmt: status: 0x0c000000
D (2737) rmt: RMT[0] ERR
D (2737) rmt: status: 0x00000000
D (2767) owb: state.last_discrepancy 0, state.last_device_flag 0, is_found 0
D (2767) owb: rom code not found
Device 1502162ca5b2ee28 is not present
D (2777) ds18b20: ds18b20_check_for_parasite_power
D (2777) rmt: RMT[0] ERR
D (2777) rmt: status: 0x08000001
D (2777) rmt: RMT[0] ERR
D (2777) rmt: status: 0x00000000
D (2817) ds18b20: owb_reset OK
D (2817) owb: owb_write_byte: cc
D (2867) ds18b20: owb_write_byte(ROM_SKIP) OK
D (2867) owb: owb_write_byte: b4
D (2917) ds18b20: owb_write_byte(POWER_SUPPLY_READ) OK
D (2917) rmt: RMT[0] ERR
D (2917) rmt: status: 0x0c000000
D (2917) rmt: RMT[0] ERR
D (2917) rmt: status: 0x08000002
D (2917) rmt: RMT[0] ERR
D (2917) rmt: status: 0x00000000
D (2927) owb: owb_read_bit: 00
D (2927) ds18b20: owb_read_bit OK: 0x00
Parasitic-powered devices detectedD (2937) owb: use_parasitic_power 1

No DS18B20 devices detected!
Restarting now.
DavidAntliff commented 4 years ago

Thanks for the log. I haven't tested this code with IDF 4.2 yet, I will do that in the near future. If you can try it with v3.3 or v4.1-beta1 that will be helpful as I've tested that earlier.

Looking at the log, I can see that owb_search_first returned found as false, meaning that it didn't detect any devices on the bus at all. Can you try changing line 63 in app_main.c from this:

owb_search_first(owb, &search_state, &found);

To this:

printf("owb_search_first returned %d\n", owb_search_first(owb, &search_state, &found));

Depending on what that returns, I may need to create a special branch with extra debugging for you to try.

I also notice that the rmt component, which is an IDF module, is printing ERR in the console - I haven't seen that before. It may be an IDF 4.2 issue.

One last observation, but may be clouded by the RMT issue - the parasitic power detection is seeing the data line pulled low (usually by the DS18B20 devices), but you have VDD power supplied to the DS18B20, is that right? However if RMT isn't working properly then this may just be a consequence of that.

physiii commented 4 years ago

I can find the device and read temperature values on v4.1 so something broke when upgrading to v4.2

I moved back to v4.2 and changed to printf("owb_search_first returned %d\n", owb_search_first(owb, &search_state, &found));

I can now read the temperature now on v4.2 (see output below) but if I change the log verbosity back to Warning then no devices are detected.

It's strange that changing log modes would fix/break this issue? Ideas?

Output:

I (28) boot: ESP-IDF v4.2-dev-1320-g1aebfdf6a-dirty 2nd stage bootloader
I (28) boot: compile time 06:48:34
I (30) boot: chip revision: 1
I (33) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (40) boot.esp32: SPI Speed      : 40MHz
I (45) boot.esp32: SPI Mode       : DIO
I (50) boot.esp32: SPI Flash Size : 8MB
I (54) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (63) boot: ## Label            Usage          Type ST Offset   Length
I (70) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (78) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (85) boot:  2 factory          factory app      00 00 00010000 00100000
I (93) boot: End of partition table
I (97) boot_comm: chip revision: 1, min. application chip revision: 0
I (104) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x078a0 ( 30880) map
I (125) esp_image: segment 1: paddr=0x000178c8 vaddr=0x3ffb0000 size=0x021dc (  8668) load
I (129) esp_image: segment 2: paddr=0x00019aac vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

I (134) esp_image: segment 3: paddr=0x00019eb4 vaddr=0x40080400 size=0x06164 ( 24932) load
I (153) esp_image: segment 4: paddr=0x00020020 vaddr=0x400d0020 size=0x167fc ( 92156) map
0x400d0020: _stext at ??:?

I (188) esp_image: segment 5: paddr=0x00036824 vaddr=0x40086564 size=0x04b54 ( 19284) load
0x40086564: cpu_ll_get_core_id at /home/andy/esp/esp-idf/components/soc/src/esp32/include/hal/cpu_ll.h:35 (discriminator 3)
 (inlined by) xPortGetCoreID at /home/andy/esp/esp-idf/components/freertos/include/freertos/portable.h:205 (discriminator 3)
 (inlined by) xTaskIncrementTick at /home/andy/esp/esp-idf/components/freertos/tasks.c:2576 (discriminator 3)

I (203) boot: Loaded app from partition at offset 0x10000
I (203) boot: Disabling RNG early entropy source...
I (203) cpu_start: Pro cpu up.
I (207) cpu_start: Application information:
I (212) cpu_start: Project name:     esp32-ds18b20-example
I (218) cpu_start: App version:      33fcdd2-dirty
I (223) cpu_start: Compile time:     May  3 2020 06:48:29
I (229) cpu_start: ELF file SHA256:  059906b1d20ed61d...
I (235) cpu_start: ESP-IDF:          v4.2-dev-1320-g1aebfdf6a-dirty
I (242) cpu_start: Starting app cpu, entry point is 0x40081108
0x40081108: call_start_cpu1 at /home/andy/esp/esp-idf/components/esp32/cpu_start.c:286

I (0) cpu_start: App cpu up.
D (253) memory_layout: Checking 7 reserved memory ranges:
D (258) memory_layout: Reserved memory range 0x3ffae000 - 0x3ffae6e0
D (264) memory_layout: Reserved memory range 0x3ffb0000 - 0x3ffb2a70
D (271) memory_layout: Reserved memory range 0x3ffe0000 - 0x3ffe0440
D (277) memory_layout: Reserved memory range 0x3ffe3f20 - 0x3ffe4350
D (283) memory_layout: Reserved memory range 0x40070000 - 0x40078000
D (290) memory_layout: Reserved memory range 0x40078000 - 0x40080000
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

D (296) memory_layout: Reserved memory range 0x40080000 - 0x4008b0b8
0x40080000: _WindowOverflow4 at /home/andy/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730

D (303) memory_layout: Building list of available memory regions:
D (309) memory_layout: Available memory region 0x3ffae6e0 - 0x3ffb0000
D (316) memory_layout: Available memory region 0x3ffb2a70 - 0x3ffb8000
D (322) memory_layout: Available memory region 0x3ffb8000 - 0x3ffc0000
D (329) memory_layout: Available memory region 0x3ffc0000 - 0x3ffc2000
D (335) memory_layout: Available memory region 0x3ffc2000 - 0x3ffc4000
D (342) memory_layout: Available memory region 0x3ffc4000 - 0x3ffc6000
D (348) memory_layout: Available memory region 0x3ffc6000 - 0x3ffc8000
D (355) memory_layout: Available memory region 0x3ffc8000 - 0x3ffca000
D (362) memory_layout: Available memory region 0x3ffca000 - 0x3ffcc000
D (368) memory_layout: Available memory region 0x3ffcc000 - 0x3ffce000
D (375) memory_layout: Available memory region 0x3ffce000 - 0x3ffd0000
D (381) memory_layout: Available memory region 0x3ffd0000 - 0x3ffd2000
D (388) memory_layout: Available memory region 0x3ffd2000 - 0x3ffd4000
D (395) memory_layout: Available memory region 0x3ffd4000 - 0x3ffd6000
D (401) memory_layout: Available memory region 0x3ffd6000 - 0x3ffd8000
D (408) memory_layout: Available memory region 0x3ffd8000 - 0x3ffda000
D (414) memory_layout: Available memory region 0x3ffda000 - 0x3ffdc000
D (421) memory_layout: Available memory region 0x3ffdc000 - 0x3ffde000
D (428) memory_layout: Available memory region 0x3ffde000 - 0x3ffe0000
D (434) memory_layout: Available memory region 0x3ffe0440 - 0x3ffe3f20
D (441) memory_layout: Available memory region 0x3ffe4350 - 0x3ffe8000
D (447) memory_layout: Available memory region 0x3ffe8000 - 0x3fff0000
D (454) memory_layout: Available memory region 0x3fff0000 - 0x3fff8000
D (461) memory_layout: Available memory region 0x3fff8000 - 0x3fffc000
D (467) memory_layout: Available memory region 0x3fffc000 - 0x40000000
D (474) memory_layout: Available memory region 0x4008b0b8 - 0x4008c000
D (480) memory_layout: Available memory region 0x4008c000 - 0x4008e000
D (487) memory_layout: Available memory region 0x4008e000 - 0x40090000
D (494) memory_layout: Available memory region 0x40090000 - 0x40092000
D (500) memory_layout: Available memory region 0x40092000 - 0x40094000
D (507) memory_layout: Available memory region 0x40094000 - 0x40096000
D (513) memory_layout: Available memory region 0x40096000 - 0x40098000
D (520) memory_layout: Available memory region 0x40098000 - 0x4009a000
D (527) memory_layout: Available memory region 0x4009a000 - 0x4009c000
D (533) memory_layout: Available memory region 0x4009c000 - 0x4009e000
D (540) memory_layout: Available memory region 0x4009e000 - 0x400a0000
I (546) heap_init: Initializing. RAM available for dynamic allocation:
D (554) heap_init: New heap initialised at 0x3ffae6e0
I (559) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (565) heap_init: New heap initialised at 0x3ffb2a70
I (570) heap_init: At 3FFB2A70 len 0002D590 (181 KiB): DRAM
I (576) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (583) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (589) heap_init: New heap initialised at 0x4008b0b8
I (594) heap_init: At 4008B0B8 len 00014F48 (83 KiB): IRAM
I (600) cpu_start: Pro cpu start user code
D (612) clk: RTC_SLOW_CLK calibration value: 3345459
D (622) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (622) intr_alloc: Connected src 17 to int 3 (cpu 0)
D (623) intr_alloc: Connected src 24 to int 9 (cpu 0)
D (628) FLASH_HAL: extra_dummy: 1
D (631) spi_flash: trying chip: issi
D (635) spi_flash: trying chip: gd
I (638) spi_flash: detected chip: gd
I (642) spi_flash: flash io: dio
I (646) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (0) cpu_start: Starting scheduler on APP CPU.
D (662) heap_init: New heap initialised at 0x3ffe0440
D (672) heap_init: New heap initialised at 0x3ffe4350
D (682) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (2682) intr_alloc: Connected src 47 to int 13 (cpu 0)
D (2682) owb: use_crc 1
Find devices:
owb_search_first returned 0
  0 : 270316977930e328
Found 1 device
D (2712) owb: owb_read_bytes, len 8:
D (2712) owb: 28 e3 30 79 97 16 03 27 
D (2712) owb: buffer 0x28, crc 0xe1, len 8
D (2712) owb: buffer 0xe3, crc 0xbc, len 7
D (2712) owb: buffer 0x30, crc 0x2f, len 6
D (2722) owb: buffer 0x79, crc 0x06, len 5
D (2722) owb: buffer 0x97, crc 0x4f, len 4
D (2732) owb: buffer 0x16, crc 0x47, len 3
D (2732) owb: buffer 0x03, crc 0x27, len 2
D (2732) owb: buffer 0x27, crc 0x00, len 1
D (2742) owb: rom_code 270316977930e328
Single device 270316977930e328 present
D (2752) ds18b20: malloc 0x3ffb37a4
Single device optimisations enabled
D (2752) ds18b20: scratchpad read: CRC 0, count 5
D (2762) owb: owb_write_byte: cc
D (2762) owb: owb_write_byte: be
D (2772) owb: owb_read_bytes, len 5:
D (2772) owb: 5d 01 55 05 7f 
D (2772) ds18b20: 5d 01 55 05 7f 
D (2772) ds18b20: No CRC check
D (2782) ds18b20: Resolution read as 12
D (2782) ds18b20: use_crc 1
D (2782) ds18b20: scratchpad read: CRC 1, count 9
D (2792) owb: owb_write_byte: cc
D (2792) owb: owb_write_byte: be
D (2802) owb: owb_read_bytes, len 9:
D (2802) owb: 5d 01 55 05 7f a5 a5 66 13 
D (2802) ds18b20: 5d 01 55 05 7f a5 a5 66 13 
D (2812) owb: buffer 0x5d, crc 0x26, len 9
D (2812) owb: buffer 0x01, crc 0xa0, len 8
D (2822) owb: buffer 0x55, crc 0x4b, len 7
D (2822) owb: buffer 0x05, crc 0x59, len 6
D (2822) owb: buffer 0x7f, crc 0xfe, len 5
D (2832) owb: buffer 0xa5, crc 0xfb, len 4
D (2832) owb: buffer 0xa5, crc 0xc4, len 3
D (2842) owb: buffer 0x66, crc 0x13, len 2
D (2842) owb: buffer 0x13, crc 0x00, len 1
D (2852) ds18b20: CRC ok
D (2852) ds18b20: configuration value 0x7f
D (2852) owb: owb_write_byte: cc
D (2862) ds18b20: scratchpad write 3 bytes:
D (2862) ds18b20: 55 05 7f 
D (2862) owb: owb_write_byte: 4e
D (2872) owb: owb_write_bytes, len 3:
D (2872) owb: 55 05 7f 
D (2872) ds18b20: scratchpad read: CRC 1, count 9
D (2882) owb: owb_write_byte: cc
D (2882) owb: owb_write_byte: be
D (2892) owb: owb_read_bytes, len 9:
D (2892) owb: 5d 01 55 05 7f a5 a5 66 13 
D (2892) ds18b20: 5d 01 55 05 7f a5 a5 66 13 
D (2902) owb: buffer 0x5d, crc 0x26, len 9
D (2902) owb: buffer 0x01, crc 0xa0, len 8
D (2902) owb: buffer 0x55, crc 0x4b, len 7
D (2912) owb: buffer 0x05, crc 0x59, len 6
D (2912) owb: buffer 0x7f, crc 0xfe, len 5
D (2922) owb: buffer 0xa5, crc 0xfb, len 4
D (2922) owb: buffer 0xa5, crc 0xc4, len 3
D (2922) owb: buffer 0x66, crc 0x13, len 2
D (2932) owb: buffer 0x13, crc 0x00, len 1
D (2932) ds18b20: CRC ok
D (2942) ds18b20: Resolution set to 12 bits
D (2942) ds18b20: ds18b20_check_for_parasite_power
D (2952) ds18b20: owb_reset OK
D (2952) owb: owb_write_byte: cc
D (2952) ds18b20: owb_write_byte(ROM_SKIP) OK
D (2962) owb: owb_write_byte: b4
D (2962) ds18b20: owb_write_byte(POWER_SUPPLY_READ) OK
D (2962) owb: owb_read_bit: 01
D (2972) ds18b20: owb_read_bit OK: 0x01
D (2972) owb: use_parasitic_power 0
D (2982) owb: owb_write_byte: cc
D (2982) owb: owb_write_byte: 44
D (2982) ds18b20: wait for conversion: max 825 ms, 83 ticks
D (3002) owb: owb_read_bit: 00
D (3012) owb: owb_read_bit: 00
D (3022) owb: owb_read_bit: 00
D (3032) owb: owb_read_bit: 00
D (3042) owb: owb_read_bit: 00
D (3052) owb: owb_read_bit: 00
D (3062) owb: owb_read_bit: 00
D (3072) owb: owb_read_bit: 00
D (3082) owb: owb_read_bit: 00
D (3092) owb: owb_read_bit: 00
D (3102) owb: owb_read_bit: 00
D (3112) owb: owb_read_bit: 00
D (3122) owb: owb_read_bit: 00
D (3132) owb: owb_read_bit: 00
D (3142) owb: owb_read_bit: 00
D (3152) owb: owb_read_bit: 00
D (3162) owb: owb_read_bit: 00
D (3172) owb: owb_read_bit: 00
D (3182) owb: owb_read_bit: 00
D (3192) owb: owb_read_bit: 00
D (3202) owb: owb_read_bit: 00
D (3212) owb: owb_read_bit: 00
D (3222) owb: owb_read_bit: 00
D (3232) owb: owb_read_bit: 00
D (3242) owb: owb_read_bit: 00
D (3252) owb: owb_read_bit: 00
D (3262) owb: owb_read_bit: 00
D (3272) owb: owb_read_bit: 00
D (3282) owb: owb_read_bit: 00
D (3292) owb: owb_read_bit: 00
D (3302) owb: owb_read_bit: 00
D (3312) owb: owb_read_bit: 00
D (3322) owb: owb_read_bit: 00
D (3332) owb: owb_read_bit: 00
D (3342) owb: owb_read_bit: 00
D (3352) owb: owb_read_bit: 00
D (3362) owb: owb_read_bit: 00
D (3372) owb: owb_read_bit: 00
D (3382) owb: owb_read_bit: 00
D (3392) owb: owb_read_bit: 00
D (3402) owb: owb_read_bit: 00
D (3412) owb: owb_read_bit: 00
D (3422) owb: owb_read_bit: 00
D (3432) owb: owb_read_bit: 00
D (3442) owb: owb_read_bit: 00
D (3452) owb: owb_read_bit: 00
D (3462) owb: owb_read_bit: 00
D (3472) owb: owb_read_bit: 00
D (3482) owb: owb_read_bit: 00
D (3492) owb: owb_read_bit: 00
D (3502) owb: owb_read_bit: 00
D (3512) owb: owb_read_bit: 01
D (3512) ds18b20: conversion took at most 520 ms
D (3512) ds18b20: scratchpad read: CRC 1, count 9
D (3512) owb: owb_write_byte: cc
D (3512) owb: owb_write_byte: be
D (3522) owb: owb_read_bytes, len 9:
D (3522) owb: 5a 01 55 05 7f a5 a5 66 c3 
D (3522) ds18b20: 5a 01 55 05 7f a5 a5 66 c3 
D (3532) owb: buffer 0x5a, crc 0xa5, len 9
D (3532) owb: buffer 0x01, crc 0xce, len 8
D (3532) owb: buffer 0x55, crc 0x31, len 7
D (3542) owb: buffer 0x05, crc 0xdf, len 6
D (3542) owb: buffer 0x7f, crc 0xaf, len 5
D (3552) owb: buffer 0xa5, crc 0x7e, len 4
D (3552) owb: buffer 0xa5, crc 0x77, len 3
D (3552) owb: buffer 0x66, crc 0xc3, len 2
D (3562) owb: buffer 0xc3, crc 0x00, len 1
D (3562) ds18b20: CRC ok
D (3572) ds18b20: temp_LSB 0x5a, temp_MSB 0x01, temp 21.625000

Temperature readings (degrees C): sample 1
  0: 21.6    0 errors
D (3972) owb: owb_write_byte: cc
D (3972) owb: owb_write_byte: 44
D (3972) ds18b20: wait for conversion: max 825 ms, 83 ticks
D (3982) owb: owb_read_bit: 00
D (3992) owb: owb_read_bit: 00
D (4002) owb: owb_read_bit: 00
D (4012) owb: owb_read_bit: 00
D (4022) owb: owb_read_bit: 00
D (4032) owb: owb_read_bit: 00
D (4042) owb: owb_read_bit: 00
D (4052) owb: owb_read_bit: 00
D (4062) owb: owb_read_bit: 00
D (4072) owb: owb_read_bit: 00
D (4082) owb: owb_read_bit: 00
D (4092) owb: owb_read_bit: 00
D (4102) owb: owb_read_bit: 00
D (4112) owb: owb_read_bit: 00
D (4122) owb: owb_read_bit: 00
D (4132) owb: owb_read_bit: 00
D (4142) owb: owb_read_bit: 00
D (4152) owb: owb_read_bit: 00
D (4162) owb: owb_read_bit: 00
D (4172) owb: owb_read_bit: 00
D (4182) owb: owb_read_bit: 00
D (4192) owb: owb_read_bit: 00
D (4202) owb: owb_read_bit: 00
D (4212) owb: owb_read_bit: 00
D (4222) owb: owb_read_bit: 00
D (4232) owb: owb_read_bit: 00
D (4242) owb: owb_read_bit: 00
D (4252) owb: owb_read_bit: 00
D (4262) owb: owb_read_bit: 00
D (4272) owb: owb_read_bit: 00
D (4282) owb: owb_read_bit: 00
D (4292) owb: owb_read_bit: 00
D (4302) owb: owb_read_bit: 00
D (4312) owb: owb_read_bit: 00
D (4322) owb: owb_read_bit: 00
D (4332) owb: owb_read_bit: 00
D (4342) owb: owb_read_bit: 00
D (4352) owb: owb_read_bit: 00
D (4362) owb: owb_read_bit: 00
D (4372) owb: owb_read_bit: 00
D (4382) owb: owb_read_bit: 00
D (4392) owb: owb_read_bit: 00
D (4402) owb: owb_read_bit: 00
D (4412) owb: owb_read_bit: 00
D (4422) owb: owb_read_bit: 00
D (4432) owb: owb_read_bit: 00
D (4442) owb: owb_read_bit: 00
D (4452) owb: owb_read_bit: 00
D (4462) owb: owb_read_bit: 00
D (4472) owb: owb_read_bit: 00
D (4482) owb: owb_read_bit: 00
D (4492) owb: owb_read_bit: 01
D (4492) ds18b20: conversion took at most 520 ms
D (4492) ds18b20: scratchpad read: CRC 1, count 9
D (4492) owb: owb_write_byte: cc
D (4492) owb: owb_write_byte: be
D (4502) owb: owb_read_bytes, len 9:
D (4502) owb: 5c 01 55 05 7f a5 a5 66 50 
D (4502) ds18b20: 5c 01 55 05 7f a5 a5 66 50 
D (4512) owb: buffer 0x5c, crc 0x78, len 9
D (4512) owb: buffer 0x01, crc 0x64, len 8
D (4512) owb: buffer 0x55, crc 0xe0, len 7
D (4522) owb: buffer 0x05, crc 0xd6, len 6
D (4522) owb: buffer 0x7f, crc 0x33, len 5
D (4532) owb: buffer 0xa5, crc 0xcc, len 4
D (4532) owb: buffer 0xa5, crc 0xf9, len 3
D (4532) owb: buffer 0x66, crc 0x50, len 2
D (4542) owb: buffer 0x50, crc 0x00, len 1
D (4542) ds18b20: CRC ok
D (4552) ds18b20: temp_LSB 0x5c, temp_MSB 0x01, temp 21.750000I (28) boot: ESP-IDF v4.2-dev-1320-g1aebfdf6a-dirty 2nd stage bootloader
DavidAntliff commented 4 years ago

This is very strange - there must be some kind of timing issue that comes to light due to changes in 4.2. Changing the log level in menuconfig affects which debug code is included in the build (compile-time), so that enabling "debug" level but not actually enabling debug at run-time still has run-time checks against the debug flag, which takes a little time.

I will test with this version of the IDF as soon as I can.

When it doesn't work (compile-time debug level set to Warning), what is the return value of owb_search_first printed in the log?

DavidAntliff commented 4 years ago

From what I can see, v4.2 hasn't been released, it only exists as a pre-release branch (work in progress), so it's probably very unsafe to use. Perhaps you should use the latest release which is 3.3.2? https://github.com/espressif/esp-idf/releases/tag/v3.3.2

However I will see if I can pinpoint the issue - I'm using the 4.2 branch at commit https://github.com/espressif/esp-idf/commit/cd4fa46f5372a552a67452313d246d4d09d2b39f

DavidAntliff commented 4 years ago

I've been able to reproduce your observations with that commit above - definitely not working with the current state of the v4.2 branch. I also see it start working just by adding that printf line - bizarre...

DavidAntliff commented 4 years ago

@physiii can you try the master branch of this project please? I believe it should be fixed now with IDF v4.2-dev (the issue was in my code, not the IDF). If you can confirm that would be really helpful.

physiii commented 4 years ago

Nice! I'm getting temp values using v4.2

Thank you for getting this resolved.

adamCPP commented 2 years ago

Hello. I download Your lib via paltform IO library manager. Unfortunatly there has to be an old version because I have similar issue. My owb starts working only when I turned on mqtt client before ( probably some timing problems). Can You tell me what did You change to make it working ?

DavidAntliff commented 2 years ago

@adamCPP - the issue was some uninitialised variables in the esp32-owb component. If you make sure you have the latest commit on the master branch you should avoid this issue.

If you're already using the latest commit and seeing a problem, can you create a new issue and provide more details about what you are seeing, please?

adamCPP commented 2 years ago

You missunderstood me. I have installed latest version of owb directly from Your github and it's working fine. But my first attempt was installing via platformIo manager. This version contains bug descriped in this issue. It's brought me here to find solution. Version in platformIo lib menager is 2 years old. It should be updated to latest version. I don't know who put this lib in platform IO manager but I assumed it was You because You are the author. If I'm wrong then sorry for bodering You

DavidAntliff commented 2 years ago

Hi @adamCPP, ok, sorry, yes I did misunderstand you. I actually don't know much about platformio and even less about how the version manager works - perhaps @ivankravets could advise us?