I am developing an application that functions as an I2C slave. To test it, I am trying to write a debug function to simulate the I2C master. With what I have so far, I successfully start I2C communication and receive the first byte. However, after that, the I2C interrupts stop triggering in my application, and the debug function never receives any more bytes.
It seems like the ACK from the master never registers in the application. Here's my debug function:
signal void ReadI2CData() { printf("Sent: Read request to address 0x28\r\n"); I2C1_IN = 0x0100; //Initiate transfer I2C1_IN = 0x28 | 0x01; //from the address of the slave wwatch(I2C1_OUT); // Wait for data from Microcontroller if ( I2C1_OUT == 0xFF00 ) //Slave sent an ACK { printf("Received: ACK\r\n"); } else { printf("Received: %d!\r\n"); return; } while (1) { wwatch(I2C1_OUT); //Wait for data from Microcontroller printf("Received: %d\r\n", I2C1_OUT); I2C1_IN = 0xFF00; //Send the ACK! (This doesn't trigger the interrupt in the application) } }
Any thoughts would be appreciated. Thanks.
if st32f1xx read the errata. They tried to be nice and double buffered the I²C which has made the errata rather lenghty on this subject
Erik
PS when discussing peripheals always include the chip in the post
It is an stm32f103rb. Do you have a link to the errata?
<quote>It is an stm32f103rb. Do you have a link to the errata?</quote>
www.st.com/.../164487.jsp
Always yo're freind.
Zeusti.
(now working with our freind jim hammer)
Back from the dead Zeusti
Go back where you came from you zombi :-)
<quote>Go back where you came from you zombi :-)</quote>
hey Tapir.
What you up to now man? I moved to new work but this guy said do a job with nxp and he said he'ed give me muney for a good job. Yew know i always do a good job so i will get good muney :)
(sleeps with the abi. do you?)
View all questions in Keil forum