2014-09-25 04:21 AM
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
2014-09-25 07:20 AM
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. When you use ''I''in this context, it is not clear whether you are referring to the F103 or the accelerometer. The accelerometer generates the interrupt pulse. Read the accelerometer specification sheet carefully. Does the accelerometer generate an interrupt when Stopped ? Your code uses I2Cx in the GenerateSTOP call. Have you defined that as I2C1 ? This accelerometer model uses 1.8V logic levels. Is this compatible with your F103 ? Cheers, Hal
2014-09-25 08:07 AM
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.In this context ''I'' is my person. I put the wire manually to Vcc or to GND for generate the interrupt.The accelerometer generates the interrupt pulse. Read the accelerometer specification sheet carefully. Does the accelerometer generate an interrupt when Stopped ?No this accelerometer can generate an interrupt when you acceleration is most than a value.Your code uses I2Cx in the GenerateSTOP call. Have you defined that as I2C1 ?Yes I define them like I2C1This accelerometer model uses 1.8V logic levels. Is this compatible with your F103 ?yes this level is read like a 1 logic.My principal problem is that If I remove the wire put to PB5. and I read my sensors I have a interrupt like I was connected the wire.Regards
2014-09-25 08:09 AM
I don't know but....
I must disable the interrupt to use the i2C and no have this interrupt???