Saturday, March 6, 2010

VAULT-OS : I2C DOS Driver Updated

I have been working with starter code I got from the old classic I2CFAQ demonstrating a BASIC code interface for I2C for approximately a year or so. This code was always a bit shonky and debugging it was 50% of my time. Was okay for a single temperature sensor, after I added a couple more I2C devices it was never really much more than experimental. I kept adding time delays and other safety checks until the code was getting utterly slow and kludgy.

It missed ACKs, skipped STOP commands and had to be forcibly reset to lower the line voltage after a glitch. Enumeration of devices with keys sometimes worked perfectly, other times required me to power down the I2C master hub and turn it back on again. It was driving me crazy. Lots of timing issues suspected.

I found the original TMEX3.10 SDK from 1998, a very rare I-Button SDK, on a Russian FTP site a couple weeks ago and had been meaning to have a look. After installing it, I found a truly complete and trustworthy I2C library with all original VBDOS code inside, easily converted to PowerBasic. This code has been integrated into VOS in place of my original hack API and already it is performing much better.

This new library is a lot more stable than my original one. In particular, the enumeration is working way better. This was very important to the functionality of Vault-OS in order to establish a kind of plug-n-play environment that would recognize new devices on the line when it boots up. I almost have the driver to the point where it will prompt you for information about an unrecognized device just like Windows does with USB peripherals.

No comments: