Created
November 25, 2012 16:53
-
-
Save bivald/4144298 to your computer and use it in GitHub Desktop.
XRF Getting out of sleep mode - brute force
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# This is a crude brute-force tool to remove the cycling on a XRF module (http://shop.ciseco.co.uk/xrf-wireless-rf-radio-uart-rs232-serial-data-module-xbee-shape-arduino-pic-etc/) | |
# What it does is that every 20 ms it sends out a : WAKE + REMOVE INTLV + Reboot command | |
# This should be running when you power up your XRF (or when the XRF sends the battery reading, but on startup is easier) | |
# | |
# Start the script, start the XRF and it should reset straight away. Afterwards it will boot with the regular STARTED commands, without cycle. | |
# Everything else is the same (i.e device name etc.) | |
# | |
# 1. You need a XRF connected to your computer, | |
# Either a USB XRF receiver/sender(http://shop.ciseco.co.uk/urf-radio-module-and-serial-inteface-via-usb/) | |
# Or a XRF radio connected to your Arduino with a slice of pi | |
# | |
# 2. You need python-serial installed, to install it: | |
# sudo pip install pyserial | |
# or: | |
# sudo apt-get install py-serial | |
# or: | |
# sudo easy_install pyserial | |
# | |
# 3. You need to know the /dev/ adress to your XRF, these are usually: | |
# | |
# /dev/tty.usbmodem000001 - If you'r on MAC and you have a USB XRF | |
# /dev/ttyAMA0 - Slice of pi, raspberry | |
# /dev/ttyACM0 - USB XRF on raspberry | |
# | |
import serial | |
import time | |
DEVICE = '/dev/ttyAMA0' | |
BAUD = 9600 | |
while True: | |
ser = serial.Serial(DEVICE,9600,timeout=0.01) | |
ser.write('aAAWAKE-----') | |
ser.write('aAAINTVL000x') | |
ser.write('aAA REBOOT--') | |
time.sleep(0.02) | |
ser.flush() | |
ser.close() |
martynwheeler
commented
Jun 16, 2020
via email
Hi,
Yes, but in the end I realised that I could just reflash the firmware and
it works
Thank you
Martyn
…On Tue, 16 Jun 2020, 21:51 Niklas B, ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Honestly it's been eighth years, I'm afraid I don't remember much. Do you
have the right /dev/tty?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/4144298#gistcomment-3343912>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGVUFNGDFKT77HBG544UOTRW7LNPANCNFSM4N7MWPIA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment