I am using stm32cubeide to program a stm32f030f4p6 MC. I have assigned one pin as an external interrupt and it is connected to the data output of an RF433 receiver. Here is a summary of my code:
int k;
int main(void)
{
while (1)
{
k=0;
}
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
k=1;
}
and, the value of 'k' over time is: the value of 'k' over time("button" is the button of the rf433 transmitter)
the value of 'k' over time("button" is the button of the rf433 transmitter)
as it can be seen from the picture, interrupt is triggered even when no signal is received.
PS. I have tried external pull down and pull pull up resistors 10k and 4.7 k did not have an effect and with 2.2k no signal from rf433 receiver would be detected.
2 Answers 2
At least the modules I have ever worked with, the receiver modules had no noise gating, so that is basically the received noise that is amplified and actually output by the receiver to the MCU. Only when a transmitter is turned on, and transmitting a signal that is within specification of the transmitter and reveiver, the output will be what is transmitted - with the occasional bursts of noise from received disturbances.
So unfortunately, no pull-up or pull-down is able to fix that, and thus generating interrupts directly from the RF module output pin may not be such a good idea and you might want to think of other approaches to receive data.
-
\$\begingroup\$ I think, as @ TirdadSadriNejad mentioned, that this might be the normal behavior of the pin connected to this receiver and I have to look for a way to process it to retrieve the data. I have used this method before (433 receiver data pin connected to interrupt pin) and it's a common approach for this. Could you please provide some other example approaches please. Thanks. \$\endgroup\$Hamid Rajabi– Hamid Rajabi2021年09月17日 16:16:28 +00:00Commented Sep 17, 2021 at 16:16
-
\$\begingroup\$ It depends what protocol and data rate you are going to use. I have no idea what you might want to do and how and the ways possible to do that. \$\endgroup\$Justme– Justme2021年09月17日 16:50:58 +00:00Commented Sep 17, 2021 at 16:50
So, the solution came from @TirdadSadriNejad 's comment and I quote:
"Which RF433 receiver? the cheap receivers are always recieving data from the environment. its up to programmer to extract and decode the desired data. the pattern shown seems pretty normal for that kind of receivers. BTW, you can toggle k in the ISR code so you dont have to reset it in the while loop".
Therefore, the pin's random and constant oscillation is completely normal for this receiver. I ported the Arduino's "RCSwitch" library to handle the noise and retrieve the data and it works like a charm!
Explore related questions
See similar questions with these tags.
k
in the ISR code so you dont have to reset it in thewhile
loop. \$\endgroup\$