Connection required for using Zephyr 1-wire driver on nrf52840DK

Hello,

I am trying to understand how to use the Zephyr 1-wire driver on nrf52840. I see from the "scanner" sample of the w1-serial driver that it supports the nrf52840DK, however, the sample readme does not provide a description of the hardware connections required. As I understand, this driver uses the UART module, and I understand the Tx and Rx pins have to be shorted by a 470k resistor or a Schottky diode, before it can be connected to a 1-wire device such as Dallas DS28E05 EEPROM.

Could you please confirm that this is required to be done? Also, would it be possible to have a simple workaround by assigning the Tx and Rx to the same pin in a DTS overlay? This would avoid the need for hardware modifications.

My ultimate aim is to get the w1-serial driver working on a custom board that a customer has provided, on which the DS28E05 is already wired to a GPIO pin (P0.5) of nrf52840. Previously, on the old bare-metal application software, there was a bit-banging driver that was used for this communication. My job is to port the old software to Zephyr, and I would like to use the proper Zephyr driver for this. Changing the hardware is not an option for me, as this board is already in production. If the only way to use the w1-serial driver is to wire up the Tx and Rx as above, I guess I would be forced to write a new Zephyr-compatibe version of the old bit-banging driver.

Thanks

regards

pnc 

Parents Reply Children
  • Hi Kenneth,

    I tried out the above idea with the following addition to the custom board definition of my custom nrf52840 board

    &uart1 {
        status = "okay";
        current-speed = <115200>;
        pinctrl-0 = <&uart1_default>;
        pinctrl-1 = <&uart1_sleep>;
        pinctrl-names = "default", "sleep";
        w1: w1 {
            compatible = "zephyr,w1-serial";
            status = "okay";
        };
    };
    &pinctrl {

        uart1_default: uart1_default {
            group1 {
                psels = <NRF_PSEL(UART_RX, 0, 5)>;
                bias-pull-up;
            };
            group2 {
                psels = <NRF_PSEL(UART_TX, 0, 5)>;
                nordic,drive-mode = <NRF_DRIVE_S0D1>;
            };
        };

        uart1_sleep: uart1_sleep {
            group1 {
                psels = <NRF_PSEL(UART_RX, 0, 5)>,
                    <NRF_PSEL(UART_TX, 0, 5)>;
                low-power-enable;
            };
        };

    Btw GPIO0.5 happens to be the pin to which the w1 device is connected on my board (with a pull-up). As I mentioned earlier, previously this was being used by a bit-bashing bare metal driver

    It is building fine with the Zephyr w1 scanner sample, however, I am getting an IO error in uart_poll_in() in line 89 of w1_zephyr_serial.c (in the serial_tx_rx() function).

    Could you please verify if my approach is feasible, or if what I am trying to do is simply impossible? In that case, I guess I have no option but to go back to bit bashing and forget the serial_w1 driver, since, as I said, I am not in a position to change the board wiring. Would it be possible for you to try it out with the nrf52840DK? I do not have access that board, and perhaps it is just an issue with my custom board.

    thanks

    regards

    pnc

  • pnc2 said:
    if what I am trying to do is simply impossible?

    It's not been designed or intended to share pins the way you are trying no. So you should not expect this to work unfortunately. So unless you can update the board to use two pins, it looks like you need to use some kind of bit bashing yes.

    Best regards,
    Kenneth

Related