mirror of https://github.com/drowe67/pirip.git
commit
1571ac70ea
|
@ -69,7 +69,7 @@ Service scripts have been written to wrap up the complex command lines.
|
||||||
|
|
||||||
## Service command lines
|
## Service command lines
|
||||||
|
|
||||||
1. Loopback test is a good start, this checks each terminal is working stand alone. These tests send a burst from the Termnals Tx to it's Rx:
|
1. Loopback test is a good start, this checks each terminal is working stand alone. These tests send a burst from the Terminals Tx to it's Rx:
|
||||||
```
|
```
|
||||||
laptop$ sudo ./ping start_loopback
|
laptop$ sudo ./ping start_loopback
|
||||||
```
|
```
|
||||||
|
@ -84,9 +84,9 @@ Service scripts have been written to wrap up the complex command lines.
|
||||||
```
|
```
|
||||||
Then start the Terminal 1 `ping` service:
|
Then start the Terminal 1 `ping` service:
|
||||||
```
|
```
|
||||||
laptop$ sudo ./ping start_loopback 6
|
laptop$ sudo ./ping start 6
|
||||||
```
|
```
|
||||||
... will send 6 packets, 10 seconds apart (a 1 minute total run time). Look at /var/log/ping for results.
|
... will send 6 packets, 10 seconds apart (a 1 minute total run time). Look at `/var/log/ping` for results.
|
||||||
|
|
||||||
# Useful Command Lines
|
# Useful Command Lines
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# frame repeater service
|
# Frame repeater service, runs on the Pi
|
||||||
|
|
||||||
# TODO
|
|
||||||
# [X] way to send stderr to log file
|
|
||||||
# [ ] way to set freq at start up
|
|
||||||
# [ ] way to set Rs and M at start up
|
|
||||||
# [ ] way to start as frame repeater or beacon
|
|
||||||
|
|
||||||
TERM_ADDR=0x2
|
TERM_ADDR=0x2
|
||||||
RS=10000
|
RS=1000
|
||||||
DATA_BITS_PER_FRAME=256
|
DATA_BITS_PER_FRAME=256
|
||||||
CODE=H_${DATA_BITS_PER_FRAME}_512_4
|
CODE=H_${DATA_BITS_PER_FRAME}_512_4
|
||||||
TR_SWITCH_GPIO=21
|
TR_SWITCH_GPIO=21
|
||||||
|
@ -17,7 +11,7 @@ NAME=frame_repeater
|
||||||
PIDFILE=/var/run/${NAME}.pid
|
PIDFILE=/var/run/${NAME}.pid
|
||||||
LOGFILE=/var/log/${NAME}.log
|
LOGFILE=/var/log/${NAME}.log
|
||||||
PATH=${PIRIP_PATH}/tx:${PIRIP_PATH}/librtlsdr/build_rtlsdr/src:${PATH}
|
PATH=${PIRIP_PATH}/tx:${PIRIP_PATH}/librtlsdr/build_rtlsdr/src:${PATH}
|
||||||
GAIN="${GAIN:-49}"
|
GAIN="${GAIN:-40}"
|
||||||
|
|
||||||
function tx_burst_rpitx {
|
function tx_burst_rpitx {
|
||||||
num_bursts=$1
|
num_bursts=$1
|
||||||
|
@ -26,7 +20,7 @@ function tx_burst_rpitx {
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_rx {
|
function start_rx {
|
||||||
rtl_fsk -g ${GAIN} -f 144490000 - -a 200000 -r ${RS} --code H_256_512_4 --mask ${RS} -L $1 > /dev/null &
|
rtl_fsk -g ${GAIN} -f 144490000 - -a 40000 -r ${RS} --code H_256_512_4 -L $1 > /dev/null &
|
||||||
echo $!>${PIDFILE}
|
echo $!>${PIDFILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,14 +33,14 @@ function stop_service {
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
( rtl_fsk -g 49 -f 144490000 - -a 200000 -r ${RS} --code ${CODE} --mask ${RS} --filter ${TERM_ADDR} -q -b | \
|
( rtl_fsk -g ${GAIN} -f 144490000 - -a 40000 -r ${RS} --code ${CODE} --filter ${TERM_ADDR} -q -b | \
|
||||||
frame_repeater ${DATA_BITS_PER_FRAME} ${TERM_ADDR} | \
|
frame_repeater ${DATA_BITS_PER_FRAME} ${TERM_ADDR} | \
|
||||||
rpitx_fsk - --code ${CODE} -r ${RS} -s ${RS} -g ${TR_SWITCH_GPIO} --packed -- ) >>${LOGFILE} 2>&1 &
|
rpitx_fsk - --code ${CODE} -r ${RS} -s ${RS} -g ${TR_SWITCH_GPIO} --packed -- ) >>${LOGFILE} 2>&1 &
|
||||||
echo $!>${PIDFILE}
|
echo $!>${PIDFILE}
|
||||||
;;
|
;;
|
||||||
start_verbose)
|
start_verbose)
|
||||||
# run in the foreground and log to stderr instead of a logfile
|
# run in the foreground and log to stderr instead of a logfile
|
||||||
rtl_fsk -g 49 -f 144490000 - -a 200000 -r ${RS} --code ${CODE} --mask ${RS} --filter ${TERM_ADDR} -q -b -v | \
|
rtl_fsk -g ${GAIN} -f 144490000 - -a 40000 -r ${RS} --code ${CODE} --filter ${TERM_ADDR} -q -b -v | \
|
||||||
frame_repeater ${DATA_BITS_PER_FRAME} ${TERM_ADDR} | \
|
frame_repeater ${DATA_BITS_PER_FRAME} ${TERM_ADDR} | \
|
||||||
rpitx_fsk - --code ${CODE} -r ${RS} -s ${RS} -g ${TR_SWITCH_GPIO} --packed --
|
rpitx_fsk - --code ${CODE} -r ${RS} -s ${RS} -g ${TR_SWITCH_GPIO} --packed --
|
||||||
;;
|
;;
|
||||||
|
@ -60,8 +54,12 @@ case "$1" in
|
||||||
echo "rtl_fsk failed to start!"
|
echo "rtl_fsk failed to start!"
|
||||||
rm ${PIDFILE}
|
rm ${PIDFILE}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
tx_burst_rpitx $2
|
num_bursts=1
|
||||||
|
if [ "$#" -eq 2 ]; then
|
||||||
|
num_bursts=$2
|
||||||
|
fi
|
||||||
|
tx_burst_rpitx $num_bursts
|
||||||
stop_service
|
stop_service
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ping service script - sends bursts to the frame repeater and logs reply
|
# ping service script - sends bursts to the frame repeater and logs reply
|
||||||
|
# Runs on a Host laptop with HackRF Tx and RTLSDR Rx
|
||||||
# TODO
|
|
||||||
# [X] receive it's own packets
|
|
||||||
# [X] log one one logfile
|
|
||||||
# [X] clean start up and shut down
|
|
||||||
# [X] send a sequence of packets
|
|
||||||
# [X] test with Pi running frame_repeater OTC
|
|
||||||
|
|
||||||
TERM_ADDR=0x1
|
TERM_ADDR=0x1
|
||||||
RS=10000
|
RS=10000
|
||||||
|
|
|
@ -88,6 +88,7 @@ int main(int argc, char *argv[]) {
|
||||||
if (!(rx_status & FREEDV_RX_SYNC)) {
|
if (!(rx_status & FREEDV_RX_SYNC)) {
|
||||||
/* We've lost RX_SYNC so receive burst finished. So now we can Tx the frames we have buffered */
|
/* We've lost RX_SYNC so receive burst finished. So now we can Tx the frames we have buffered */
|
||||||
fprintf(stderr, "frame_repeater: Sending received %d frame burst of %d bytes\n", nframes, bytes_in);
|
fprintf(stderr, "frame_repeater: Sending received %d frame burst of %d bytes\n", nframes, bytes_in);
|
||||||
|
sleep(1);
|
||||||
bytes_out = 0; burst_control = 1;
|
bytes_out = 0; burst_control = 1;
|
||||||
while(bytes_out != bytes_in) {
|
while(bytes_out != bytes_in) {
|
||||||
fwrite(&burst_control, sizeof(uint8_t), 1, stdout);
|
fwrite(&burst_control, sizeof(uint8_t), 1, stdout);
|
||||||
|
|
|
@ -510,28 +510,18 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (carrier_test) {
|
if (carrier_test) {
|
||||||
fprintf(stderr, "Carrier test mode 1 sec on/off , Ctrl-C to exit\n");
|
fprintf(stderr, "Carrier test mode, Ctrl-C to exit\n");
|
||||||
int count = 0;
|
|
||||||
int cycles = 0;
|
|
||||||
float VCOfreqHz = 0;
|
float VCOfreqHz = 0;
|
||||||
|
if (*ant_switch_gpio_path) sys_gpio(ant_switch_gpio_path, "1");
|
||||||
fmmod->clkgpio::enableclk(4);
|
fmmod->clkgpio::enableclk(4);
|
||||||
while(running) {
|
while(running) usleep(1000);
|
||||||
//fmmod->SetFrequencySamples(&VCOfreqHz,1);
|
if (*ant_switch_gpio_path) sys_gpio(ant_switch_gpio_path, "0");
|
||||||
while (SetFrequencySampleNonBlocking(fmmod, VCOfreqHz)) usleep(100);
|
|
||||||
count++;
|
|
||||||
if (count == SymbolRate)
|
|
||||||
fmmod->clkgpio::disableclk(4);
|
|
||||||
if (count == 2*SymbolRate) {
|
|
||||||
fmmod->clkgpio::enableclk(4);
|
|
||||||
count = 0;
|
|
||||||
fprintf(stderr,"\rcycles: %d", ++cycles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (one_zero_test) {
|
if (one_zero_test) {
|
||||||
fprintf(stderr, "...010101... test mode, Ctrl-C to exit\n");
|
fprintf(stderr, "...010101... test mode, Ctrl-C to exit\n");
|
||||||
float VCOfreqHz = 0;
|
float VCOfreqHz = 0;
|
||||||
|
if (*ant_switch_gpio_path) sys_gpio(ant_switch_gpio_path, "1");
|
||||||
fmmod->clkgpio::enableclk(4);
|
fmmod->clkgpio::enableclk(4);
|
||||||
while(running) {
|
while(running) {
|
||||||
if (VCOfreqHz == shiftHz)
|
if (VCOfreqHz == shiftHz)
|
||||||
|
@ -540,6 +530,7 @@ int main(int argc, char **argv)
|
||||||
VCOfreqHz = shiftHz;
|
VCOfreqHz = shiftHz;
|
||||||
while (SetFrequencySampleNonBlocking(fmmod, VCOfreqHz)) usleep(100);
|
while (SetFrequencySampleNonBlocking(fmmod, VCOfreqHz)) usleep(100);
|
||||||
}
|
}
|
||||||
|
if (*ant_switch_gpio_path) sys_gpio(ant_switch_gpio_path, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
|
|
Loading…
Reference in New Issue