This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
[Bug 1001397] I2C driver for Kinetic microcontrollers
- From: bugzilla-daemon at bugs dot ecos dot sourceware dot org
- To: ecos-patches at ecos dot sourceware dot org
- Date: Sat, 02 Mar 2013 18:08:18 +0000
- Subject: [Bug 1001397] I2C driver for Kinetic microcontrollers
- Auto-submitted: auto-generated
- References: <bug-1001397-104@http.bugs.ecos.sourceware.org/>
Please do not reply to this email, use the link below.
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397
--- Comment #40 from Mike Jones <mjones@linear.com> ---
Created attachment 2112
--> http://bugs.ecos.sourceware.org/attachment.cgi?id=2112&action=edit
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
errors.
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;
cyg_i2c_transaction_begin(&device);
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");
}
cyg_i2c_transaction_end(&device);
return input[0];
--
You are receiving this mail because:
You are on the CC list for the bug.