2014-09-02 09:54 AM
Hi ST partisans! (Wink)
I have written two program for my two MCU. STM32F103RET6 and STM32f030. in the circuit, the STM32F030 should send ''Rohalamin'' string over I2C (as Master) . on the other hand, the STM32F103RET6 should recieve the string and if it's correct, the STM32F103RET6 should turn on an LED by the PB0. Ok, now you know that What's the configurations and I have attached several pictures from circuit: http://www.imageupload.co.uk/images/2014/09/02/02092014565.jpg http://www.imageupload.co.uk/images/2014/09/02/02092014568.jpg http://www.imageupload.co.uk/images/2014/09/02/02092014569.jpg http://www.imageupload.co.uk/images/2014/09/02/02092014571.jpg and you can see the configurations for I2C in the debug environment: http://www.imageupload.co.uk/images/2014/09/02/3RSYQ.jpg ok, let's to run it on MCU. When I turn on only the STM32F030, I can see just this in the logic analyzer: http://www.imageupload.co.uk/images/2014/09/02/26Ogx.jpg and when I connect the STM32F030 to the STM32F103RET6 and turn on the whole of the circuit, the output in the logic analyzer is this: http://www.imageupload.co.uk/images/2014/09/02/1NT3Gm.jpg and also when I check the STM32F103RET6 in the debug environment, it doesn't go to the interrupt routin. in my opinion, the problem is in the I2C interrupt of the STM32F103RET (totally I think the problem is STM32F103RET6) . and also I think the hardwares of the circuit is ok. Really What's the problem? Why doesn't it work correctly? #i2c #stm32f103 #stm32f0302014-09-02 10:04 AM
Watch carefully the volatility, and lack of NUL termination, of the receive buffer.
2014-09-02 10:31 AM
Hey Clive,
How are you? Thanks for reply. The I2C is a bit difficult to understand and by the ST MCUs it is more difficult than the I2C protocol itself! How can I do it (I mean ''watch carefully the volatility, and lack of NUL termination, of the receive buffer'')? is my configurations correct? (especially the program of the STM32F103RET6) I again say, in my program is in the STM32F103RET6.2014-09-02 12:15 PM
I'm not getting into I2C on F1 and F0 parts, I've done more work with I2C than anyone should have to in a single life time.
I'd suggest you read your C documentation materials (K&R, or whatever) about the volatile keyword, and it's appropriate use, and then the chapter on Strings and how they work, and why the NUL is important. Do your boards share a common ground?2014-09-02 07:34 PM
I'm familiar with ''volatile'' keyword but why I have to use it? the compiler optimization is ''level 0''. then no need to this keyword. and again keep in mind that in the STM32F103's program it doesn't go to the interrupt routine. I cannot understand this sentence:
''Do your boards share a common ground?''2014-09-04 10:25 PM
I'm harassed. I couldn't find the problem still. now, I put the configuration of the I2C in the STM32CubeMX for STM32f030:
http://www.imageupload.co.uk/images/2014/09/05/1iqHGX.jpg any idea?2014-09-06 09:41 AM
I connected both ground between STM32F030 and STM32f103 and now, when I push the button, I only can see this in the logic analyzer:
http://www.imageupload.co.uk/images/2014/09/06/gifE4.jpg Not sure but I feel that now it's better than earlier. LoL! and when I just turn on the STM32f030, I see the same result like before(I just see ''0'').