pingrf
pingrf copied to clipboard
RF stack for the Animas OneTouch Ping insulin pump
BEWARE! This software is highly experimental, and is NOT INTENDED for diagnostic or medical use. I have no affiliation with Animas or J&J.
Pingrf implements RF communications with the Animas OneTouch Ping insulin pump. Pingrf is factored into three components: Packet radio firmware (using the TI/Chipcon CC11xx series chips); a radio RPC layer, so that clients may communicate with the packet radio through UART or SPI; and a pump driver, which implements the pump session and application layers.
All are provided as cleanly separated APIs.
Command cmd/pingrf implements a utility and test client for pingrf using Unix ttys. This tool demonstrates how to construct a pump client and invoke it. It's also useful in its own right, e.g.,:
% pingrf -h
usage: pingrf [-t tty] [-b baud] [-dh] command [options]
Where command is one of:
chkadd data checksum
Add known data-checksum pair. Arguments are hexadecimal strings.
combo insulin hours
Issue a combo bolus for the given amount of insulin and time.
cancelcombo
Cancel a currently running combo bolus.
pcall status
Retrieve the home-screen status message of the pump
pcall status1
Retrieve status screen 1 from the pump
pcall status2
Retrieve status screen 2 from the pump
pcall status3
Retrieve status screen 3 from the pump
pcall cancelcombo
Cancel an existing combo bolus
Setup instructions (for raspberry pi): Once completed, pingrf can be used from raspberry pi shell to control Ping using the commands above.
HW required: raspberry pi, ftdi/usb cable, cc1110 mini development kit (pin header installed on cc1110 & some jumper wires between c1110 & ftdi/usb)
HW setup: 1) connect cc1110 to raspberry pi using two connections 2.1 - raspberry pi <-> usb cable <-> cc debugger <-> adapter <-> debug pins on cc1110 this connection is to program cc1110 and to power it up. if properly connected, cc debugger will show green. jumper on cc1110 should remain between p3/4 and no need to install battery. 2.2 - raspberry pi <-> ftdi/usb cable <-> cc1110 INT10 UART pins P0.2 to TX on ftdi/usb cable P0.3 to RX on ftdi/usb cable P0.4 to RT on ftdi/usb cable P0.5 to CT on ftdi/usb cable this connection is to communicate between pingrf and cc1110. wires are cross-wired. i.e. RX on cc1110 is connected to RX on ftdi
SW setup
1) raspberry pi needs to be set up according to openaps instruction
2) install sdcc - compiler for cc1110 firmware
sudo apt-get install sdcc
3) install cc-tool - to program cc1110
git clone https://github.com/dashesy/cc-tool
sudo apt-get install libboost-all-dev libusb-1.0-0-dev
cd to cc-tool directory
./configure
make
make install
4) clone pingrf repository
git clone https://github.com/mariusae/pingrf
5) burn new firmware unto cc1110. once programmed, the board will reset
cd pingrf
cd cc1110
sudo make UART=1 flash
6) pingrf now needs to learn checksum for a given command
export TAP=
debug hints 1) not every remote will use the same wake up payload. if the hardcoded value in libpump/conv.c doesn't work, pingrf stat will time out. capture the 0000 0004 related payload from "pingrf -d chklearn" and replace those four bytes in order. example:
0000 0004 e02d 6bd2 AABB CCDD
2) if pingrf fails and complains about missing checksum, then pingrf didn't
learn the command/checksum combo as part of "pingrf -d chklearn".
just reissue the command and use your remote to replicate the
action that you are looking for pingrf to do. the existing
table will be added with new command/checksum combo
Bootloader
Pingrf supports bootloading using the rfcat bootloader.
- Put the card into bootloader mode. (This can be done manually or with "rfcat --bootloader", or through the interactive rfcat prompt.) $ rfcat -r >>> d.bootloader()
- make cc1111+ccloader.ys1load
Enabling bootloader mode on the Yardstick One, by connecting pins 7 and 9: ----------------------------------------- | YARD Stick One 2 4 6 8 10 12 14 | | 1 3 5 7 9 11 13 ------
| USB |
|---|
-----------------------------------------