Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Test mode: QRSS (FSK-CW + Chirped Hell) #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

if [ -e /usr/src/pico-sdk ]; then
export PICO_SDK_PATH=/usr/src/pico-sdk
fi

mkdir -p build
cd build
cmake ..
make
5 changes: 5 additions & 0 deletions defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@

#define asizeof(a) (sizeof (a) / sizeof ((a)[0]))

#define RUN_TEST_FUNCTION_NAME(x) Spinner ## x ## Test()
#define RUN_TEST(x) RUN_TEST_FUNCTION_NAME(x)
#define Q(x) #x
#define QUOTE(x) Q(x)

#endif
2 changes: 2 additions & 0 deletions protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
void RAM (SpinnerMFSKTest)(void);
void RAM (SpinnerSweepTest)(void);
void RAM (SpinnerRTTYTest)(void);
void RAM (SpinnerQRSSTest)(void);
void RAM (QRSSChirpedHellSymbol)(uint8_t, uint8_t);
void RAM (SpinnerMilliHertzTest)(void);
void RAM (SpinnerWide4FSKTest)(void);
void RAM (SpinnerGPSreferenceTest)(void);
Expand Down
100 changes: 91 additions & 9 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
// SpinnerMilliHertzTest - A test of millihertz resolution of freq.setting.
// SpinnerWide4FSKTest - Some `wide` 4-FSK test (100 Hz per step, 400 Hz overall).
// SpinnerGPSreferenceTest - GPS receiver connection and working test.
// SpinnerQRSSTest - QRSS Chirped Hell and FSK-CW emission.
//
// PLATFORM
// Raspberry Pi pico.
Expand Down Expand Up @@ -85,6 +86,7 @@
#include "piodco/piodco.h"
#include "build/dco2.pio.h"
#include "hardware/vreg.h"
#include "hardware/clocks.h"
#include "pico/multicore.h"
#include "pico/stdio/driver.h"

Expand All @@ -101,6 +103,11 @@
//#define GEN_FRQ_HZ 32333333L
#define GEN_FRQ_HZ 29977777L

// If defined, run the selected test, otherwise run console.
// Tests: MFSK, Sweep, RTTY, MilliHertz, Wide4FSKTest, GPSreference, QRSS
// #define RUN_TEST_NAME QRSS


PioDco DCO; /* External in order to access in both cores. */

int main()
Expand All @@ -112,14 +119,14 @@ int main()
sleep_ms(1000);
printf("Start\n");

#ifndef RUN_TEST_NAME
HFconsoleContext *phfc = HFconsoleInit(-1, 0);
HFconsoleSetWrapper(phfc, ConsoleCommandsWrapper);

gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);

multicore_launch_core1(core1_entry);

for(;;)
{
gpio_put(PICO_DEFAULT_LED_PIN, 0);
Expand All @@ -135,19 +142,16 @@ int main()
int chr = getchar_timeout_us(100);//getchar();
printf("%d %c\n", chr, (char)chr);
}

#else
printf("Running test: " QUOTE(RUN_TEST_NAME));

gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);

multicore_launch_core1(core1_entry);

//SpinnerDummyTest();
//SpinnerSweepTest();
//SpinnerMFSKTest();
SpinnerRTTYTest();
//SpinnerMilliHertzTest();
//SpinnerWide4FSKTest();
//SpinnerGPSreferenceTest();
RUN_TEST(RUN_TEST_NAME);
#endif
}

/* This is the code of dedicated core.
Expand Down Expand Up @@ -232,6 +236,84 @@ void RAM (SpinnerRTTYTest)(void)
}
}

/* This example creates a typical QRSS beacon transmission,
starting with a heart symbol sent in chirped hell with a
pixel width/height of 1.5 seconds and 4 Hz respectively,
followed by a text (e.g. callsign and locator) in FSK-CW
with a dot-length of 6 seconds and 5 Hz frequency shift.
*/

void RAM (SpinnerQRSSTest)(void)
{
const char *code = " - . ... - ";
int32_t df = 5; // FSK-CW frequency shift in Hz

int dotlen = 6000; // dot length in milliseconds
int len; // length of current element
uint32_t txfreq = GEN_FRQ_HZ;

for(;;)
{
sleep_ms(dotlen);

// XX XX 0
// X X X X 1
// X X X 2
// X X 3
// X X 4
// X X 5
// X 6

printf("Heart\n");
QRSSChirpedHellSymbol(1, 2);
QRSSChirpedHellSymbol(0, 3);
QRSSChirpedHellSymbol(0, 4);
QRSSChirpedHellSymbol(1, 5);
QRSSChirpedHellSymbol(2, 6);
QRSSChirpedHellSymbol(5, 1);
QRSSChirpedHellSymbol(4, 0);
QRSSChirpedHellSymbol(3, 0);
QRSSChirpedHellSymbol(2, 1);

for (size_t i = 0; i < strlen(code) ; i++) {
txfreq = GEN_FRQ_HZ;
if (code[i] == '.') {
len = dotlen;
printf(".");
}
else if (code[i] == '-') {
printf("-");
len = 3 * dotlen;
}
else {
printf(" ");
len = 2 * dotlen;
txfreq = GEN_FRQ_HZ - df;
}

gpio_put(PICO_DEFAULT_LED_PIN, 1);
PioDCOSetFreq(&DCO, txfreq, 0u);
sleep_ms(len);
gpio_put(PICO_DEFAULT_LED_PIN, 0);

gpio_put(PICO_DEFAULT_LED_PIN, 1);
PioDCOSetFreq(&DCO, GEN_FRQ_HZ - df, 0u);
sleep_ms(dotlen);
gpio_put(PICO_DEFAULT_LED_PIN, 0);
}
printf("\n");
}
}


void RAM (QRSSChirpedHellSymbol)(uint8_t a, uint8_t b)
{
PioDCOSetFreq(&DCO, GEN_FRQ_HZ - a * 4, 0u);
sleep_ms(1500);
PioDCOSetFreq(&DCO, GEN_FRQ_HZ - b * 4, 0u);
sleep_ms(1500);
}

void RAM (SpinnerMilliHertzTest)(void)
{
int i = 0;
Expand Down