diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-12-30 14:41:19 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-12-30 14:41:19 +0000 |
commit | da90520c9f1ca80168b54d437b0ad65cc0ddbb71 (patch) | |
tree | eaf03488f003547c7f0118ffcc63a7532f49a6ce /testhal | |
parent | 15fca876739fcd859f8b53b5eeb43820eb7feb37 (diff) | |
download | ChibiOS-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')
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="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="rand-main-(format)" val="4"/><content id="rp-mfs_flash_read-(cast_to_array)" val="0:511"/><content id="rp[507]-rp-mfs_flash_read-(format)" val="0"/><content id="rp[506]-rp-mfs_flash_read-(format)" val="0"/><content id="mfs_buffer[507]-null-mfs_test_001_005_execute-(format)" val="0"/><content id="mfs_buffer[447]-null-mfs_test_001_005_execute-(format)" val="0"/><content id="xPSR-(format)" val="4"/><content id="rand[0]-rand-main-(format)" val="4"/><content id="rand[1]-rand-main-(format)" val="4"/><content id="rand[2]-rand-main-(format)" val="4"/><content id="rand[3]-rand-main-(format)" val="4"/><content id="rand[4]-rand-main-(format)" val="4"/><content id="rand[5]-rand-main-(format)" val="4"/><content id="rand[6]-rand-main-(format)" val="4"/><content id="rand[7]-rand-main-(format)" val="4"/><content id="rand[8]-rand-main-(format)" val="4"/><content id="rand[9]-rand-main-(format)" val="4"/><content id="rand[10]-rand-main-(format)" val="4"/><content id="rand[11]-rand-main-(format)" val="4"/><content id="rand[12]-rand-main-(format)" val="4"/><content id="rand[13]-rand-main-(format)" val="4"/><content id="rand[14]-rand-main-(format)" val="4"/><content id="rand[15]-rand-main-(format)" val="4"/><content id="rand[16]-rand-main-(format)" val="4"/><content id="rand[17]-rand-main-(format)" val="4"/><content id="rand[18]-rand-main-(format)" val="4"/><content id="rand[19]-rand-main-(format)" val="4"/><content id="rand[20]-rand-main-(format)" val="4"/><content id="rand[21]-rand-main-(format)" val="4"/><content id="rand[22]-rand-main-(format)" val="4"/><content id="rand[23]-rand-main-(format)" val="4"/><content id="rand[24]-rand-main-(format)" val="4"/><content id="rand[25]-rand-main-(format)" val="4"/><content id="rand[26]-rand-main-(format)" val="4"/><content id="rand[27]-rand-main-(format)" val="4"/><content id="rand[28]-rand-main-(format)" val="4"/><content id="rand[29]-rand-main-(format)" val="4"/><content id="rand[30]-rand-main-(format)" val="4"/><content id="rand[31]-rand-main-(format)" val="4"/></contentList>"/> +<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="rand[31]-rand-main-(format)" val="4"/><content id="rand[30]-rand-main-(format)" val="4"/><content id="rand[29]-rand-main-(format)" val="4"/><content id="rand[28]-rand-main-(format)" val="4"/><content id="rand[27]-rand-main-(format)" val="4"/><content id="rand[26]-rand-main-(format)" val="4"/><content id="rand[25]-rand-main-(format)" val="4"/><content id="rand[24]-rand-main-(format)" val="4"/><content id="rand[23]-rand-main-(format)" val="4"/><content id="rand[22]-rand-main-(format)" val="4"/><content id="rand[21]-rand-main-(format)" val="4"/><content id="rand[20]-rand-main-(format)" val="4"/><content id="rand[19]-rand-main-(format)" val="4"/><content id="rand[18]-rand-main-(format)" val="4"/><content id="rand[17]-rand-main-(format)" val="4"/><content id="rand[16]-rand-main-(format)" val="4"/><content id="rand[15]-rand-main-(format)" val="4"/><content id="rand[14]-rand-main-(format)" val="4"/><content id="rand[13]-rand-main-(format)" val="4"/><content id="rand[12]-rand-main-(format)" val="4"/><content id="rand[11]-rand-main-(format)" val="4"/><content id="rand[10]-rand-main-(format)" val="4"/><content id="rand[9]-rand-main-(format)" val="4"/><content id="rand[8]-rand-main-(format)" val="4"/><content id="rand[7]-rand-main-(format)" val="4"/><content id="rand[6]-rand-main-(format)" val="4"/><content id="rand[5]-rand-main-(format)" val="4"/><content id="rand[4]-rand-main-(format)" val="4"/><content id="rand[3]-rand-main-(format)" val="4"/><content id="rand[2]-rand-main-(format)" val="4"/><content id="rand[1]-rand-main-(format)" val="4"/><content id="rand[0]-rand-main-(format)" val="4"/><content id="xPSR-(format)" val="4"/><content id="mfs_buffer[447]-null-mfs_test_001_005_execute-(format)" val="0"/><content id="mfs_buffer[507]-null-mfs_test_001_005_execute-(format)" val="0"/><content id="rp[506]-rp-mfs_flash_read-(format)" val="0"/><content id="rp[507]-rp-mfs_flash_read-(format)" val="0"/><content id="rp-mfs_flash_read-(cast_to_array)" val="0:511"/><content id="rand-main-(format)" val="4"/></contentList>"/> <stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/> <stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList> <memoryBlockExpressionItem> <expression text="0x20000c34"/> </memoryBlockExpressionItem> </memoryBlockExpressionList> "/> <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);
}
|