This repository has been archived by the owner on Apr 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added folder for testbenches and Makefile support to compile them. Ad…
…ded acquisition testbench.
- Loading branch information
Showing
4 changed files
with
137 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
BINARY = acq_test | ||
|
||
OBJS = acq_test.o \ | ||
../../src/debug.o \ | ||
../../src/swift_nap_io.o \ | ||
../../src/acq.o \ | ||
../../src/track.o \ | ||
../../src/nav_msg.o \ | ||
../../src/hw/max2769.o \ | ||
../../src/hw/m25_flash.o \ | ||
../../src/hw/leds.o \ | ||
../../src/hw/spi.o \ | ||
../../src/hw/usart.o \ | ||
|
||
CFLAGS += -I../../src/ | ||
|
||
include ../../stm32/Makefile.include | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (C) 2011 Fergus Noble <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <libopencm3/stm32/f2/rcc.h> | ||
#include <libopencm3/stm32/f2/flash.h> | ||
#include <libopencm3/stm32/f2/gpio.h> | ||
|
||
#include "main.h" | ||
#include "debug.h" | ||
#include "swift_nap_io.h" | ||
#include "acq.h" | ||
#include "hw/leds.h" | ||
|
||
const clock_scale_t hse_16_368MHz_in_65_472MHz_out_3v3 = | ||
{ /* 65.472 MHz */ | ||
.pllm = 16, | ||
.plln = 256, | ||
.pllp = 4, | ||
.pllq = 6, | ||
.hpre = RCC_CFGR_HPRE_DIV_NONE, | ||
.ppre1 = RCC_CFGR_PPRE_DIV_4, | ||
.ppre2 = RCC_CFGR_PPRE_DIV_4, | ||
.flash_config = FLASH_ICE | FLASH_DCE | FLASH_LATENCY_2WS, | ||
.apb1_frequency = 16368000, | ||
.apb2_frequency = 16368000, | ||
}; | ||
|
||
int main(void) | ||
{ | ||
for (u32 i = 0; i < 600000; i++) | ||
__asm__("nop"); | ||
|
||
led_setup(); | ||
|
||
rcc_clock_setup_hse_3v3(&hse_16_368MHz_in_65_472MHz_out_3v3); | ||
|
||
debug_setup(); | ||
|
||
printf("\n\nFirmware info - git: " GIT_VERSION ", built: " __DATE__ " " __TIME__ "\n"); | ||
printf("--- ACQ TEST ---\n"); | ||
|
||
swift_nap_setup(); | ||
swift_nap_reset(); | ||
|
||
float code_phase; | ||
float carrier_freq; | ||
float snr; | ||
|
||
acq_set_load_enable_blocking(); | ||
timing_strobe(timing_count() + 1000); | ||
wait_for_exti(); | ||
acq_clear_load_enable_blocking(); | ||
|
||
for (u8 prn=0; prn<32; prn++) { | ||
do_acq(prn, 0, 1023, -7000, 7000, 300, &code_phase, &carrier_freq, &snr); | ||
|
||
printf("PRN %2u - Code phase: %7.2f, Carrier Freq: % 7.1f, SNR: %5.2f", prn+1, code_phase, carrier_freq, snr); | ||
if (snr > 8.0) | ||
printf(" :D\n"); | ||
else | ||
printf("\n"); | ||
} | ||
|
||
printf("DONE!\n"); | ||
led_on(LED_GREEN); | ||
while (1); | ||
|
||
return 0; | ||
} | ||
|