The Freescale ColdFire V2 (MCF52259) is a great communication device: an embedded Processor like a Swiss Army Knife: Great peripherals, USB and Ethernet interface, a lot of flash application space and up to 64 KByte of RAM. I’m using that core in many projects, and there is great community support for it with boards and software. Unfortunately Freescale somehow provides Processor Expert support only half way for it. Support for the I2C bus is missing :-(.
For other cores like the HCS08 Freescale offers a Hardware I2C Processor Expert component. That’s fast and efficient, but requires one or more I2C peripheral on the device. What if you do not have this or if you need to use different pins for your I2C bus to be used? Then I can have the I2C bus protocol using Bit Banging: Instead of using a dedicated hardware, software is changing the signals on the bus.
The good news is: there is such a Bit Banging I2C component available in Processor Expert: SW_I2C.
And now the bad news: this one is not provided for ColdFire V2 (not sure why?):
But there is a solution: I have transformed the code generated by the S08 SW_I2C component into a new component which supports as well the ColdFire cores.
This GenericSWI2C component does the same thing as SW_I2C, but works as well for the ColdFire V2 using general purpose Bit I/O. It offers the following methods:
As properties, it offers to connect to any BitIO pins:
The GenericSWI2C component is available for download here.
That Software (Bit Banging) I2C driver worked well for several projects: it is not as fast as hardware I2C, but good enough to be used for I/O port expansions or Real Time Clocks on the I2C bus.
Happy BitBanging 🙂