June 23, 2026

The Dallas 1-wire protocol saga -- trouble with the Kyu GPIO

I code up a scope loop and use "i 19" to launch it once Kyu boots. I see pulses briefly, then the display goes to a constant 3.3 volts even though the loop continues to run.

After some thought, I disable to only other thing using GPIO calls. This is the "for fun" LED blink loop that blinks the two onboard LED to provide a light show. Once I disable this, my scope loop on GPIO A8 runs just fine. Somehow the light show interferes with the scope loop I just wrote.

The light show code is in main.c in h5_blinker(). This makes calls to status_off(), status_on(), along with pwr_on() and pwr_off(). These call gpio_set_bit() and gpio_clear_bit(). These call gpio_output() which accesses the gpio data register as follows:

	if ( val )
        gp->data |= 1 << pin;
    else
        gp->data &= ~(1 << pin);
This does not look like it would change any bit values other than the one of interest, but somethine unexpected is going on. The data register is a 32 bit value and is declared "volatile unsigned".

With the scope loop running, the timing looks pretty good. I get a nice 10 us both down and up. The signal drops fast when it goes low, but takes nearly a full us to rise when the drive is switched off.

Other problems

Something is wrong with tne network code. Packets are being received, but are piling up in the IP queue:
Packets in IP queue: 122
Emac rx_count: 221
Emac tx_count: 86
The board does not respond to ping.

The answer to this is simple! The scope loop is hogging the CPU and running at higher priority than the network code.

port C doesn't seem to work

I tried using bits in the C gpio and none seemed to work. This is some kind of Kyu problem and has nothing in particular to do with the one-wire driver. I will just ignore it for now, but should look into it someday. I thought there might be a separate clock/power control bit for gpio C, but this is not the case. There is one clock control gating bit for the entire port controller.


Have any comments? Questions? Drop me a line!

Tom's software pages / tom@mmto.org