2022-11-28 06:26 PM
As a newbie C developer and Stm32 user. I'm trying to develop a 433MHZ RF remote receiver with my custom made board using stm32f030c8t6.
I tried to decode the RF signal on an arduino by using rc-switch library, and I can decode the 32bit signals as below:
04:10:57.252 -> Decimal: 3899580674 (32Bit) Binary: 11101000011011101110000100000010 Tri-State: not applicable PulseLength: 252 microseconds Protocol: 1
04:10:57.389 -> Raw data: 6116,732,240,732,248,728,244,236,736,732,248,236,732,244,732,244,740,240,728,732,244,736,240,244,732,728,244,728,248,52,52,104,40,88,1052,1684,16,1160,32,1680,24,60,268,24,36,36,2992,44,3496,564,68,48,88,452,208,2680,40,40,1328,96,200,68,620,160,52,
The rc-switch library decoded my signal with using their Protocol 1 timings.
I'm using this 433MHZ RF receiver module:
As RF signal generator, I'm using this 32bit ASK remote:
And this remote uses this communication protocol:
The RF signal uses this structure:
I searched entire web for stm32 RF projects but I only found one project named [ASK][3].
I tried this project and I'm receiving RF signals now but because of the different RF wave lenght and timings, I can not decode my 32 bit remote's signal by using this project.
I think I will decode my signal with this project but I have to change ask struct's buffer and ask_available() function. But unfortunately I spend 1 week but I couldn't figure out...
So... I decided to move one step back and take advices.
To reach that goal, I have 3 different idea right now...
1. I should try porting rc-switch library to stm32.. (it is written by C++ and my stm32 project written with C) I really don't know how...
2. I should focus on ASK library and maybe I will decode the signal by changing the receiver code with trying different timings. (Is it possible? if so, how?)
3. As I said I'm newbie with stm32 and C. This is the better way to learn but also the long way. I should stop trying to port these projects and I should learn how to develop from scratch. Let me tell you what I learned and which point I've stuck:
I'm using PB8 GPIO port as RF receiver and I've created the port as GPIO_EXTI8.
I learned that, I should create a tim channel as a timer with my 48MHZ cpu because we need it for decoding the signal. I'm using PB8 GPIO port as RF receiver and as I learned from the datasheet I need to use TIM16 channel for the PB8 port.
This is the TIM16 settings and as I learned from different projects, I need to define Prescaler (PSC - 16 bits value) and Counter Period (AutoReload Register - 16 bits value ). But I don't know why we need these values and which values should I use?
Also I configured the RF receiver GPIO mode as Rising/Falling edge trigger detection to dect low and high signals. Also I selected the No pull-up and no pull-down.
I enabled NVIC for EXTI line and Tim16: (I'm not sure but I think, we have to enable EXTI line to receive the RF signals as callback)
At this point. Port and Timer configuration is over and now we have to develop the decoding code.
To decode RF signal, we have to listen the GPIO EXTI callbacks. As I see at ASK project, the callbacks never ends because of the noise, we receive signals all the time.
I have to create a seperate inifite process at the main.c and run a decode function to read the callback output and search the defined 32bit wave lenght. *But I don't know how to create the process and how to read the EXTI callbacks.*
This is the callback function:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == RX433_PIN)
{
// I want to learn how we can read the data?
}
}
When we are able to read the output, we must define the 32 bit pulse lenght and filter by sync signal. Also I have to write an algorithm to check the CRC value to be sure about the signal and convert to decimal format to call desired functions.
I'm stuck at this point and I need help...
P.S I know question is too long but I wrote every detail I learned to help others.
2024-05-25 06:10 AM
Hi mate,
Firstly sorry to disappoint you i won't be able to help you with your project as I'm way more of a newb than you.
I felt pretty bad for you after you put all that effort into your post and not even a response that sucks.
I hope you sorted it though.
Anyway ....I was wondering you could help me ?
What I'm trying to do is alot simpler than what you're trying to do .
So basically I'm looking to use one of my microcontrollers to lock and unlock my car door.
Basic concept is to energise a relay to unlock my car door when the RF signal on my phone is strong and I unlock it when it's weak.
I did find a respiratory on github using an Arduino controller and RF24 module but I've been unsuccessful in getting it to work.
I wonder if you might be able to help point me in the right direction I do have stm32 controllers so I could use one of them if needed. I've managed to get the IRK address from my phone using his PROJECT but I'm just unable to figure out how to set the signal to trigger the relay any help would be great.
Cheers