EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Bit-banging I2C

Started by Tim Wescott March 16, 2016
On 3/17/2016 11:12 AM, Tim Wescott wrote:
> > Yes, more or less.
A teacher in high school would never let us answer that way. "Which is it, more or less?" -- Rick
On Fri, 18 Mar 2016 02:12:00 -0400, rickman wrote:

> On 3/17/2016 11:12 AM, Tim Wescott wrote: >> >> Yes, more or less. > > A teacher in high school would never let us answer that way. "Which is > it, more or less?"
Well, then they need to get a real job and discover ambiguity. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 3/18/2016 1:55 PM, Tim Wescott wrote:
> On Fri, 18 Mar 2016 02:12:00 -0400, rickman wrote: > >> On 3/17/2016 11:12 AM, Tim Wescott wrote: >>> >>> Yes, more or less. >> >> A teacher in high school would never let us answer that way. "Which is >> it, more or less?" > > Well, then they need to get a real job and discover ambiguity.
Lol. I think you are showing some ignorance. If you think a teacher should encourage kids to speak ambiguously you definitely are not qualified for teaching. I think few in this business would be good teachers... especially if they feel teaching is not "a real job". His point was this was what he called, "waffle words" which are used to reduce the significance of what was being said. Better to find ways of speaking to emphasize what was being said. This all had no impact on many of the kids who had little interest in learning, but I learned a lot from his teaching methods. -- Rick
On 16/03/2016 2:49 PM, Tim Wescott wrote:
> Has anyone successfully bit-banged an I2C interface? Any comments on > it's ease or difficulty? > > I've used I2C with processors that have built-in hardware, I've sat next > to a guy who's bit-banged it, but I've never bit-banged it myself. > > I ask as a circuit designer who's going to design in an I2C chip to be > presented to a software engineer with a smile and a "here, this ought to > be easy!" I want to know whether I'll be honest or not. >
It is pretty easy. Read the spec think about it over night, a couple hours to implement and test. What we have found is we run across devices that don't always implement I2C protocols. w..
In article <hoKdnRCiZNQBN3TLnZ2dnUU7-TOdnZ2d@giganews.com>, 
seemywebsite@myfooter.really says...
> > Has anyone successfully bit-banged an I2C interface? Any comments on > it's ease or difficulty? > > I've used I2C with processors that have built-in hardware, I've sat next > to a guy who's bit-banged it, but I've never bit-banged it myself. > > I ask as a circuit designer who's going to design in an I2C chip to be > presented to a software engineer with a smile and a "here, this ought to > be easy!" I want to know whether I'll be honest or not.
Most code and testing of interface (with full timing and checking basic reading/writing device) for compliance worst case 2 days on a hardware mock up on a Eval board with a sample device. Anything beyond that is problems due to MCU and/or device specification 'issues', or lack of understanding. Assuming you have already worked out how to use the MCU in question. Having done all forms of I2C and SPI as from MCU hardware controllers, NXP I2C controllers, FPGA master and slave devices, software bit bang on MCU's and even back in day from PC printer port using Windows for Workgroups. One device was FPGA EEPROM emulator capable of I2C over 2MHz. Many other have posted many things to look at out far I would add 1/ reset on device, if Software bit banging have a way of resetting the device whether SPI or I2C, when software bit banging nothing like debug, actual bug, or even whilst uploading new code to screw up random clock sequences. Having debugged many devices. 2/ Making sure device can work with irregular clock drive, so many devices fail when they expect an exact regular clock. I2C and SPI do NOT need an exact clock as they are stateful bit operations. 3/ Will device do proper reset from 9 clock pulses and stop condition I2C spec reset many devices fails. 4/ Any software should check the ACTUAL pin voltages as often as possible even with one device a shorted I2C or SPI pin is a pain. 5/ Does your device nee an I2C Restart state which is slightly different to Start and make sure software/hardware can cope with it. There are plenty of software bit bang examples I2C and SPI around as starting point. Plenty also of FPGA code. I have always reviewed these examples as often they are lacking, but a good staring point. Having dealt with many devices generally I2C is easier, many issues with SPI controllers ranging from only do bytes or multiples, screwing up Chip selects, getting byte orders to match..... -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.pcserviceselectronics.co.uk/pi/> Raspberry Pi Add-ons <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font <http://www.badweb.org.uk/> For those web sites you hate
Tim Wescott wrote:
> On Fri, 18 Mar 2016 02:12:00 -0400, rickman wrote: > >> On 3/17/2016 11:12 AM, Tim Wescott wrote: >>> >>> Yes, more or less. >> >> A teacher in high school would never let us answer that way. "Which is >> it, more or less?" > > Well, then they need to get a real job and discover ambiguity. >
Well... maybe. -- Les Cargill
On Wednesday, March 16, 2016 at 5:10:36 PM UTC-7, Clifford Heath wrote:
> On 17/03/16 05:49, Tim Wescott wrote: > > Has anyone successfully bit-banged an I2C interface? Any comments on > > it's ease or difficulty? > > > > I've used I2C with processors that have built-in hardware, I've sat next > > to a guy who's bit-banged it, but I've never bit-banged it myself. > > > > I ask as a circuit designer who's going to design in an I2C chip to be > > presented to a software engineer with a smile and a "here, this ought to > > be easy!" I want to know whether I'll be honest or not. > > Not I2C, but I've bitbanged One-Wire, including enumeration (though not > high-speed), in an MSP430. I assume this relates to your battery gauge > question? If so, I'd think One-Wire was preferable - only one pin to diddle.
So, we are trying to do one-wire with a PC class (linux) master and FPGA slave. The master has file system I/O interface. We can do the protocol as slow as possible.
> However, to get bit timings right, the important question is whether you > can afford to stop the world while doing a data transfer. Trying to > interrupt for each bit transition might be too hard. I guess you > wouldn't need to read the gas gauge very often - perhaps you can pick a > time when you can lock out all other interrupts?
Yes, we will have to disable interrupts a few msec at a time.

The 2024 Embedded Online Conference