Mbed OS 6.1+ bug?

Into Mbed Studio with Mbed OS 6.0.0 and a STM32F103RCBT6 board I am using the DS1820 (+ OneWire) library, data on PA_15. The target device is NUCLEO-F103RB. It works perfectly… also with ADS1015, FM25W256, RA8875 and MCP4822. When I upgrade to Mbed OS 6.1.0 or 6.2.0 the DS1820 does not work anymore : device not found. When I come back to Mbed OS 6.0.0 it works again. Any idea ?

Hello Alain,

Could you please tell us which DS1820 (+OneWire) library do you use?

Best regards, Zoltan

Hi Zoltan,
It is your library:
https://os.mbed.com/users/hudakz/code/DS1820/
Just removed the extra code and I confirm: it works with Mbed OS 6.0.0 but not with 6.2.0

Hello Alain,

Thank you for reporting the issue. I’ve modified the libraries to make them compatible also with Mbed OS 6.1.0 and 6.2.0. They should work now but if you still experience some issue(s) let me know. Thanks.

Best regards, Zoltan

Hi Zoltan,

With the updated libraries it works but only after a power off. With the reset button it does not work.

Best regards,

Alain

Hello Alain,

In case of one-wire the most critical thing is to meet the read time slot constrains.


First, the GPIO shall be pulled down for at least 1us. That’s easy to achieve by having the GPIO configured as ouput and writing a 0 to it.
Then the GPIO has to be reconfigured from output to input. This will release the bus and let the DS1820 either keep it down (indicated as Master read “0” slot in the picture above) or pull the bus up (indicated as Master read “1” slot in the picture above). The read operation (indicated as ‘Master samples’ in the picture above) shall be accomplished as close to the end of a 15 us time frame as possible. Unfortunately, on some ARM targets the GPIO transition from output to input takes quite a long time. When it exceeds 15 us it could render the given MCU unusable for the one-wire bus. However, my experience is that some DS1820 sensors are able to operate at sample point beyond the 15 us time frame.

To improve the library the transition time from output to input of the selected GPIO is now measured in the constructor. If it exceeds the sample point (defaults to 13 us) a runtime error is reported. For example:

++ MbedOS Error Info ++
Error Status: 0x80FF0144 Code: 324 Module: 255
Error Message: Assertion failed: _out_to_in_transition_us < _sample_point_us
...

It is now also possible to modify the sample point (defaults to 13 us) by passing a second parameter in the OneWire constructor:

OneWire  oneWire(D8, 15);  // sample point set to 15 us

or in the DS1820 constructor:

DS1820  ds1820(D8, 15);  // sample point set to 15 us

Best regards, Zoltan

Hi Zoltan,
Many thanks for the explanations. After your last modification it works now perfectly on Mbed OS 6.2.0. After a power on or a reset it does the job for hours. Good!

Regards,

Alain