作者:
polor (波羅兒)
2014-07-26 16:20:50最近在練習在 stm32f discovery 和 arduino 做 I2C 溝通
1. stm32 部分的 code 為 http://codepad.org/YixZzNv3
2. arduino 的 code 為 http://codepad.org/rtpBBUh3
程式碼都是從網路上抓來修改
碰到奇怪的問題是, 在 stm32 中
while(1){
I2C_start(I2C1, SLAVE_ADDRESS<<1, I2C_Direction_Transmitter); // start a transmission in Master transmitter mode
I2C_write(I2C1, 0x20); // write one byte to the slave
//I2C_write(I2C1, 0x03); // write another byte to the slave
I2C_stop(I2C1); // stop the transmission
//printf("data\n");
}
如果加一個 printf("data\n") , arduino 那邊就會收到訊息
mark掉就不會收到, 我在想是不是 timing 的問題?
只是我嘗試修改 clock 的設定, 似乎結果都一樣
請問問題出在哪?
謝謝