This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Interfacing of DS18B20 with nRF52840

Hello All, 

I'm interfacing a temperature sensor ds18b20 with nFR52840, which uses one wire protocol. 

I'm using this repo https://github.com/DSysoletin/nrf52_ds18b20_example to read the sensor. 

To read the sensor correctly - I have to connect an external pul up resistor - 4.7k, 10k, 15k - all works fine. 

Connecting an external resistor is making assembly difficult and will add to BOM. 

So, I'm trying to enable internal pull ups available in nFRF52840 chip which is approax 11k. But I'm not able to read sensor by enabling internal pull up. 

In the above mentioned repo, I'm replacing 

nrf_gpio_cfg_input(DS18B20PIN, NRF_GPIO_PIN_NOPULL); 

with 

nrf_gpio_cfg_input(DS18B20PIN,NRF_GPIO_PIN_PULLUP);

Can anyone point out the reason why is it not working ? 

Thanks. 

  

  

  • Hello,

    To read the sensor correctly - I have to connect an external pul up resistor - 4.7k, 10k, 15k - all works fine. 

    Connecting an external resistor is making assembly difficult and will add to BOM. 

    So, I'm trying to enable internal pull ups available in nFRF52840 chip which is approax 11k. But I'm not able to read sensor by enabling internal pull up. 

    Do you have access to a logic analyzer?
    It would be very helpful to have a look at a trace of the communication, to see what might be the difference between the two configurations.

    In the above mentioned repo, I'm replacing 

    nrf_gpio_cfg_input(DS18B20PIN, NRF_GPIO_PIN_NOPULL); 

    with 

    nrf_gpio_cfg_input(DS18B20PIN,NRF_GPIO_PIN_PULLUP);

    Can anyone point out the reason why is it not working ? 

    Does the sensor's datasheet mention anything about the required waveform on the received signal?
    Could it be that it is expecting / sensing for a steep transition from high to low, which is not necessarily the case, since when the code moves to do a write it reconfigures the pin to output ( thus disabling the pullup ), before being set to 0. So, the transition will go from floating to GND, not from VDD to GND.
    This should be very easy to verify with a logic trace of the communication.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Related