having problems with dma m2m mode
This commit is contained in:
parent
838eb6b26e
commit
1b7ae0aeef
3 changed files with 20 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue