RC5 Infrared receiver

Thread Starter

LK19

Joined Jul 30, 2012
4
Hi
I'm new to ARM. I'm programming STM320518-EVAL board with STM32F051R8 microcontroller for RC5 infrared transmitter/receiver. ST posts example code on their website, so I grabbed the whole code project and trimmed out what I dont need. I made sure I don't overtrim, by making the code print 'Oops' and hang forever if I accidentally call into the function I trimmed out. However, my version doesn't really work. I press buttons on RC5 remote control to send RC5 data to my receiver code, but my code receives wrong information. If I press the same button on the remote control twice, my code shows it receives different information both time (and none is correct, of course). I made sure the time interval for interpreting RC5 bits are reasonable, but that doesn't fix the issue. Have you guys run into this issue before? What do you think could cause this issue?
Thanks
 

hexreader

Joined Apr 16, 2011
581
If I press the same button on the remote control twice, my code shows it receives different information both time
RC5 protocol includes a toggle bit, which alternates between 1 and 0 on each consecutive button press. This helps distinguish between a button held down to give repeated messages, and a button pressed a second time.

If decoding is not operating correctly, then the toggle bit will cause alternate messages to give different results.

Maybe your timing is out. I know nothing of STM32, but are you using the correct crystal value and configuration settings for the code that you grabbed?
 

Thread Starter

LK19

Joined Jul 30, 2012
4
Thanks! I copied the settings from posted code.
I read the micro controller application notes, but I'm still unclear about how to adjust the timing parameters on uController. It shows some formula which I can't relate. If anyone knows, please share with me.
 

Thread Starter

LK19

Joined Jul 30, 2012
4
I found out that I seem to get the logics (RC5 data) correctly, except that it shifts. For example, if I press #5 button on the remote control first time, I get 1010001010 binary. Then the second time, I get 1000101000101 binary. The 101 keep shifting around. Do you have any idea what goes wrong?
 

hexreader

Joined Apr 16, 2011
581
I already explained in post #2 why you get two different results.

Your problems start before the toggle bits though, since the first two (start) bits should be 11 and you are reading 10.

So there is something wrong with your code, your timing, or maybe even your hardware. (are you sure that your remote is an RC5 remote?)

Time for you to do some debugging...

(or maybe go back to the original code, get that working, then change a bit at a time to see what you did to break it)

I prefer this site for explaining IR protocols in a nice easy way:

http://www.sbprojects.com/knowledge/ir/rc5.php
 
Last edited:
Top