summaryrefslogtreecommitdiff
path: root/controller/fw/src/main.c
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-13 18:19:02 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-13 18:19:02 +0100
commit1b7ae0aeefb4ccb2913c3bd8a2f5ac1c84b0a75d (patch)
tree820c2f3f174a57e363885bf0ededfb9efb48a4ed /controller/fw/src/main.c
parent838eb6b26e4acc53cda47abaca6ed6392ae31ffc (diff)
downloadmaster-thesis-1b7ae0aeefb4ccb2913c3bd8a2f5ac1c84b0a75d.tar.gz
master-thesis-1b7ae0aeefb4ccb2913c3bd8a2f5ac1c84b0a75d.tar.bz2
master-thesis-1b7ae0aeefb4ccb2913c3bd8a2f5ac1c84b0a75d.zip
having problems with dma m2m mode
Diffstat (limited to 'controller/fw/src/main.c')
-rw-r--r--controller/fw/src/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/controller/fw/src/main.c b/controller/fw/src/main.c
index 58977f7..4f2d67b 100644
--- a/controller/fw/src/main.c
+++ b/controller/fw/src/main.c
@@ -96,6 +96,8 @@ static void spi_flash_if_set_cs(bool val) {
static void spi_flash_setup(void)
{
+ RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
+
GPIOB->MODER &= ~GPIO_MODER_MODER3_Msk & ~GPIO_MODER_MODER4_Msk & ~GPIO_MODER_MODER5_Msk & ~GPIO_MODER_MODER0_Msk;
GPIOB->MODER |= (2<<GPIO_MODER_MODER3_Pos) /* SCK */
| (2<<GPIO_MODER_MODER4_Pos) /* MISO */
@@ -114,7 +116,7 @@ static void spi_flash_setup(void)
RCC->APB2ENR |= RCC_APB2ENR_SPI1EN;
RCC->APB2RSTR |= RCC_APB2RSTR_SPI1RST;
- RCC->APB2RSTR &= RCC_APB2RSTR_SPI1RST;
+ RCC->APB2RSTR &= ~RCC_APB2RSTR_SPI1RST;
spif_init(&spif, 256, SPI1, &spi_flash_if_set_cs);
}
@@ -142,6 +144,7 @@ void spi_flash_test(void) {
static unsigned int measurement_errors = 0;
static struct dsss_demod_state demod_state;
static uint32_t freq_sample_ts = 0;
+static uint32_t debug_last_freq = 0;
int main(void)
{
@@ -152,14 +155,18 @@ int main(void)
while (23) {
if (adc_fft_buf_ready_idx != -1) {
+ /*
float out;
if (adc_buf_measure_freq(adc_fft_buf[adc_fft_buf_ready_idx], &out)) {
measurement_errors++;
continue;
}
+ debug_last_freq = out;
+
dsss_demod_init(&demod_state);
dsss_demod_step(&demod_state, out, freq_sample_ts);
+ */
freq_sample_ts++; /* TODO: also increase in case of freq measurement error? */
adc_fft_buf_ready_idx = -1;