2012-10-28 04:52 AM
Hello,
i'm trying to access a compas modul with my stm32F100 (ST32VLDiscovery). I'm trying to do that directly accessing the registers. I think writing the data is ok, but reading doesn't work. I send the start, than the address and after that I'm not sure if i have to send the data (0xFF) to produce the clock or if the clock is produced automatically. The informaiton in the manual concerning this are not clear. Thanks in acvanced, Andi2012-10-28 05:46 AM
I2C on the STM32 part is fairly complicated. Suggest you review the flow expressed in the examples.
STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\I2C\I2C_TSENSOR2012-10-28 05:56 AM
Thanks for your quick response!
No, I don't know the examples you mentioned. Where exactly can I get them? Could you please give me the link where to download them. Thanks2012-10-28 07:30 AM
http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f10x_stdperiph_lib.zip
2012-10-28 07:20 PM
Resources on the ST website may be found via either the CHIP or BOARD support pages, although frankly a Google/Bing search might be more effective than ST's own search.
STM32F100RB, review Design Support tabhttp://www.st.com/internet/mcu/product/216844.jsp
STM32 VL-Discoveryhttp://www.st.com/internet/evalboard/product/250863.jsp
2012-10-31 02:32 PM
Hello,
sorry for the confusing messsage. I tried to post it with my android. Thanks for your answers. That make things clearer for me now. I have one more question: what is the difference between RxNE and BTF. When is which bit set? BTF makes sense for me when sending. But on receiving? When my receive buffer is not empty(RxNE=1) there should be also a transmision finished(BTF=1). Thanks Andi2012-11-05 09:16 AM
Maybe this will help, i found it in STM32F10x reference manual RM0008:
26.6.6 I2C Status register 1 (I2C_SR1)[...]
Bit 2 BTF: Byte transfer finished
0: Data byte transfer not done
1: Data byte transfer succeeded
Set by hardware when NOSTRETCH=0 and:
In reception when a new byte is received (including ACK pulse) and DR has not been read yet (RxNE=1).
In transmission when a new byte should be sent and DR has not been written yet (TxE=1).
Cleared by software reading SR1 followed by either a read or write in the DR register or by hardware after a start or a stop condition in transmission or when PE=0.
Note: The BTF bit is not set after a NACK reception
The BTF bit is not set if next byte to be transmitted is the PEC (TRA=1 in I2C_SR2 register and PEC=1 in I2C_CR1 register)
2012-11-07 03:49 AM
Does that mean the different between the BTF and the RxNE is that the BTF is not set if there in a NACK while the RxNE is set in that case?
2012-11-07 04:22 AM
I haven't used it so i can't tell.
It seems to suggest difference in ACK/NACK but who knows.Generally ST documentation is not perfect so it's best to verify it in practice.2012-11-07 06:08 AM
You are right, I'm going to figure out which bit works best for Receiving in IIC.
Thanks for your help.