aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c')
-rw-r--r--testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c b/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c
index a71d2540f..0ff6372bf 100644
--- a/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c
+++ b/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c
@@ -47,6 +47,11 @@ size_t nx = 0, ny = 0;
static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void)adcp;
+
+ /* DMA buffer invalidation because data cache.*/
+ dmaBufferInvalidate(buffer, n * ADC_GRP1_NUM_CHANNELS);
+
+ /* Updating counters.*/
if (samples1 == buffer) {
nx += n;
}
@@ -111,11 +116,6 @@ static THD_FUNCTION(Thread1, arg) {
*/
int main(void) {
- SCB_InvalidateICache();
- SCB_EnableICache();
- SCB_InvalidateDCache();
- SCB_EnableDCache();
-
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
@@ -126,6 +126,11 @@ int main(void) {
halInit();
chSysInit();
+ SCB_InvalidateICache();
+ SCB_EnableICache();
+ SCB_InvalidateDCache();
+ SCB_EnableDCache();
+
/*
* Activates the serial driver 1 using the driver default configuration.
*/