├── ADC_DMA.ioc ├── LICENSE ├── README.md ├── img └── bufferADCDMA.jpg └── main.c /ADC_DMA.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_9 3 | ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_6 4 | ADC1.Channel-2\#ChannelRegularConversion=ADC_CHANNEL_12 5 | ADC1.ClockPrescaler=ADC_CLOCK_SYNC_PCLK_DIV8 6 | ADC1.ContinuousConvMode=ENABLE 7 | ADC1.IPParameters=Rank-0\#ChannelRegularConversion,master,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,ClockPrescaler,ContinuousConvMode,ScanConvMode,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,NbrOfConversion 8 | ADC1.NbrOfConversion=3 9 | ADC1.NbrOfConversionFlag=1 10 | ADC1.Rank-0\#ChannelRegularConversion=1 11 | ADC1.Rank-1\#ChannelRegularConversion=2 12 | ADC1.Rank-2\#ChannelRegularConversion=3 13 | ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_480CYCLES 14 | ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_480CYCLES 15 | ADC1.SamplingTime-2\#ChannelRegularConversion=ADC_SAMPLETIME_480CYCLES 16 | ADC1.ScanConvMode=ADC_SCAN_ENABLE 17 | ADC1.master=1 18 | Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY 19 | Dma.ADC1.0.FIFOMode=DMA_FIFOMODE_DISABLE 20 | Dma.ADC1.0.Instance=DMA2_Stream0 21 | Dma.ADC1.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD 22 | Dma.ADC1.0.MemInc=DMA_MINC_ENABLE 23 | Dma.ADC1.0.Mode=DMA_CIRCULAR 24 | Dma.ADC1.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD 25 | Dma.ADC1.0.PeriphInc=DMA_PINC_DISABLE 26 | Dma.ADC1.0.Priority=DMA_PRIORITY_LOW 27 | Dma.ADC1.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode 28 | Dma.Request0=ADC1 29 | Dma.RequestsNb=1 30 | File.Version=6 31 | KeepUserPlacement=false 32 | Mcu.Family=STM32F7 33 | Mcu.IP0=ADC1 34 | Mcu.IP1=CORTEX_M7 35 | Mcu.IP2=DMA 36 | Mcu.IP3=NVIC 37 | Mcu.IP4=RCC 38 | Mcu.IP5=SYS 39 | Mcu.IP6=USART3 40 | Mcu.IPNb=7 41 | Mcu.Name=STM32F746ZGTx 42 | Mcu.Package=LQFP144 43 | Mcu.Pin0=PC13 44 | Mcu.Pin1=PC14/OSC32_IN 45 | Mcu.Pin10=PA7 46 | Mcu.Pin11=PC4 47 | Mcu.Pin12=PC5 48 | Mcu.Pin13=PB0 49 | Mcu.Pin14=PB1 50 | Mcu.Pin15=PB13 51 | Mcu.Pin16=PB14 52 | Mcu.Pin17=PD8 53 | Mcu.Pin18=PD9 54 | Mcu.Pin19=PG6 55 | Mcu.Pin2=PC15/OSC32_OUT 56 | Mcu.Pin20=PG7 57 | Mcu.Pin21=PA8 58 | Mcu.Pin22=PA9 59 | Mcu.Pin23=PA10 60 | Mcu.Pin24=PA11 61 | Mcu.Pin25=PA12 62 | Mcu.Pin26=PA13 63 | Mcu.Pin27=PA14 64 | Mcu.Pin28=PG11 65 | Mcu.Pin29=PG13 66 | Mcu.Pin3=PH0/OSC_IN 67 | Mcu.Pin30=PB3 68 | Mcu.Pin31=PB7 69 | Mcu.Pin32=VP_SYS_VS_Systick 70 | Mcu.Pin4=PH1/OSC_OUT 71 | Mcu.Pin5=PC1 72 | Mcu.Pin6=PC2 73 | Mcu.Pin7=PA1 74 | Mcu.Pin8=PA2 75 | Mcu.Pin9=PA6 76 | Mcu.PinsNb=33 77 | Mcu.ThirdPartyNb=0 78 | Mcu.UserConstants= 79 | Mcu.UserName=STM32F746ZGTx 80 | MxCube.Version=6.0.1 81 | MxDb.Version=DB.6.0.0 82 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false 83 | NVIC.DMA2_Stream0_IRQn=true\:0\:0\:false\:false\:true\:false\:true 84 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:true\:false 85 | NVIC.ForceEnableDMAVector=true 86 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false 87 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:true\:false 88 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:true\:false 89 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:true\:false 90 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 91 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:true\:false 92 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:true\:true 93 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false 94 | PA1.GPIOParameters=GPIO_Label 95 | PA1.GPIO_Label=RMII_REF_CLK [LAN8742A-CZ-TR_REFCLK0] 96 | PA1.Locked=true 97 | PA1.Signal=ETH_REF_CLK 98 | PA10.GPIOParameters=GPIO_Label 99 | PA10.GPIO_Label=USB_ID 100 | PA10.Locked=true 101 | PA10.Signal=USB_OTG_FS_ID 102 | PA11.GPIOParameters=GPIO_Label 103 | PA11.GPIO_Label=USB_DM 104 | PA11.Locked=true 105 | PA11.Signal=USB_OTG_FS_DM 106 | PA12.GPIOParameters=GPIO_Label 107 | PA12.GPIO_Label=USB_DP 108 | PA12.Locked=true 109 | PA12.Signal=USB_OTG_FS_DP 110 | PA13.GPIOParameters=GPIO_Label 111 | PA13.GPIO_Label=TMS 112 | PA13.Locked=true 113 | PA13.Mode=Serial_Wire 114 | PA13.Signal=SYS_JTMS-SWDIO 115 | PA14.GPIOParameters=GPIO_Label 116 | PA14.GPIO_Label=TCK 117 | PA14.Locked=true 118 | PA14.Mode=Serial_Wire 119 | PA14.Signal=SYS_JTCK-SWCLK 120 | PA2.GPIOParameters=GPIO_Label 121 | PA2.GPIO_Label=RMII_MDIO [LAN8742A-CZ-TR_MDIO] 122 | PA2.Locked=true 123 | PA2.Signal=ETH_MDIO 124 | PA6.Locked=true 125 | PA6.Signal=ADCx_IN6 126 | PA7.GPIOParameters=GPIO_Label 127 | PA7.GPIO_Label=RMII_CRS_DV [LAN8742A-CZ-TR_CRS_DV] 128 | PA7.Locked=true 129 | PA7.Signal=ETH_CRS_DV 130 | PA8.GPIOParameters=GPIO_Label 131 | PA8.GPIO_Label=USB_SOF [TP1] 132 | PA8.Locked=true 133 | PA8.Signal=USB_OTG_FS_SOF 134 | PA9.GPIOParameters=GPIO_Label 135 | PA9.GPIO_Label=USB_VBUS 136 | PA9.Locked=true 137 | PA9.Signal=USB_OTG_FS_VBUS 138 | PB0.GPIOParameters=GPIO_Label 139 | PB0.GPIO_Label=LD1 [Green] 140 | PB0.Locked=true 141 | PB0.Signal=GPIO_Output 142 | PB1.Locked=true 143 | PB1.Signal=ADCx_IN9 144 | PB13.GPIOParameters=GPIO_Label 145 | PB13.GPIO_Label=RMII_TXD1 [LAN8742A-CZ-TR_TXD1] 146 | PB13.Locked=true 147 | PB13.Signal=ETH_TXD1 148 | PB14.GPIOParameters=GPIO_Label 149 | PB14.GPIO_Label=LD3 [Red] 150 | PB14.Locked=true 151 | PB14.Signal=GPIO_Output 152 | PB3.GPIOParameters=GPIO_Label 153 | PB3.GPIO_Label=SW0 154 | PB3.Locked=true 155 | PB3.Signal=SYS_JTDO-SWO 156 | PB7.GPIOParameters=GPIO_Label 157 | PB7.GPIO_Label=LD2 [Blue] 158 | PB7.Locked=true 159 | PB7.Signal=GPIO_Output 160 | PC1.GPIOParameters=GPIO_Label 161 | PC1.GPIO_Label=RMII_MDC [LAN8742A-CZ-TR_MDC] 162 | PC1.Locked=true 163 | PC1.Signal=ETH_MDC 164 | PC13.GPIOParameters=GPIO_Label 165 | PC13.GPIO_Label=USER_Btn [B1] 166 | PC13.Locked=true 167 | PC13.Signal=GPXTI13 168 | PC14/OSC32_IN.Locked=true 169 | PC14/OSC32_IN.Mode=LSE-External-Oscillator 170 | PC14/OSC32_IN.Signal=RCC_OSC32_IN 171 | PC15/OSC32_OUT.Locked=true 172 | PC15/OSC32_OUT.Mode=LSE-External-Oscillator 173 | PC15/OSC32_OUT.Signal=RCC_OSC32_OUT 174 | PC2.Locked=true 175 | PC2.Signal=ADCx_IN12 176 | PC4.GPIOParameters=GPIO_Label 177 | PC4.GPIO_Label=RMII_RXD0 [LAN8742A-CZ-TR_RXD0] 178 | PC4.Locked=true 179 | PC4.Signal=ETH_RXD0 180 | PC5.GPIOParameters=GPIO_Label 181 | PC5.GPIO_Label=RMII_RXD1 [LAN8742A-CZ-TR_RXD1] 182 | PC5.Locked=true 183 | PC5.Signal=ETH_RXD1 184 | PD8.GPIOParameters=GPIO_Label 185 | PD8.GPIO_Label=STLK_RX [STM32F103CBT6_PA3] 186 | PD8.Locked=true 187 | PD8.Mode=Asynchronous 188 | PD8.Signal=USART3_TX 189 | PD9.GPIOParameters=GPIO_Label 190 | PD9.GPIO_Label=STLK_TX [STM32F103CBT6_PA2] 191 | PD9.Locked=true 192 | PD9.Mode=Asynchronous 193 | PD9.Signal=USART3_RX 194 | PG11.GPIOParameters=GPIO_Label 195 | PG11.GPIO_Label=RMII_TX_EN [LAN8742A-CZ-TR_TXEN] 196 | PG11.Locked=true 197 | PG11.Signal=ETH_TX_EN 198 | PG13.GPIOParameters=GPIO_Label 199 | PG13.GPIO_Label=RMII_TXD0 [LAN8742A-CZ-TR_TXD0] 200 | PG13.Locked=true 201 | PG13.Signal=ETH_TXD0 202 | PG6.GPIOParameters=GPIO_Label 203 | PG6.GPIO_Label=USB_PowerSwitchOn [STMPS2151STR_EN] 204 | PG6.Locked=true 205 | PG6.Signal=GPIO_Output 206 | PG7.GPIOParameters=GPIO_Label 207 | PG7.GPIO_Label=USB_OverCurrent [STMPS2151STR_FAULT] 208 | PG7.Locked=true 209 | PG7.Signal=GPIO_Input 210 | PH0/OSC_IN.GPIOParameters=GPIO_Label 211 | PH0/OSC_IN.GPIO_Label=MCO [STM32F103CBT6_PA8] 212 | PH0/OSC_IN.Locked=true 213 | PH0/OSC_IN.Mode=HSE-External-Clock-Source 214 | PH0/OSC_IN.Signal=RCC_OSC_IN 215 | PH1/OSC_OUT.Locked=true 216 | PH1/OSC_OUT.Mode=HSE-External-Clock-Source 217 | PH1/OSC_OUT.Signal=RCC_OSC_OUT 218 | PinOutPanel.RotationAngle=0 219 | ProjectManager.AskForMigrate=true 220 | ProjectManager.BackupPrevious=false 221 | ProjectManager.CompilerOptimize=6 222 | ProjectManager.ComputerToolchain=false 223 | ProjectManager.CoupleFile=false 224 | ProjectManager.CustomerFirmwarePackage= 225 | ProjectManager.DefaultFWLocation=true 226 | ProjectManager.DeletePrevious=true 227 | ProjectManager.DeviceId=STM32F746ZGTx 228 | ProjectManager.FirmwarePackage=STM32Cube FW_F7 V1.16.0 229 | ProjectManager.FreePins=false 230 | ProjectManager.HalAssertFull=false 231 | ProjectManager.HeapSize=0x200 232 | ProjectManager.KeepUserCode=true 233 | ProjectManager.LastFirmware=true 234 | ProjectManager.LibraryCopy=0 235 | ProjectManager.MainLocation=Core/Src 236 | ProjectManager.NoMain=false 237 | ProjectManager.PreviousToolchain= 238 | ProjectManager.ProjectBuild=false 239 | ProjectManager.ProjectFileName=ADC_DMA.ioc 240 | ProjectManager.ProjectName=ADC_DMA 241 | ProjectManager.RegisterCallBack= 242 | ProjectManager.StackSize=0x400 243 | ProjectManager.TargetToolchain=MDK-ARM V5.27 244 | ProjectManager.ToolChainLocation= 245 | ProjectManager.UnderRoot=false 246 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_USART3_UART_Init-USART3-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true 247 | RCC.48MHZClocksFreq_Value=24000000 248 | RCC.ADC12outputFreq_Value=72000000 249 | RCC.ADC34outputFreq_Value=72000000 250 | RCC.AHBFreq_Value=216000000 251 | RCC.APB1CLKDivider=RCC_HCLK_DIV4 252 | RCC.APB1Freq_Value=54000000 253 | RCC.APB1TimFreq_Value=108000000 254 | RCC.APB2CLKDivider=RCC_HCLK_DIV2 255 | RCC.APB2Freq_Value=108000000 256 | RCC.APB2TimFreq_Value=216000000 257 | RCC.CECFreq_Value=32786.88524590164 258 | RCC.CortexFreq_Value=216000000 259 | RCC.EthernetFreq_Value=216000000 260 | RCC.FCLKCortexFreq_Value=216000000 261 | RCC.FamilyName=M 262 | RCC.HCLKFreq_Value=216000000 263 | RCC.HSE_VALUE=8000000 264 | RCC.HSI_VALUE=16000000 265 | RCC.I2C1Freq_Value=54000000 266 | RCC.I2C2Freq_Value=54000000 267 | RCC.I2C3Freq_Value=54000000 268 | RCC.I2C4Freq_Value=54000000 269 | RCC.I2SClocksFreq_Value=48000000 270 | RCC.I2SFreq_Value=192000000 271 | RCC.IPParameters=48MHZClocksFreq_Value,ADC12outputFreq_Value,ADC34outputFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CECFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I2SClocksFreq_Value,I2SFreq_Value,LCDTFToutputFreq_Value,LPTIM1Freq_Value,LSI_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLI2SPCLKFreq_Value,PLLI2SQCLKFreq_Value,PLLI2SRCLKFreq_Value,PLLI2SRoutputFreq_Value,PLLM,PLLMCOFreq_Value,PLLMUL,PLLN,PLLQ,PLLQCLKFreq_Value,PLLQoutputFreq_Value,PLLSAIPCLKFreq_Value,PLLSAIQCLKFreq_Value,PLLSAIRCLKFreq_Value,PLLSAIoutputFreq_Value,PLLSourceVirtual,PRESCALERUSB,RNGFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,SYSCLKSourceVirtual,TIM15Freq_Value,TIM16Freq_Value,TIM17Freq_Value,TIM1Freq_Value,TIM20Freq_Value,TIM2Freq_Value,TIM3Freq_Value,TIM8Freq_Value,UART4Freq_Value,UART5Freq_Value,UART7Freq_Value,UART8Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USART6Freq_Value,USBFreq_Value,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutput2Freq_Value,VCOOutputFreq_Value,VCOSAIOutputFreq_Value,VcooutputI2S,WatchDogFreq_Value 272 | RCC.LCDTFToutputFreq_Value=96000000 273 | RCC.LPTIM1Freq_Value=54000000 274 | RCC.LSI_VALUE=32000 275 | RCC.MCO1PinFreq_Value=16000000 276 | RCC.MCO2PinFreq_Value=216000000 277 | RCC.MCOFreq_Value=72000000 278 | RCC.PLLCLKFreq_Value=216000000 279 | RCC.PLLI2SPCLKFreq_Value=192000000 280 | RCC.PLLI2SQCLKFreq_Value=192000000 281 | RCC.PLLI2SRCLKFreq_Value=192000000 282 | RCC.PLLI2SRoutputFreq_Value=192000000 283 | RCC.PLLM=4 284 | RCC.PLLMCOFreq_Value=72000000 285 | RCC.PLLMUL=RCC_PLL_MUL9 286 | RCC.PLLN=216 287 | RCC.PLLQ=3 288 | RCC.PLLQCLKFreq_Value=144000000 289 | RCC.PLLQoutputFreq_Value=144000000 290 | RCC.PLLSAIPCLKFreq_Value=192000000 291 | RCC.PLLSAIQCLKFreq_Value=192000000 292 | RCC.PLLSAIRCLKFreq_Value=192000000 293 | RCC.PLLSAIoutputFreq_Value=192000000 294 | RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE 295 | RCC.PRESCALERUSB=RCC_USBCLKSOURCE_PLL_DIV1_5 296 | RCC.RNGFreq_Value=144000000 297 | RCC.RTCFreq_Value=32000 298 | RCC.RTCHSEDivFreq_Value=4000000 299 | RCC.SAI1Freq_Value=192000000 300 | RCC.SAI2Freq_Value=192000000 301 | RCC.SDMMCFreq_Value=216000000 302 | RCC.SPDIFRXFreq_Value=192000000 303 | RCC.SYSCLKFreq_VALUE=216000000 304 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK 305 | RCC.SYSCLKSourceVirtual=RCC_SYSCLKSOURCE_PLLCLK 306 | RCC.TIM15Freq_Value=72000000 307 | RCC.TIM16Freq_Value=72000000 308 | RCC.TIM17Freq_Value=72000000 309 | RCC.TIM1Freq_Value=72000000 310 | RCC.TIM20Freq_Value=72000000 311 | RCC.TIM2Freq_Value=72000000 312 | RCC.TIM3Freq_Value=72000000 313 | RCC.TIM8Freq_Value=72000000 314 | RCC.UART4Freq_Value=54000000 315 | RCC.UART5Freq_Value=54000000 316 | RCC.UART7Freq_Value=54000000 317 | RCC.UART8Freq_Value=54000000 318 | RCC.USART1Freq_Value=108000000 319 | RCC.USART2Freq_Value=54000000 320 | RCC.USART3Freq_Value=54000000 321 | RCC.USART6Freq_Value=108000000 322 | RCC.USBFreq_Value=144000000 323 | RCC.VCOI2SOutputFreq_Value=384000000 324 | RCC.VCOInputFreq_Value=2000000 325 | RCC.VCOOutput2Freq_Value=8000000 326 | RCC.VCOOutputFreq_Value=432000000 327 | RCC.VCOSAIOutputFreq_Value=384000000 328 | RCC.VcooutputI2S=48000000 329 | RCC.WatchDogFreq_Value=32000 330 | SH.ADCx_IN12.0=ADC1_IN12,IN12 331 | SH.ADCx_IN12.ConfNb=1 332 | SH.ADCx_IN6.0=ADC1_IN6,IN6 333 | SH.ADCx_IN6.ConfNb=1 334 | SH.ADCx_IN9.0=ADC1_IN9,IN9 335 | SH.ADCx_IN9.ConfNb=1 336 | SH.GPXTI13.0=GPIO_EXTI13 337 | SH.GPXTI13.ConfNb=1 338 | USART3.IPParameters=VirtualMode-Asynchronous 339 | USART3.VirtualMode-Asynchronous=VM_ASYNC 340 | VP_SYS_VS_Systick.Mode=SysTick 341 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 342 | board=NUCLEO-F746ZG 343 | boardIOC=true 344 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 mahdi karimian 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Industrial trick for multiple ADC with DMA in STM32 without interrupt 2 | 3 | In this project you generate and configure ADC module of STM32 with DMA. 4 | 5 | Your code read ADCs without delay, with best resolution. 6 | 7 | ## features: 8 | * No interrupt generated in the system 9 | * No delay for data reading ADC during application running on MCU 10 | * Better resolution because of averaging. 1 or 1.5 bit better than any single ADC read.( Read this: AVR121: Enhancing ADC resolution by 11 | oversampling) 12 | * You can run any advance filtering for ADC noise removal 13 | * You can read multiple channels without problem 14 | 15 | 16 | # Methods 17 | 1. Configure ADC for X channel with DMA without Interrupt (**DMA should be in circular Mode**) 18 | 2. In software for Y point for averaging of each channel, request HAL_ADC_Start_DMA with X*Y point 19 | 3. When you want to read a channel known point in memory, without checking ADC status. 20 | 21 | 22 | ![Image of Yaktocat](./img/bufferADCDMA.jpg) 23 | 24 | In the picture, always you can find the first channel of ADC in BUF0, BUF3, BUF6, BUF9. 25 | Always you can add these value for measuring the ADC value. 26 | 27 | # Limitation 28 | * These method works for reading voltage or temperature or any sensor with limited rate. It is very accurate because of averaging the data. 29 | * ADC trigger should be controlled, It may saturate system bus. 30 | 31 | # Test 32 | This project test on "Nucleo board F746ZG". ADC_DMA.ioc file related to this implementation. 3 channels ADC with 8 sample average on each channel set on the board. 33 | -------------------------------------------------------------------------------- /img/bufferADCDMA.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MahdiKarimian/Multiple-ADC-with-DMA-in-STM32-without-interrupt/33f9f95d58889a346ff66cb30ff920a2219484a3/img/bufferADCDMA.jpg -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.c 5 | * @brief : Main program body 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2020 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "main.h" 22 | 23 | /* Private includes ----------------------------------------------------------*/ 24 | /* USER CODE BEGIN Includes */ 25 | #include "stdio.h" 26 | 27 | #define NUMBER_ADC_CHANNEL 3 28 | #define NUMBER_ADC_CHANNEL_AVERAGE_PER_CHANNEL 8 29 | 30 | uint16_t ADC_DMA_BUFF[NUMBER_ADC_CHANNEL * NUMBER_ADC_CHANNEL_AVERAGE_PER_CHANNEL]={0}; 31 | /* USER CODE END Includes */ 32 | 33 | /* Private typedef -----------------------------------------------------------*/ 34 | /* USER CODE BEGIN PTD */ 35 | 36 | /* USER CODE END PTD */ 37 | 38 | /* Private define ------------------------------------------------------------*/ 39 | /* USER CODE BEGIN PD */ 40 | /* USER CODE END PD */ 41 | 42 | /* Private macro -------------------------------------------------------------*/ 43 | /* USER CODE BEGIN PM */ 44 | uint16_t ADC_DMA_AVERAGE(int channel) 45 | { 46 | uint32_t adc_sum; 47 | int i; 48 | 49 | adc_sum = 0; 50 | if(channel < NUMBER_ADC_CHANNEL ) 51 | { 52 | for(i=0; i