💾 Archived View for gem.librehacker.com › gemlog › tech › 20220913-0.gmi captured on 2024-06-20 at 12:11:12. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

I²C Project: A Single Flipped Bit

I've been working on trying to get I²C comms working on Mecrisp Stellaris, using the built-in hardware module. I spent many lunch breaks seemingly going nowhere, because I couldn't get the Trellis LEDs to even turn on, and the signals did not look correct on the scope. After much looking at waveforms, reading the manuals, and inspecting code, I finally realized that the command bit in the IC_DATA_CMD register is 0 for write, and 1 for read, and not the other way around.

With that fix, I was immediately able to get the Trellis LEDs to turn on and to start blinking.

Some blurry proof the Trellis LEDs came on

Here is the first test waveform I got after applying the fix.

img/first_i2c_signals.png

The first half is

S 1 1 1 0 0 0 0 0 ACK

which is the START pulse, followed by the 7-bit device address $70, followed by the (now correct) command bit, followed by the acknowledgement bit. Then

0 0 1 0 0 0 0 1 ACK P

which is the command $21 (start Trellis oscillator) followed by the acknowledgement bit, followed by the STOP pulse.