EXCLUSIVE FORUM FOR MACHINE DISMANTLERS AND REPAIR PEOPLE   >   East Chicago   >   Self Propelled   >   Foudation Brakes   >   Usb to I2C converter and analyser

Usb to I2C converter and analyser


BV4221 USB to I2C Two Way Converter
This is a device that you can plug into the USB and use it to drive I2C devices, it will also work the other way round and inspect the I2C bus for debugging purposes. This device will enable a standard PC to control, LCD's, Analogue to Digital Converters, Real time Clocks, Temperature Sensors, EEPROM storage etc. In fact any I2C device on the market. This can be done interactively or through a user program. The full data sheet and example programs can be found at http://www.byvac.co.uk/bv/datasheets/BV4221%20DataSheet.pdf
The device has a USB connector at one end and the I2C interface at the other. There are built in pull up resistors to the SDA and SCL line and also LED indicators. The indicators are illuminated when the bus lines are high, thus when both are illuminated the bus is free. This is very useful for detecting 'locked up' devices.
The BV4221 presents itself to the PC as a COM port, this is useful because it can be used with any terminal software, it will work with Windows and Linux.
At switch on the BV4221 waits for the enter key to be pressed, it will then select an appropriate Baud rate based on that. In the above example BV Terminal is being used but this could be any terminal software. The prompt by default is 0x42>, this indicates working in hex mode with a slave device address of 0x42 (66 decimal).
As an example to write to a serial EEPROM the values 1,2 & 3 at address 0x120:
The first command Aa0, changes the address to 0xA0. In the second line the letters and numbers have the following meaning:
1 20 sends to the EEPROM the address where the data is to be written, this is a 16 bit value, hence to bytes are sent.
1 2 3 are the data that is stored at the address
s 1 and 20 set the address as before
r sends a re-start condition, telling the EEPROM that we now wish to read it. A restart is a start condition followed by the address plus 1 and so 0xA1 will have been sent.
g-3 this gets three bytes from the EEPROM, it will send the appropriate NACK on the last byte to tell the EEPROM no more bytes are required. As can be seen the bytes that were restored are retrieved.
All of the above can of course be done under program control so that an automated system can be implemented, a temperature logger for example. Very little knowledge of electronics is needed as all of the functionality is within the I2C devices.
As well as acting as a master device the BV4221 can also 'spy' on the I2C bus and present what it sees to the terminal. This has some limitations in bandwidth but can be very useful for debugging and learning about I2C.
* Automatic Baud rate select
* USB driver easily obtainable
* 5V out to drive external I2C circuit - short circuit protected (100mA)
* I2C pull up resistors incorporated
* Inspect I2C up to 50kHz bus speed
* LED indication of SDA & SCL lines
Note that the Baud rate selects from 9,600,14,400,19,200,28,400 and 11,5200 only.
The BV4221 comes with a comprehensive data sheet and CD_ROM. To see the article on using this hardware with Just Basic go here. Also there are programs written in VB Script at the ByVac web site that enables control of I2C from a web browser, look for VBS on the main menu



Usb to I2C converter and analyser