I connected the temperature sensor DS18B20.
My observations: delayMicroseconds() - does not work correctly.
pinMode(), digitalRead() - work very slowly.
I used the microDS18B20 library using HAL (changed the microOneWire.cpp file):
Temperature sensor connected to pin PB5
It seems you are using a custom firmware with functions you created yourself. We cannot fully support you on this however your issue could be related on how you setup the RCC of STM32WL (if you think it is timing related).
One wire library for DS18B20 will be supported by RUI3 on the next firmware release btw. There is no definite time yet though.
Setting up the RCC internal is done internally by RUI3 on the default firmware of RAK3172. We do not encourage users to mixed low level HAL modifications with the abstractions created by RUI3 specially RCC.
If ever you decide you want to create your own firmware using STM32WL SDK, we can only provide the necessary radio source files to update since examples of the SDK is based on Nucleo STM32WL Dev Board. Other peripheral setup will be handled by the you or your SW engineer/s.
On the oscilloscope, I do not see what should be.
If you increase the delay to 5ms, then at the output I see PWM with a period of 10ms. It doesn’t work with a small delay. Therefore, I concluded that either delay() was not working correctly, or digitalWrite() was too slow.
Unfortunately, I do not have access to devices. I did a job for a local university, the devices work well (only two). But I used RAKwireless RUI STM32 Boards v 3.5.3 for Arduino IDE. I correctly understood that along with the sketch, RUI3 is also uploaded?
I use pin PA12, so just need change WB_IO1 is PA12 right?
And need use resistor pull up or not?
Im try with pin PA11 and PA12 also, but not yet success.
Thanks to @ipssoft input, I changed the DS18B20 One Wire library to work with RAK3172 with any GPIO.
Tested with 2 sensors on 2 GPIO’s. Multiple sensors on 1 GPIO is not tested.
As this is a temporary solution (OneWire support is still on the task list of our R&D team), the library files are merged with the source codes in the project folder.