Have you tried this?
https://forum.seeedstudio.com/t/xiao-with-ds18b20-sensor/265458/8?u=pj_glasso
board package 1.0.0 from the Board Manager’s “Seeed nRF52 mbed-enabled Boards”
I would try the maximWire LIb…
Matsutei
Nov '22
I had the same problem. XIAO nRF52840 jammed every time I tried to use OneWire.h library.
Found today MaximWire that doesn’t need OneWire library. Got it via Library Manager
Example DiscoveryDevices.ino worked right a way.
MaximWire can also be found here in Github with examples: GitHub - adameat/MaximWire: MaximWire library for Arduino 33 BLE and DS18B20 sensor 5
Adding this line to other examples, they also started to work for me:
#define MAXIMWIRE_EXTERNAL_PULLUP
Without the line it looked like the bus pin stayd in input status, as it wasn’t able to pull the line down. Adding the line, the pin was able to drive the one wire bus.
Many thanks to ADAMEAT.
HTH
GL PJ