Go to content Go to menu

Walkera RX2635H hello world firmware

Saturday, March 28, 2015

Based on the findings of previous posts I wrote a simple program using ATMEL’s AVR Studio and flashed it onto the Walkera Hoten-X RX2635H receiver. It’s very simple. Its the classic “hello world” program. As the receiver has only one LED to communicate with the outside world I used this LED as user interface. The program uses morse code to send the text “OK” by pulsing the LED. This results in the pulses - - - (long long long) - . - (long short long) for the characters O and K.

This post is part of a series

  1. Flashing new Firmware to Walkera RX/TX without UP02
  2. Decrypting receiver firmware
  3. Receiver hardware analysis
  4. Hello World firmware for the RX2635H board (this post)
  5. Serial port and external 16MHz oscillator
  6. Using the ITG-3205 mems gyro
  7. Walkera UP02 software clone: UP42
  8. Walkera RX2635H as generic development board?
  9. Walkera USB port
  10. Walkera + Arduino = Walkino



This is the C listing of the morse OK blinker.

#include <avr/io.h>
// for delay.h
// using internal 2MHz oscillator
#define F_CPU 2000000UL
#include <util/delay.h>
#define DOT_VISIBLE_MS		125
#define DASH_VISIBLE_MS		500
#define SYMBOL_PAUSE		165
#define CHAR_PAUSE			375
#define WORD_PAUSE			500
void dot(void) {
	PORTD.OUTCLR = PIN4_bm;
	_delay_ms(DOT_VISIBLE_MS);
	PORTD.OUTSET = PIN4_bm;
	_delay_ms(SYMBOL_PAUSE);
}
void dash(void) {
	PORTD.OUTCLR = PIN4_bm;
	_delay_ms(DASH_VISIBLE_MS);
	PORTD.OUTSET = PIN4_bm;
	_delay_ms(SYMBOL_PAUSE);
}
void morseOK(void) {
	dash(); dash(); dash();		// O ---
	_delay_ms(CHAR_PAUSE);
	dash(); dot(); dash();		// K -.-

	_delay_ms(WORD_PAUSE * 3);
}
int main(void)
{
	PORTD.DIRSET = PIN4_bm;
	PORTD.OUTSET = PIN4_bm;

	while(1) {
		morseOK();
	}
}

To automatically prepare the compiled binary to be usable with the RX2635H boot loader use the following post build event in the project properties:

Click on a picture for a larger view and more details.

"$(ToolchainDir)\avr-objdump.exe" -D -t -m avr 
     "$(OutputDirectory)\$(OutputFileName).elf" > 
     "$(OutputDirectory)\$(OutputFileName).dump.txt"
"$(SolutionDir)tools\hex2bin.exe" -e fw 
     "$(OutputDirectory)\$(OutputFileName).hex" 
"$(SolutionDir)tools\xor.exe" 
     "$(OutputDirectory)\$(OutputFileName).fw" 
     "$(OutputDirectory)\$(OutputFileName).bin" 
     0x8E500166526E7BD7EEC85C7AC05AD792

(Ensure that every command is entered as a single line)

This extracts the raw binary out of the generated HEX file and encrypts it with the key for the RX2635H receivers boot loader. You can download the complete AVR Studio solution here.

So this proof of concept shows that it’s either possible to write a new firmware for the RX2635H or just use the receiver from a recycled, crashed Hoten-X as a cheap ATMEL XMEGA development board with lots of interesting additional components on it.