This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001397] I2C driver for Kinetic microcontrollers

Please do not reply to this email, use the link below.

--- Comment #40 from Mike Jones <> ---
Created attachment 2112
Control clock rate, fix race condition, bug fix

This patch contains new code for managing clock speed that was added by Ilija.
He can provide a ChangeLog for that if desired. I tested/modified his code and
fixed bugs. There was a race condition that caused the driver to lockup if bits
were not set/cleared at the right time, and a few other small things. I don't
remember the exact changes any more without a fresh diff against the original
patch, but I remember the 3 days on the bench with a scope hunting it down :-)
The original author can diff against this version if desired. The actual bug
fixes are just a few lines of critical code.

I have run this on three PMBus devices extensively including a several day 24
hour telemetry run, meaning constant traffic reading and writing. There were no

If anyone wants to do more testing, I suggest testing something faster than
PMBus which maxes out at 400Khz.

In the future this could be improved to add API to manage SMBus features such
as the timeout mechanism. I don't have time at the moment to do that.

I suggest the original author (or others( apply the patch and test their
existing application. If nobody has any problems, I feel this code is safe to
commit to CVS.

Some example code:

const cyg_uint32 i2c_bus_time = 10000;

    cyg_i2c_device device = {                        \
            .i2c_bus        = &cyg_i2c0_bus,         \
            .i2c_address    = address,               \
            .i2c_flags      = 0,                     \
            .i2c_delay      = i2c_bus_time           \
    cyg_uint8 buffer[1];
    cyg_uint8 input[1];
    buffer[0] = command;

    if(!cyg_i2c_transaction_tx(&device, true, &buffer[0], 1, false)) {
        diag_printf("Read Byte: fail TX.\n");
    } else if(!cyg_i2c_transaction_rx(&device, true, &input[0], 1, true, true))
        diag_printf("Read Byte: fail RX.\n");

    return input[0];

You are receiving this mail because:
You are the assignee for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]