Hello. I am having some trouble getting I2C to work on my ADuC7020 and I seem to be doing something wrong with interrupts in general.
What I have working is a simple main.c and polling-driven UART. I set up I2C_1 rather than 0 since it doesn’t share pins with the UART and wrote transmit and receive routines for Master mode. My slave device is an HMC6352 (the SparkFun digital compass).
My linker script and startup code are basically copies from the Keil GNU examples as I needed something to get started while I learn what’s going on there. The startup code sets the IRQ to be handled by a routine I defined in main.c
Right now it appears that with I2C transfers the IRQ never runs at all, despite the fact that I’ve enabled the I2C Master 1 interrupt and turned on I2C_1’s clock and master mode. I then added a TIMER1 interrupt just to see what would happen. The timer does trigger my IRQ routine to run like I would expect. So it seems that my general setup is correct but for some reason I’m not configuring I2C properly.
I’ve uploaded a tarball of my code/project in case someone is willing to take a quick look – I would really appreciate it! I can also post snippets here if that’s better:
http://thedotcommune.com/projects/aduc.tar
I would really appreciate any help and advice, especially if someone who has written I2C routines for this chip could take a look at my i2c.c and tell me if I’m on the right track. Thanks!