The "Bus Busy" issue was because the missing of two pull-up resistors (I2C standard). I only have to change the jumpers on the EVB.
But I am still not able to communicate with the camera.
I slowed down the CF to a systemclock of 20 MHz. The resulting I2C frequency is round about 5 kHz, that should fit.
The camera forced a protocol (read action) of:
Command-Block:
<START> i2c-adr <ACKN> R/W-Mode <ACKN> dev-adr <ACKN> reg-adr <ACKN> <STOP>
Data-Block:
<START> i2c-adr_R/W <ACKN> data <ACKN> NACKN
And between the Comm-Block and the Data-Block have to be a break of at least 2 msec.
I explain my code in words:
1. init (setting i2c-freq and i2c-slave adr.)
2. set I2CR to " 0 | IEN | MSTA | MTX " (means: enable + master + transmit + "sends START" )
3. write to I2DR the "i2c-adr"
4. wait for IIF and RXAK
5. do step (3.) and (4.) with "R/W-Mode", "dev-adr", "reg-adr" (instead of "i2c-adr")
6. set I2CR to "0x80" (means: enable + slave + receive + "sends STOP")
7. set I2CR to "0x0" (disable I2C-Module; without that I later gain an "arbitration lost")
8. set wait for a bit ( int i = 1000000; while(i--); ) should be enough for 2msec
I think my fault lies in the following lines.
9. do again step (2.) (IEN | MSTA | MTX)
10. do step (3.) with "i2c-adr_R/W"
11. do step (4.)
12. clear MTX (means: change to receive-mode)
13. read from I2DR (dummy read, but same variable as it is for real data)
14. do step (4.)
15. read from I2DR
16. do steps (6.) and (7.)
But the variables that I use to move the content of I2DR always contain the "i2c-adr_R/W" even if I do steps (13.) and (14.) several times in a row.
Please Help.
Thanx