summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-06-25 05:03:34 -0700
committerKeith Packard <keithp@keithp.com>2012-06-25 05:03:34 -0700
commit70cf32e89df19bde5185339fc703532c8a5b8be6 (patch)
tree1e6bbe7fcc4152d93fb454eb9b06374f02258999
parent246174b32bb6cf827d240c32d6a51c3513a08c37 (diff)
altos: Get cc1120 packet reception working
Interrupt-per-bit, but it seems to work Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/core/ao_viterbi.c19
-rw-r--r--src/drivers/ao_cc1120.c169
-rw-r--r--src/megametrum-v0.1/ao_megametrum.c6
-rw-r--r--src/megametrum-v0.1/ao_pins.h2
-rw-r--r--src/stm/ao_exti.h3
-rw-r--r--src/stm/ao_exti_stm.c5
-rw-r--r--src/test/ao_fec_test.c151
7 files changed, 299 insertions, 56 deletions
diff --git a/src/core/ao_viterbi.c b/src/core/ao_viterbi.c
index bb93bc83..594c0d91 100644
--- a/src/core/ao_viterbi.c
+++ b/src/core/ao_viterbi.c
@@ -55,16 +55,19 @@ struct ao_soft_sym {
#define NUM_HIST 8
#define MOD_HIST(b) ((b) & 7)
+#define V_0 0xc0
+#define V_1 0x40
+
static const struct ao_soft_sym ao_fec_decode_table[NUM_STATE][2] = {
/* next 0 1 state */
- { { 0x00, 0x00 }, { 0xff, 0xff } } , /* 000 */
- { { 0x00, 0xff }, { 0xff, 0x00 } }, /* 001 */
- { { 0xff, 0xff }, { 0x00, 0x00 } }, /* 010 */
- { { 0xff, 0x00 }, { 0x00, 0xff } }, /* 011 */
- { { 0xff, 0xff }, { 0x00, 0x00 } }, /* 100 */
- { { 0xff, 0x00 }, { 0x00, 0xff } }, /* 101 */
- { { 0x00, 0x00 }, { 0xff, 0xff } }, /* 110 */
- { { 0x00, 0xff }, { 0xff, 0x00 } } /* 111 */
+ { { V_0, V_0 }, { V_1, V_1 } } , /* 000 */
+ { { V_0, V_1 }, { V_1, V_0 } }, /* 001 */
+ { { V_1, V_1 }, { V_0, V_0 } }, /* 010 */
+ { { V_1, V_0 }, { V_0, V_1 } }, /* 011 */
+ { { V_1, V_1 }, { V_0, V_0 } }, /* 100 */
+ { { V_1, V_0 }, { V_0, V_1 } }, /* 101 */
+ { { V_0, V_0 }, { V_1, V_1 } }, /* 110 */
+ { { V_0, V_1 }, { V_1, V_0 } } /* 111 */
};
static inline uint8_t
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c
index 67a36c5c..4378716d 100644
--- a/src/drivers/ao_cc1120.c
+++ b/src/drivers/ao_cc1120.c
@@ -19,6 +19,7 @@
#include <ao_cc1120.h>
#include <ao_exti.h>
#include <ao_fec.h>
+#include <ao_packet.h>
uint8_t ao_radio_wake;
uint8_t ao_radio_mutex;
@@ -102,6 +103,35 @@ ao_radio_reg_write(uint16_t addr, uint8_t value)
ao_radio_deselect();
}
+static void
+ao_radio_burst_read_start (uint16_t addr)
+{
+ uint8_t data[2];
+ uint8_t d;
+
+ if (CC1120_IS_EXTENDED(addr)) {
+ data[0] = ((1 << CC1120_READ) |
+ (1 << CC1120_BURST) |
+ CC1120_EXTENDED);
+ data[1] = addr;
+ d = 2;
+ } else {
+ data[0] = ((1 << CC1120_READ) |
+ (1 << CC1120_BURST) |
+ addr);
+ d = 1;
+ }
+ ao_radio_select();
+ ao_radio_spi_send(data, d);
+}
+
+static void
+ao_radio_burst_read_stop (void)
+{
+ ao_radio_deselect();
+}
+
+
static uint8_t
ao_radio_strobe(uint8_t addr)
{
@@ -248,9 +278,18 @@ ao_radio_rx_done(void)
}
static void
+ao_radio_tx_isr(void)
+{
+ ao_exti_disable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
+ ao_radio_wake = 1;
+ ao_wakeup(&ao_radio_wake);
+}
+
+static void
ao_radio_start_tx(void)
{
ao_radio_reg_write(CC1120_IOCFG2, CC1120_IOCFG_GPIO_CFG_RX0TX1_CFG);
+ ao_exti_set_callback(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, ao_radio_tx_isr);
ao_exti_enable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
ao_radio_strobe(CC1120_STX);
}
@@ -336,29 +375,13 @@ void
ao_radio_send(void *d, uint8_t size)
{
uint8_t marc_status;
- uint8_t prepare[size + AO_FEC_PREPARE_EXTRA];
- uint8_t prepare_len;
- uint8_t encode[sizeof(prepare) * 2];
+ uint8_t encode[size + AO_FEC_PREPARE_EXTRA];
uint8_t encode_len;
- uint8_t interleave[sizeof(encode)];
- uint8_t interleave_len;
- fec_dump_bytes(d, size, "Input");
+ encode_len = ao_fec_encode(d, size, encode);
- prepare_len = ao_fec_prepare(d, size, prepare);
- fec_dump_bytes(prepare, prepare_len, "Prepare");
-
- ao_fec_whiten(prepare, prepare_len, prepare);
- fec_dump_bytes(prepare, prepare_len, "Whiten");
-
- encode_len = ao_fec_encode(prepare, prepare_len, encode);
- fec_dump_bytes(encode, encode_len, "Encode");
-
- interleave_len = ao_fec_interleave(encode, encode_len, interleave);
- fec_dump_bytes(interleave, interleave_len, "Interleave");
-
- ao_radio_get(interleave_len);
- ao_radio_fifo_write(interleave, interleave_len);
+ ao_radio_get(encode_len);
+ ao_radio_fifo_write(encode, encode_len);
ao_radio_wake = 0;
@@ -373,34 +396,92 @@ ao_radio_send(void *d, uint8_t size)
ao_radio_put();
}
+#define AO_RADIO_MAX_RECV 90
+
+static uint8_t rx_data[2048];
+static uint16_t rx_data_count;
+static uint16_t rx_data_cur;
+static uint8_t rx_started;
+
+static void
+ao_radio_rx_isr(void)
+{
+ if (rx_started) {
+ rx_data[rx_data_cur++] = stm_spi2.dr;
+ if (rx_data_cur >= rx_data_count) {
+ ao_exti_disable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
+ ao_radio_wake = 1;
+ ao_wakeup(&ao_radio_wake);
+ }
+ } else {
+ (void) stm_spi2.dr;
+ rx_started = 1;
+ }
+ stm_spi2.dr = 0x00;
+}
+
uint8_t
ao_radio_recv(__xdata void *d, uint8_t size)
{
- uint8_t marc_status = CC1120_MARC_STATUS1_NO_FAILURE;
+ uint8_t len = ((size - 2) + 4) * 2; /* two bytes for status */
+ uint16_t i;
+
+ rx_data_count = sizeof (rx_data);
+ rx_data_cur = 0;
+ rx_started = 0;
+
+ printf ("len %d rx_data_count %d\n", len, rx_data_count);
/* configure interrupt pin */
- ao_radio_get(size);
+ ao_radio_get(len);
ao_radio_wake = 0;
+ ao_radio_abort = 0;
+
+ ao_radio_reg_write(CC1120_PKT_CFG2,
+ (CC1120_PKT_CFG2_CCA_MODE_ALWAYS_CLEAR << CC1120_PKT_CFG2_CCA_MODE) |
+ (CC1120_PKT_CFG2_PKT_FORMAT_SYNCHRONOUS_SERIAL << CC1120_PKT_CFG2_PKT_FORMAT));
+
+ ao_radio_reg_write(CC1120_EXT_CTRL, 0);
+
+ ao_radio_reg_write(CC1120_IOCFG2, CC1120_IOCFG_GPIO_CFG_CLKEN_SOFT);
+
+ stm_spi2.cr2 = 0;
+
+ /* clear any RXNE */
+ (void) stm_spi2.dr;
+
+ ao_exti_set_callback(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, ao_radio_rx_isr);
ao_exti_enable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
+
ao_radio_strobe(CC1120_SRX);
- cli();
- for (;;) {
- if (ao_radio_abort)
- break;
- if (ao_radio_wake) {
- marc_status = ao_radio_marc_status();
- if (marc_status != CC1120_MARC_STATUS1_NO_FAILURE)
- break;
- ao_radio_wake = 0;
- }
+ ao_radio_burst_read_start(CC1120_SOFT_RX_DATA_OUT);
+#if 1
+ cli();
+ while (!ao_radio_wake && !ao_radio_abort)
ao_sleep(&ao_radio_wake);
- }
sei();
- if (marc_status != CC1120_MARC_STATUS1_RX_FINISHED)
- ao_radio_fifo_read(d, size);
+
+#else
+ printf ("Hit a character to stop..."); flush();
+ getchar();
+ putchar('\n');
+ ao_exti_disable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
+#endif
+ ao_radio_burst_read_stop();
+
+ ao_radio_strobe(CC1120_SIDLE);
+
ao_radio_put();
- return marc_status == CC1120_MARC_STATUS1_RX_FINISHED;
+
+ printf ("Received data:");
+ for (i = 0; i < rx_data_cur; i++) {
+ if ((i & 15) == 0)
+ printf ("\n");
+ printf (" %02x", rx_data[i]);
+ }
+ printf ("\n");
+ return 1;
}
/*
@@ -477,13 +558,6 @@ static const uint16_t radio_setup[] = {
static uint8_t ao_radio_configured = 0;
-static void
-ao_radio_isr(void)
-{
- ao_exti_disable(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN);
- ao_radio_wake = 1;
- ao_wakeup(&ao_radio_wake);
-}
static void
ao_radio_setup(void)
@@ -745,6 +819,12 @@ static void ao_radio_packet(void) {
ao_radio_send(packet, sizeof (packet));
}
+void
+ao_radio_test_recv()
+{
+ ao_radio_recv(0, 34);
+}
+
#endif
static const struct ao_cmds ao_radio_cmds[] = {
@@ -753,6 +833,7 @@ static const struct ao_cmds ao_radio_cmds[] = {
{ ao_radio_show, "R\0Show CC1120 status" },
{ ao_radio_beep, "b\0Emit an RDF beacon" },
{ ao_radio_packet, "p\0Send a test packet" },
+ { ao_radio_test_recv, "q\0Recv a test packet" },
#endif
{ 0, NULL }
};
@@ -776,7 +857,7 @@ ao_radio_init(void)
/* Enable the EXTI interrupt for the appropriate pin */
ao_enable_port(AO_CC1120_INT_PORT);
- ao_exti_setup(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, AO_EXTI_MODE_FALLING, ao_radio_isr);
+ ao_exti_setup(&AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, AO_EXTI_MODE_FALLING, ao_radio_tx_isr);
ao_cmd_register(&ao_radio_cmds[0]);
}
diff --git a/src/megametrum-v0.1/ao_megametrum.c b/src/megametrum-v0.1/ao_megametrum.c
index dc9c0d19..a2ac186b 100644
--- a/src/megametrum-v0.1/ao_megametrum.c
+++ b/src/megametrum-v0.1/ao_megametrum.c
@@ -44,9 +44,9 @@ main(void)
ao_i2c_init();
ao_hmc5883_init();
ao_mpu6000_init();
- ao_flight_init();
- ao_log_init();
- ao_report_init();
+// ao_flight_init();
+// ao_log_init();
+// ao_report_init();
ao_telemetry_init();
ao_config_init();
diff --git a/src/megametrum-v0.1/ao_pins.h b/src/megametrum-v0.1/ao_pins.h
index 5c5c5972..9d9113c8 100644
--- a/src/megametrum-v0.1/ao_pins.h
+++ b/src/megametrum-v0.1/ao_pins.h
@@ -255,7 +255,7 @@ struct ao_adc {
#define AO_MPU6000_INT_PIN 13
#define AO_MPU6000_I2C_INDEX STM_I2C_INDEX(1)
-#define HAS_HIGHG_ACCEL 1
+#define HAS_HIGHG_ACCEL 0
#define NUM_CMDS 16
diff --git a/src/stm/ao_exti.h b/src/stm/ao_exti.h
index 43eaa52f..87a072e7 100644
--- a/src/stm/ao_exti.h
+++ b/src/stm/ao_exti.h
@@ -27,6 +27,9 @@ void
ao_exti_setup(struct stm_gpio *gpio, uint8_t pin, uint8_t mode, void (*callback)());
void
+ao_exti_set_callback(struct stm_gpio *gpio, uint8_t pin, void (*callback)());
+
+void
ao_exti_enable(struct stm_gpio *gpio, uint8_t pin);
void
diff --git a/src/stm/ao_exti_stm.c b/src/stm/ao_exti_stm.c
index 0fa24188..683a91b3 100644
--- a/src/stm/ao_exti_stm.c
+++ b/src/stm/ao_exti_stm.c
@@ -95,6 +95,11 @@ ao_exti_setup (struct stm_gpio *gpio, uint8_t pin, uint8_t mode, void (*callback
}
void
+ao_exti_set_callback(struct stm_gpio *gpio, uint8_t pin, void (*callback)()) {
+ ao_exti_callback[pin] = callback;
+}
+
+void
ao_exti_enable(struct stm_gpio *gpio, uint8_t pin) {
uint32_t mask = (1 << pin);
stm_exti.pr = mask;
diff --git a/src/test/ao_fec_test.c b/src/test/ao_fec_test.c
index c7509728..98067486 100644
--- a/src/test/ao_fec_test.c
+++ b/src/test/ao_fec_test.c
@@ -126,6 +126,156 @@ ao_random_data(uint8_t *out, uint8_t out_len)
}
+static uint8_t real_pack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c5, 0xc2, 0xc4, 0x36, 0x3e, 0xd1, 0xc3,
+ 0xc2, 0xc3, 0xc5, 0x33, 0xd0, 0xc5, 0xc4, 0x35, 0x40, 0x40, 0x3e, 0x41, 0x3e, 0xd2, 0x30, 0x3f,
+ 0x3e, 0x3d, 0x21, 0xc8, 0x0d, 0x23, 0xec, 0xb1, 0x1a, 0xf0, 0xf3, 0x10, 0xc6, 0xbd, 0x5b, 0x0d,
+ 0xff, 0xe2, 0xe6, 0xd4, 0x72, 0xe2, 0xda, 0x0c, 0xf8, 0x1b, 0x04, 0x0b, 0xf7, 0xb4, 0xf0, 0x44,
+ 0xcd, 0xaf, 0x12, 0x1f, 0x11, 0xa1, 0x29, 0xb8, 0x1a, 0xdb, 0x09, 0x69, 0xf7, 0x20, 0xc4, 0x1c,
+ 0xc0, 0xc8, 0x1d, 0x45, 0xd9, 0x30, 0xd8, 0x2e, 0xd8, 0x2e, 0xd6, 0x2c, 0xd5, 0x2d, 0xd4, 0x2b,
+ 0xd5, 0x2b, 0xd1, 0x31, 0xd0, 0x32, 0xd2, 0x30, 0xd0, 0x31, 0xd0, 0x31, 0xce, 0x2f, 0xd3, 0x2e,
+ 0xce, 0x2f, 0xd1, 0x31, 0x3c, 0xd1, 0x2d, 0xd0, 0xc0, 0x2e, 0x3c, 0x3d, 0xd1, 0xc3, 0x2c, 0xd2,
+ 0xc3, 0xc5, 0x31, 0x40, 0x40, 0xd5, 0x2c, 0x3a, 0x3d, 0xd0, 0x2b, 0xd3, 0xc0, 0xc0, 0x2d, 0xd4,
+ 0x2c, 0x3f, 0x3e, 0x3c, 0x3f, 0x3c, 0xd2, 0xc1, 0xc2, 0xc0, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0x2a,
+};
+
+
+void
+ao_real_packet(void)
+{
+ uint8_t decode[64];
+ uint8_t decode_len;
+ int off;
+
+ for (off = 0; off < sizeof (real_packet) - 576; off++) {
+ decode_len = ao_fec_decode(real_packet+off, 576, decode);
+
+ if (ao_fec_check_crc(decode, 32)) {
+ printf ("match at %d\n", off);
+
+ ao_fec_dump_bytes(decode, decode_len, "Decode");
+ }
+ }
+}
+
int
main(int argc, char **argv)
{
@@ -149,6 +299,7 @@ main(int argc, char **argv)
int errors = 0;
int error;
+ ao_real_packet(); exit(0);
srandom(0);
for (trial = 0; trial < 10000; trial++) {