Assembler library for I2C interfacing

Hi,

I started a thread in the Bugs & Suggestions forum about problems with the Wire library, but I think my followup questions are better suited here.

As a summary, I am unable to use the Wire library for communicating with an external EEPROM chip. Even when taking into account the 32-byte buffer of Wire (that isn't documented anywhere), the exact same code that works in a minimal sketch won't work in my full application. Either the memory is running out (which is hard to believe since according to avr-size the data+bss sections are 450 bytes, the Wire library allocates a further 160 bytes and my function nesting is only a few levels deep), or it somehow otherwise corrupts the data.

Therefore I'm searching for an alternative way of managing I2C communication. I found the i2cmaster interface at http://homepage.hispeed.ch/peterfleury/avr-software.html#libs , which seems like a simple library to use. However, I am unable to include the assembler file into my project.

I found the thread at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1222355444/6 which suggested making a library out of it and manually compiling the assembler into the object file, but that does not help. The file is still not linked with the other application.

Is there some way of adding a file to an Arduino project to be linked in with it? Or is it possible to compile an Arduino project from the command line? Alternatively, can you recommend some other library that could be used for I2C communication? I'm new to AVR's so I don't want to get mixed up with the registers and code it from scratch.

Overall, it would be a huge improvement if the Arduino IDE would allow adding .c, .S and .o files to be linked into the project.

Thanks for any help!

Replying to myself:

I was able to modify the avr-libc i2c-eeprom example to support larger EEPROM chips and managed to get it working with my 2 x 32kB chips. Using those routines also removes the limitations of the Wire library for reading/writing only 30 bytes at a time and reduces the memory footprint since it requires no extra buffers.

The "corrupted" data I got might also have been due to forgetting Wire.begin() in the program setup - I've reworked the program so much that I'm not quite sure anymore. Lesson to be learned: When some I/O doesn't function as expected, first make sure it's being initialized...

I found the thread at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1222355444/6 which suggested making a library out of it and manually compiling the assembler into the object file, but that does not help. The file is still not linked with the other application.

That approach definitely worked for me. :-)

Does your .o file have an associated .h file and, if so, is it included?

--Phil.