[問題] stm32F 和 arduino uno I2C 連線問題
最近在練習在 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 的設定, 似乎結果都一樣
請問問題出在哪?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.161.3.130
※ 文章網址: http://www.ptt.cc/bbs/ASM/M.1406362855.A.F6C.html
推
07/26 17:34, , 1F
07/26 17:34, 1F
→
07/26 19:14, , 2F
07/26 19:14, 2F
→
07/27 00:04, , 3F
07/27 00:04, 3F
→
07/27 13:48, , 4F
07/27 13:48, 4F
→
07/27 13:50, , 5F
07/27 13:50, 5F
ASM 近期熱門文章
PTT數位生活區 即時熱門文章