This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129XNCZAD: one-wire interface not working

Part Number: TM4C129XNCZAD

I have a custom printed circuit board that uses PG6 on a TM4C129XNCZAD to talk to a serial EEPROM using the one-wire protocol. I am using the following test code:

static bool busIsBusy(void)
{
    UInt32 busStatus = OneWireBusStatus(ONE_WIRE_BASE);
    return (0 != (busStatus & ONEWIRE_BUS_STATUS_BUSY));
}


void ONE_WIRE_debug(void)
{
    SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOG );
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOG))
    {
    }

    SysCtlPeripheralEnable(SYSCTL_PERIPH_ONEWIRE0);
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ONEWIRE0))
    {
    }

    GPIOPinConfigure  ( GPIO_PG6_OWIRE );
    GPIOPinTypeOneWire( GPIO_PORTG_BASE, GPIO_PIN_6 );
    OneWireInit( ONEWIRE0_BASE, 
                 ONEWIRE_INIT_SPD_OD    // overdrive speed bus timing
               );

    // wait for init to complete
    while (busIsBusy());

    while (1)
    {
        OneWireBusReset(ONEWIRE0_BASE);
        sysDelayMilliseconds(5);
    }
}

The code executes the loop where OneWireReset() is continually invoked, but I do not see any signals coming out on PG6.

I am using a logic analyzer that has one-wire protocol decoding built-in. I have it set to trigger on a high-to-low transition, but it never sees one.

I modified the code to configure PG6 as a GPIO output, and sent out low-going pulses periodically in a loop. In that case, the logic analyzer sees the signal, and correctly decodes it as a reset.

Any idea what I might be doing wrong when configuring the pin for one-wire? I think I followed the sample code in the TivaWare manual.

Thanks,

Dave

  • Is the output of PG6 stuck high or low when you do this test? If stuck low, what value of pull-up resistor did you use?
  • Thanks for the quick response, Bob. The bus seems to be stuck low. I looked on the schematic for a pull-up, but could not find one. I will have to check with the hardware engineer who designed the board to see whether I am missing something.

    I did find something confusing in the chip datasheet, though:

    22.3 Functional Description

    1-Wire is a simple single-wire communication interface comprising a wire protocol, transport protocol, and base session protocols (as well as some basic commands). The wire protocol generates 0s and 1s by varying the time the line is held low (it is pulled up by a resistor). The TM4C129XNCZAD microcontroller is the master and controls the line at all times. A pull-up keeps the line parked high and the microcontroller driver is assumed to be normal open-drain. No special GPIO configuration is needed here since the open-drain support is taken care of outside of the microcontroller. See Table 10-4 on page 789 for pin configuration information. Data can be both read and written on the same 1-Wire pin. The 1-Wire module supports the most basic aspects of the protocol, including wire protocol, byte transport control and line reset. Software is expected to handle the session protocol, including selection of a slave (when more than one is on the same line) and higher level commands.

    I checked the source code for GPIOPinTypeOneWire() and it seems to set the port for push-pull operation instead of open drain. Is that the proper configuration?

    Regards,

    Dave

  • Hi, Bob,


    The HW engineer confirmed that he neglected to add the pull-up resistor. I got a reworked board, and the one-wire bus appears to be working properly now. Thanks for your help.

    Regards,

    Dave
  • That statement is a bit confusing. What is intended is that when you choose 1-wire as the alternate function, the pin is forced to open drain mode regardless of the state of the pad configuration registers.
  • OK, thanks!

    Regards,

    Dave