Merge branch 'SpringCleaning'

master
James Peroulas 2017-03-03 05:46:47 +00:00
commit 1dbcdd7af2
8 zmienionych plików z 708 dodań i 641 usunięć

2
.gitignore vendored
Wyświetl plik

@ -1,3 +1,3 @@
wspr
gpioclk
mailbox.o

20
BUILD
Wyświetl plik

@ -1,20 +0,0 @@
Install required packages:
sudo apt-get install git g++ make grep mawk ntp
Make sure you are using the latest kernel by updating your system. The latest
kernel includes fixes wich improve NTP ppm measurement accuracy:
sudo apt-get update
sudo apt-get dist-upgrade
Get code/ compile:
rm -rf WsprryPi
git clone https://github.com/JamesP6000/WsprryPi.git
cd WsprryPi
make
Install to /usr/local/bin:
sudo make install
Uninstall:
sudo make uninstall

54
README
Wyświetl plik

@ -4,23 +4,22 @@ Makes a very simple WSPR beacon from your RasberryPi by connecting GPIO
port to Antenna (and LPF), operates on LF, MF, HF and VHF bands from
0 to 250 MHz.
It is now compatible with both the original Raspberry Pi and the Raspberry Pi 2.
Compatible with the original Raspberry Pi and the Raspberry Pi 2/3.
******
Installation / update:
******
Make sure you are using the latest kernel by updating your system. The latest
kernel includes fixes wich improve NTP ppm measurement accuracy:
sudo apt-get update
sudo apt-get dist-upgrade
Download and compile code:
sudo apt-get install git
git clone https://github.com/JamesP6000/WsprryPi.git
cd WsprryPi
make
See the accompanying BUILD file for more details.
Install to /usr/local/bin:
sudo make install
Uninstall:
sudo make uninstall
******
Usage: (WSPR --help output):
@ -36,9 +35,13 @@ Usage: (WSPR --help output):
-p --ppm ppm
Known PPM correction to 19.2MHz RPi nominal crystal frequency.
-s --self-calibration
Call ntp_adjtime() before every transmission to obtain the PPM error of the xtal.
Check NTP before every transmission to obtain the PPM error of the
crystal (default setting!).
-f --free-running
Do not use NTP to correct frequency error of RPi crystal.
-r --repeat
Repeatedly, and in order, transmit on all the specified freqs.
Repeatedly, and in order, transmit on all the specified command line
freqs.
-x --terminate <n>
Terminate after n transmissions have been completed.
-o --offset
@ -46,7 +49,7 @@ Usage: (WSPR --help output):
+/- 80 Hz for WSPR
+/- 8 Hz for WSPR-15
-t --test-tone freq
Simply output a test tone and the specified frequency. Only used
Simply output a test tone at the specified frequency. Only used
for debugging and to verify calibration.
-n --no-delay
Transmit immediately, do not wait for a WSPR TX window. Used
@ -59,7 +62,7 @@ Usage: (WSPR --help output):
<B>-15 indicates the WSPR-15 region of band <B>.
Transmission gaps can be created by specifying a TX frequency of 0
Note that 'callsign', 'locator', and 'tx_power_dBm' are simply used to fill
in the appropriate fields of the WSPR message. Normally, tx_power_dBm should
be 10, representing the signal power coming out of the Pi. Set this value
@ -74,8 +77,14 @@ Radio licensing / RF:
of your Raspberry Pi, connect an antenna to the LPF. The GPIO4 and GND pins
are found on header P1 pin 7 and 9 respectively, the pin closest to P1 label
is pin 1 and its 3rd and 4th neighbour is pin 7 and 9 respectively. See this
link for pin layout: http://elinux.org/RPi_Low-level_peripherals Examples of
low-pass filters can be found here: http://www.gqrp.com/harmonic_filters.pdf
link for pin layout: http://elinux.org/RPi_Low-level_peripherals
Examples of low-pass filters can be found here:
http://www.gqrp.com/harmonic_filters.pdf
TAPR makes a very nice shield for the Raspberry Pi that is pre-assembled,
performs the appropriate filtering for the 20m band, and also increases
the power output to 20dBm! Just connect your antenna and you're good-to-go!
https://www.tapr.org/kits_20M-wspr-pi.html
The expected power output is 10mW (+10dBm) in a 50 Ohm load. This looks
neglible, but when connected to a simple dipole antenna this may result in
@ -115,6 +124,10 @@ TX Timing:
******
Calibration:
******
As of 2017-02, NTP calibration is enabled by default and produces a
frequency error of about 0.1 PPM after the Pi has temperature stabilized
and the NTP loop has converged.
Frequency calibration is REQUIRED to ensure that the WSPR-2 transmission
occurs within the narrow 200 Hz band. The reference crystal on your RPi might
have an frequency error (which in addition is temp. dependent -1.3Hz/degC
@ -157,8 +170,7 @@ PWM Peripheral:
by editing /etc/modules and commenting out the snd-bcm2835 device.
******
Example usage:
******
Example usage: ******
Brief help screen
./wspr --help
@ -168,15 +180,18 @@ Example usage:
Using callsign N9NNN, locator EM10, and TX power 33 dBm, transmit a single
WSPR transmission on the 20m band using NTP based frequency offset
calibration.
sudo ./wspr --self-calibration N9NNN EM10 33 20m
sudo ./wspr N9NNN EM10 33 20m
The same as above, but without NTP calibration:
sudo ./wspr --free-running N9NNN EM10 33 20m
Transmit a WSPR transmission slightly off-center on 30m every 10 minutes for
a total of 7 transmissions, and using a fixed PPM correction value. sudo
a total of 7 transmissions, and using a fixed PPM correction value.
sudo ./wspr --repeat --terminate 7 --ppm 43.17 N9NNN EM10 33 10140210 0 0 0 0
Transmit repeatedly on 40m, use NTP based frequency offset calibration,
and add a random frequency offset to each transmission to minimize collisions
with other transmissions.
with other transmitters.
sudo ./wspr --repeat --offset --self-calibration N9NNN EM10 33 40m
******
@ -213,6 +228,9 @@ Credits:
Michael Tatarinov for adding a patch to get PPM info directly from the
kernel.
Retzler András (HA7ILM) for the massive changes that were required to
incorporate the mailbox code so that the RPi2 and RPi3 could be supported.
[1] PiFM code from
http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter
[2] Original WSPR Pi transmitter code by Dan:

Wyświetl plik

@ -49,17 +49,13 @@ using namespace std;
#define F_XTAL (19200000.0)
#define F_PLLD_CLK (500000000.0)
//Now we autodetect it via makefile.
// Choose proper base address depending on RPI1/RPI2 setting from makefile.
#ifdef RPI2
#define BCM2708_PERI_BASE 0x3f000000
#pragma message "Raspberry Pi 2 detected."
//#pragma message "Raspberry Pi 2/3 detected."
#else
#define BCM2708_PERI_BASE 0x20000000
#pragma message "Raspberry Pi 1 detected."
//#pragma message "Raspberry Pi 1 detected."
#endif
#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
@ -284,9 +280,9 @@ void parse_commandline(
ABORT(-1);
break;
case 's':
if (!strcmp(optarg,"PLLD")) {
if (!strcasecmp(optarg,"PLLD")) {
source=PLLD;
} else if (!strcmp(optarg,"XTAL")) {
} else if (!strcasecmp(optarg,"XTAL")) {
source=XTAL;
} else {
cerr << "Error: unrecognized frequency source" << endl;
@ -351,6 +347,12 @@ void parse_commandline(
}
int main(const int argc, char * const argv[]) {
#ifdef RPI1
std::cout << "Detected Raspberry Pi version 1" << std::endl;
#else
std::cout << "Detected Raspberry Pi version 2/3" << std::endl;
#endif
// Parse arguments
source_t source;
bool freq_specified;

Wyświetl plik

@ -247,7 +247,7 @@ int mbox_open() {
// Open a char device file used for communicating with kernel mbox driver.
file_desc = open(DEVICE_FILE_NAME, 0);
if(file_desc >= 0) {
printf("Using mbox device " DEVICE_FILE_NAME ".\n");
//printf("Using mbox device " DEVICE_FILE_NAME ".\n");
return file_desc;
}
@ -255,14 +255,14 @@ int mbox_open() {
unlink(LOCAL_DEVICE_FILE_NAME);
if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_A, 0)) >= 0 &&
(file_desc = open(LOCAL_DEVICE_FILE_NAME, 0)) >= 0) {
printf("Using local mbox device file with major %d.\n", MAJOR_NUM_A);
//printf("Using local mbox device file with major %d.\n", MAJOR_NUM_A);
return file_desc;
}
unlink(LOCAL_DEVICE_FILE_NAME);
if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_B, 0)) >= 0 &&
(file_desc = open(LOCAL_DEVICE_FILE_NAME, 0)) >= 0) {
printf("Using local mbox device file with major %d.\n", MAJOR_NUM_B);
//printf("Using local mbox device file with major %d.\n", MAJOR_NUM_B);
return file_desc;
}

Wyświetl plik

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MAJOR_NUM_B 100
#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM_B, 0, char *)
#define DEVICE_FILE_NAME "/dev/vcio"
#define LOCAL_DEVICE_FILE_NAME "mbox"
#define LOCAL_DEVICE_FILE_NAME "/tmp/mbox"
int mbox_open();
void mbox_close(int file_desc);

Wyświetl plik

@ -5,14 +5,14 @@ pi_version_flag = $(if $(call archis,armv7,dummy-text),-DRPI2,-DRPI1)
all: wspr gpioclk
mailbox.o:
mailbox.o: mailbox.c mailbox.h
g++ -c -Wall -lm mailbox.c
wspr: mailbox.o wspr.cpp
g++ -Wall -lm $(pi_version_flag) mailbox.o wspr.cpp -owspr
wspr: mailbox.o wspr.cpp mailbox.h
g++ -D_GLIBCXX_DEBUG -std=c++11 -Wall -Werror -fmax-errors=5 -lm $(pi_version_flag) mailbox.o wspr.cpp -owspr
gpioclk: gpioclk.cpp
g++ -Wall -lm $(pi_version_flag) gpioclk.cpp -ogpioclk
g++ -D_GLIBCXX_DEBUG -std=c++11 -Wall -Werror -fmax-errors=5 -lm $(pi_version_flag) gpioclk.cpp -ogpioclk
clean:
-rm gpioclk

1237
wspr.cpp

Plik diff jest za duży Load Diff