aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-12-30 14:41:19 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-12-30 14:41:19 +0000
commitda90520c9f1ca80168b54d437b0ad65cc0ddbb71 (patch)
treeeaf03488f003547c7f0118ffcc63a7532f49a6ce /testhal
parent15fca876739fcd859f8b53b5eeb43820eb7feb37 (diff)
downloadChibiOS-da90520c9f1ca80168b54d437b0ad65cc0ddbb71.tar.gz
ChibiOS-da90520c9f1ca80168b54d437b0ad65cc0ddbb71.tar.bz2
ChibiOS-da90520c9f1ca80168b54d437b0ad65cc0ddbb71.zip
Starting to work, still problems.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12497 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/multi/ADC/.cproject10
-rw-r--r--testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/mcuconf.h4
-rw-r--r--testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/portab.h1
-rw-r--r--testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Flash and Run).launch2
-rw-r--r--testhal/STM32/multi/ADC/main.c24
5 files changed, 34 insertions, 7 deletions
diff --git a/testhal/STM32/multi/ADC/.cproject b/testhal/STM32/multi/ADC/.cproject
index 1b8427810..07eba767f 100644
--- a/testhal/STM32/multi/ADC/.cproject
+++ b/testhal/STM32/multi/ADC/.cproject
@@ -151,10 +151,16 @@
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- <scannerConfigBuildInfo instanceId="0.365230168">
+ <scannerConfigBuildInfo instanceId="0.365230168.523175374">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
</scannerConfigBuildInfo>
- <scannerConfigBuildInfo instanceId="0.365230168.523175374">
+ <scannerConfigBuildInfo instanceId="0.365230168.523175374.763979647">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="0.365230168.523175374.1174232874">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="0.365230168">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
</scannerConfigBuildInfo>
</storageModule>
diff --git a/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/mcuconf.h b/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/mcuconf.h
index da2d83264..5b6e99c00 100644
--- a/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/mcuconf.h
+++ b/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/mcuconf.h
@@ -223,9 +223,9 @@
#define STM32_GPT_USE_TIM1 FALSE
#define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 FALSE
-#define STM32_GPT_USE_TIM4 FALSE
+#define STM32_GPT_USE_TIM4 TRUE
#define STM32_GPT_USE_TIM5 FALSE
-#define STM32_GPT_USE_TIM6 TRUE
+#define STM32_GPT_USE_TIM6 FALSE
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM9 FALSE
diff --git a/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/portab.h b/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/portab.h
index 56ae995fa..500e4f2ab 100644
--- a/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/portab.h
+++ b/testhal/STM32/multi/ADC/cfg/stm32h743_nucleo144/portab.h
@@ -67,6 +67,7 @@
extern const GPTConfig portab_gptcfg1;
extern const ADCConfig portab_adccfg1;
extern const ADCConversionGroup portab_adcgrpcfg1;
+extern const ADCConversionGroup portab_adcgrpcfg2;
#ifdef __cplusplus
extern "C" {
diff --git a/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Flash and Run).launch b/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Flash and Run).launch
index be98c7537..98cf3d524 100644
--- a/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Flash and Run).launch
+++ b/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Flash and Run).launch
@@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rp-mfs_flash_read-(cast_to_array)&quot; val=&quot;0:511&quot;/&gt;&lt;content id=&quot;rp[507]-rp-mfs_flash_read-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;rp[506]-rp-mfs_flash_read-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;mfs_buffer[507]-null-mfs_test_001_005_execute-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;mfs_buffer[447]-null-mfs_test_001_005_execute-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;xPSR-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[0]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[1]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[2]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[3]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[4]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[5]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[6]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[7]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[8]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[9]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[10]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[11]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[12]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[13]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[14]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[15]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[16]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[17]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[18]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[19]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[20]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[21]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[22]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[23]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[24]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[25]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[26]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[27]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[28]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[29]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[30]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[31]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;rand[31]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[30]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[29]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[28]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[27]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[26]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[25]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[24]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[23]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[22]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[21]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[20]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[19]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[18]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[17]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[16]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[15]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[14]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[13]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[12]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[11]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[10]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[9]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[8]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[7]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[6]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[5]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[4]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[3]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[2]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[1]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;rand[0]-rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;xPSR-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;mfs_buffer[447]-null-mfs_test_001_005_execute-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;mfs_buffer[507]-null-mfs_test_001_005_execute-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;rp[506]-rp-mfs_flash_read-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;rp[507]-rp-mfs_flash_read-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;rp-mfs_flash_read-(cast_to_array)&quot; val=&quot;0:511&quot;/&gt;&lt;content id=&quot;rand-main-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;globalVariableList/&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList&gt;&#10;&lt;memoryBlockExpressionItem&gt;&#10;&lt;expression text=&quot;0x20000c34&quot;/&gt;&#10;&lt;/memoryBlockExpressionItem&gt;&#10;&lt;/memoryBlockExpressionList&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${selected_resource_loc}"/>
diff --git a/testhal/STM32/multi/ADC/main.c b/testhal/STM32/multi/ADC/main.c
index 5464bd7c5..8e26c3819 100644
--- a/testhal/STM32/multi/ADC/main.c
+++ b/testhal/STM32/multi/ADC/main.c
@@ -42,18 +42,23 @@ adcsample_t samples2[CACHE_SIZE_ALIGN(adcsample_t, ADC_GRP2_NUM_CHANNELS * ADC_G
/*
* ADC streaming callback.
*/
-size_t nx = 0, ny = 0;
+size_t n= 0, nx = 0, ny = 0;
void adccallback(ADCDriver *adcp) {
(void)adcp;
/* Updating counters.*/
+ n++;
if (adcIsBufferComplete(adcp)) {
nx += 1;
}
else {
ny += 1;
}
+
+ if ((n % 200) == 0U) {
+ palToggleLine(LINE_LED2);
+ }
}
/*
@@ -112,7 +117,7 @@ int main(void) {
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
- * Activates the PORTAB_ADC1 driver and the temperature sensor.
+ * Starting PORTAB_ADC1 driver and the temperature sensor.
*/
adcStart(&PORTAB_ADC1, &portab_adccfg1);
adcSTM32EnableVREF(&PORTAB_ADC1);
@@ -123,11 +128,26 @@ int main(void) {
cacheBufferInvalidate(samples1, sizeof (samples1) / sizeof (adcsample_t));
/*
+ * Starting PORTAB_GPT1 driver, it is used for triggering the ADC.
+ */
+ gptStart(&PORTAB_GPT1, &portab_gptcfg1);
+
+ /*
+ * Starting an ADC continuous conversion triggered with a period of
+ * 1/10000 second.
+ */
+ adcStartConversion(&PORTAB_ADC1, &portab_adcgrpcfg2,
+ samples2, ADC_GRP2_BUF_DEPTH);
+ gptStartContinuous(&PORTAB_GPT1, 100U);
+
+ /*
* Normal main() thread activity, if the button is pressed then the
* conversion is stopped.
*/
while (true) {
if (palReadLine(PORTAB_LINE_BUTTON) == PORTAB_BUTTON_PRESSED) {
+ gptStopTimer(&PORTAB_GPT1);
+ adcStopConversion(&PORTAB_ADC1);
}
chThdSleepMilliseconds(500);
}