This is the mail archive of the ecos-bugs@sourceware.org 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 web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #39 from Mike Jones <mjones@linear.com> 2013-01-06 05:46:55 GMT ---
I am having trouble slowing down the bus speed.

This is my code for write byte, but it is clocking at over 1Mhz, and my devices
only go up to 400Khz.

Is there something else I need to do?

void smbus_write_byte(uint8_t address, uint8_t command, uint8_t data)
{
    cyg_uint8 buffer[2];
    cyg_i2c_device device = {                        \
            .i2c_bus        = &hal_kinetis_i2c0_bus, \
            .i2c_address    = address,               \
            .i2c_flags      = 0,                     \
            .i2c_delay      = 10000                  \
        };

    buffer[0] = command;
    buffer[1] = data;

    cyg_i2c_transaction_begin(&device);
    if(!cyg_i2c_transaction_tx(&device, true, &buffer[0], 2, false)) {
        diag_printf("Read: fail TX.\n");
    }

    cyg_i2c_transaction_stop(&device);
    cyg_i2c_transaction_end(&device);
}

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- 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]