Hello everybody!
I'm testing the InternalI2C bean (for HC12X) using an evaluation board EVB9S12XEP100.
Since it is the first experience with I2C protocol, and before to use it to
program a Sharp Tuner, I decided to do some training connecting together
the SDA and SCL lines of the two I2C0 and I2C1 ports (using two 2.2 KOhm
resistors for pull-up to Vdd=+5V the two lines SDA and SCL).
At this point, I've created a simple project (see attachement) integrating
the Processor Expert beans adding two components "I2C0.InternaI2C" and
"I2C1.InternalI2C".
The scope of this SW is simply to send 3 Bytes from I2C0 to I2C1.
I set the I2C ports as following:
- I2C0 as MASTER (with Interrupts enabled)
- I2C1 as SLAVE (with Interrupts enabled)
- frequency (SCL=400KHz).
Therefore:
- The SW is compiled without errors and warning.
- The Events.C callbacks were properly set with the needed flags using the
Tutorial InternalI2C.
- The binary is loaded on the target without errors.
###### PROBLEM #######
The "I2C0_SendBlock()" returns ERR_OK and sentBytes = 3,
but the Event "OnTrasmitData" is not called and therefore the SW go in deadlok waiting endless
for the flag "Completed=1U".
It seems the byte transmission not finish correctly for some problem.
If I comment all the synchro loops (while{...}) till to arrive to the "I2C1_ReceiveBlock()"
I get the error id = 10 (no data to receive).
I've checked the SCL line by an oscilloscope and the clk is 400KHz.
Unfortunately I don't have a Logic Analyzer at the moment.
Could you help me to understand where could be the error?
Thanks a lot in advance.
AndydnA
Original Attachment has been moved to: Project_Andy_IIC.rar