Question
Nucleo-F103RB, I2C1, and PB5 interrupt
Posted on September 25, 2014 at 13:21
Hello
I have a Nucleo-F103RB board. I am using the I2C1. I want conncect to PB5 to a external interrupt. My idea is conect PB5 to the int out line of the one acelerometer ''KXTF9-4100'' At this moment I set a wire in this line and I can put to Vcc or GND to generate the pulse. I generate the interrup so I have a good configuration. But when I initialice the ic2 devices and I execute/* Send STOP condition */
I2C_GenerateSTOP(I2Cx, ENABLE);
with this code
/**
* @brief Generates I2Cx communication STOP condition.
* @param I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* @param NewState: new state of the I2C STOP condition generation.
* This parameter can be: ENABLE or DISABLE.
* @retval None.
*/
void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Generate a STOP condition */
I2Cx->CR1 |= CR1_STOP_Set;
}
else
{
/* Disable the STOP condition generation */
I2Cx->CR1 &= CR1_STOP_Reset;
}
}
I don't know because an interrupt is generated in the PB5
Someone can help me?
Regards
#stm32f103rb #pb5 #i2c