|
Hi Inh,
It certainly is possible to get the HW I2C working on the H8/3687. I've done the same as you and followed the datasheet flowcharts to implement Master Transmit mode in ASM on the ARC-32. I couldn't find any examples to follow either.
I found when following the datasheet, it sometimes used the word Set to mean 'give a value' rather than '= 1'. This tripped me up a number of times. What you should do for your setup is something like this this:
ICCR1.ICE = 1 ICMR.MLS = 0 (Specifies order bits are sent in) ICMR_WAIT = 0 (Adds an extra time delay that caused me numerous problems when set)
;Set the clock speed to 100KHz (presuming the Mad Hatter runs at 20MHz like the ARC) ICCR1_CKS3 = 1 ICCR1_CKS2 = 1 ICCR1_CKS1 = 0 ICCR1_CKS0 = 1
Then the rest is the same as what you've done, except that you need to wait for TDRE to become 1 after clearing SCP. Then write the slave address and check for TEND. Then you can continue to send data bytes such as the command and values. Other than those things It looks ok to me. If you are still unable to get a start condition then that may be something specific to the Mad Hatter.
Good Luck, -1
|