Inspired by Jordi's blog I tried to receive the serial data from a (pre-bound) SPM9645 remote receiver with RPi's GPIO. Maybe this information can be useful to you or it can save you some time. I am happy for some feedback or optimization proposals etc.
The following RPi GPIO Pins are used (*):
- [P1-01] 3.3V
- [P1-06] GROUND
- [P1-10] GPIO 15 (RXD)
Before you can use RPi's serial interface /dev/ttyAMA0 to read the data you need to make sure that there is no serial console or kernel debug function that uses the interface.
Remove the following options from your /boot/cmdline.txt:
Remove the following line from your /etc/inittab:
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Reboot the device and make sure you switched on your Spektrum transmitter (DX6i).
It should now be possible to read the SPM9645 serial data from the serial interface /dev/ttyAMA0:
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> from struct import *
>>> port = serial.Serial('/dev/ttyAMA0', baudrate=115200, timeout=3.0)
>>> print unpack('>xxhhhhhhh', port.read(16))
Have fun and stay tuned.
- 2.4ghz: How to read 7 channels with one wire (NOT PPM) with Spektrum modules
- Spektrum DSMX Remote Receiver
- RPi Low-level peripherals
It does not seem to be possible to use the suggested baudrate of 125000.
(* of course you can use any other 3.3V or GROUND Pin)
Thanks for the info. I will investigate this and update soon with more infos about the serial data decoding.
The baud rate is 125000 not 115200....
115200 is close and it almost works... but its off enough that the output will seem to be randomly wrong in ways that will confuse you.