From 3abd47494b386774305cdbf0e9e6491b28dab298 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Tue, 16 Feb 2021 14:12:13 +0100 Subject: [PATCH 1/3] Fixing DMA2 instantiation issue --- src/hardware/configuration.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hardware/configuration.rs b/src/hardware/configuration.rs index 52db011..fba7048 100644 --- a/src/hardware/configuration.rs +++ b/src/hardware/configuration.rs @@ -134,6 +134,12 @@ pub fn setup( let dma_streams = hal::dma::dma::StreamsTuple::new(device.DMA1, ccdr.peripheral.DMA1); + #[cfg(feature = "pounder_v1_1")] + let dma2_streams = hal::dma::dma::StreamsTuple::new( + device.DMA2, + ccdr.peripheral.DMA2, + ); + // Configure timer 2 to trigger conversions for the ADC let mut sampling_timer = { // The timer frequency is manually adjusted below, so the 1KHz setting here is a @@ -740,11 +746,6 @@ pub fn setup( #[cfg(feature = "pounder_v1_1")] let pounder_stamper = { - let dma2_streams = hal::dma::dma::StreamsTuple::new( - device.DMA2, - ccdr.peripheral.DMA2, - ); - let etr_pin = gpioa.pa0.into_alternate_af3(); // The frequency in the constructor is dont-care, as we will modify the period + clock From fdb0c40764afcfc208e86e3d2a799d6c0e585d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 16 Feb 2021 15:22:58 +0100 Subject: [PATCH 2/3] fmt --- src/hardware/configuration.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hardware/configuration.rs b/src/hardware/configuration.rs index fba7048..dabd2ef 100644 --- a/src/hardware/configuration.rs +++ b/src/hardware/configuration.rs @@ -135,10 +135,8 @@ pub fn setup( hal::dma::dma::StreamsTuple::new(device.DMA1, ccdr.peripheral.DMA1); #[cfg(feature = "pounder_v1_1")] - let dma2_streams = hal::dma::dma::StreamsTuple::new( - device.DMA2, - ccdr.peripheral.DMA2, - ); + let dma2_streams = + hal::dma::dma::StreamsTuple::new(device.DMA2, ccdr.peripheral.DMA2); // Configure timer 2 to trigger conversions for the ADC let mut sampling_timer = { From aeaeac1f17e2cc5ea705edd7d8cad81bd688d8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 16 Feb 2021 15:58:16 +0100 Subject: [PATCH 3/3] add comment on dma2 init --- src/hardware/configuration.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardware/configuration.rs b/src/hardware/configuration.rs index dabd2ef..8ba24fe 100644 --- a/src/hardware/configuration.rs +++ b/src/hardware/configuration.rs @@ -134,6 +134,7 @@ pub fn setup( let dma_streams = hal::dma::dma::StreamsTuple::new(device.DMA1, ccdr.peripheral.DMA1); + // Early, before the DMA1 peripherals (#272) #[cfg(feature = "pounder_v1_1")] let dma2_streams = hal::dma::dma::StreamsTuple::new(device.DMA2, ccdr.peripheral.DMA2);