Help with I2C / Avrlib / avr-gcc

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I am totally new to avr-gcc, AVRs and embedded programming of any type! I am a semi-retired physicist and I want to build some measuring type projects for myself. I have been finding my way using the STK-500 and JTAG-ICEmkII package from DigigKey with avr-gcc and AVR Studio.

I want to try talking to some I2C chips (things like IO expanders from NXP)and it has been suggested that I try the AVRLIB library from Pascal Stang. I have compiled the i2ctest demo, and I get the console IO, but what I don't understand is how I enter things like binary or hex data?

Sadly the example is a bit light on documentation and I don't know enough C yet to be able to figure out just what I should enter from the console.

Can someone help?

I am using Studio-4.13.528 and the latest but one release of avr-gcc (a few weeks old).

Thanks in advance, Dean

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have at look at Peter Fleury's I2C library. http://jump.to/fleury

Specifically, test_12cmaster.c

That example allowed my to talk to a external EEPROM without too much drama.

Good luck

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you [davef].

I looked at the Fleury library, and I think I will make some use of it in future, but I finally had some success with the TWI example which I found included with avr-gcc.

I put a 24LC32A on my board and talked to it successfully with my FPGA based I2C master (FPGA's is what I do a lot of). What I found was that none of the example code handled two word addresses for devices like these. Everybody seemed to be relying on code for things like the 24C02, 24C04 which only require one byte.

Having now mastered this, I will go on and figure out how to do more! Thanks again for the pointer.

Dean.