2012-12-12 07:35 PM
Hi,
I successfully setup IAR 6.5 and got the F3 Discovery Bd. demo working along with modifying the code to change the LED timing. I read through UM5170 User Manual. I'm looking for more examples to learn about the peripherals. So, I downloaded the AN4157 firmware examples. This includes brief descriptions of each peripheral but not the tutorials to work them.I also found examples with, ''This example has been tested with STMicroelectronics STM32303C-EVAL (STM32F30x) evaluation board and can be easily tailored to any other supported device and development board.'' However, it doesn't explain How to do this.Since I'm new to ARM and 32F3, I would appreciate what next steps to learn this platform.Thanks! #stm32f3-iar #adc #discovery-board #:-discovery-board-stm32f32013-09-11 08:14 AM
Hello.
I am using a STM32F303 development board and i am trying to use the 4 ADCs that incorporates.My first question is it's possible to use the 4 ADCs in the same time?. I want to measure four voltages variating from 0 to 3.6v on one analog input of each ADC.If anyone has an idea about how to do, i will be very grateful. Best Regardshttps://my.st.com/public/STe2ecommunities/mcu/Tags.aspx?tags=STM32F3%20IAR
2013-09-11 09:15 AM
This perhaps would have been better posed as a new question/thread rather than hijacking an old one.
You're going to have a hard time doing 3.6V if the part is running at 3.3V, you might need to check the supply range options. I'd expect ADC1,2,3,4 to all be able to function concurrently. You have to make sure your pin selections where routable to the appropriate ADCx2013-09-11 02:40 PM
Thank you for the quick answer.
I tried to create a new question/thread but no success, I'm sorry. I read that the conversion range is between 0 and 3.6 Vbut in the examples they were showing only with 3.3 V max. So I'm so confused. Do you think that i wouldn't have the synchronization problems if i used the 4 ADCs concurrently? because i need my 4 outputs in the same time to make my algorithm. Thanks in advance2013-09-11 04:27 PM
While the part may be capable of running from a 3.6V supply the Discovery boards are typically 3V or 3.3V thus lowering the maximal limit for your inputs. Like I said you'll need to look at the supplies.
I'm not invested in finding the solution here, but the ADC typically have lock/step modes, and presumably share a common trigger source. I suggest you review the firmware libraries, examples and documentation. These will have the answers you seek.2013-09-12 12:47 AM
Ok thank you for your advice
2013-09-13 07:09 AM
In STM32F302xx/STM32F303xx electrical characteristics, i have noticed that Vref is connected to Vdda. so i measured with millimeter its value on stm32f3-discovery and found 3V. That mean the Max input value of my ADC is 3V, so as you said i don't have no changes to acquire my signals.
In the firmware library, all examples of ADC are considering 3.3V knowing that the STM32f3 discovery is powered up with 3 V.2013-09-13 07:55 AM
I hadn't check the F3-Discovery, the F4 runs at 3V, I run most of my gear at 2.8V
The millivolt conversions look like this for integer math, but you could also use floats and volts as units. ADC1ConvertedVoltage=(ADC1ConvertedValue *3300/0xFFF); // 3.3 Vref ADC1ConvertedVoltage=(ADC1ConvertedValue *3000/0xFFF); // 3.0 Vref ADC1ConvertedVoltage=(ADC1ConvertedValue *2800/0xFFF); // 2.8 Vref Using a 0x1000 multiplier might prove to be more efficient, and reasonably accurate.2013-09-16 08:50 AM
By the way, i read the RM0316 Reference manual of STM32F302xx, STM32F303xx and STM32F313xx.
12.8 Dual ADC modes In devices with two ADCs or In devices with two ADCs or more, dual ADC modes can be used (see Figure 69): • ADC1 and ADC2 can be used together in dual mode (ADC1 is master) • ADC3 and ADC4 can be used together in dual mode (ADC3 is master) In dual ADC mode the start of conversion is triggered alternately or simultaneously by the ADCx master to the ADC slave, depending on the mode selected by the bits DUAL[4:0] in the ADCx_CCR register. So according to this description, i can't use the 4 ADCs to work simultaneously?2013-09-16 10:44 AM
So according to this description, i can't use the 4 ADCs to work simultaneously?
Then consider triggering from a common/synchronous source2013-09-17 09:02 AM
Hi again,
I want to test my ADC1 with DMA but doesn't work and i don't know. I spent a lot of time to debug but no success, can you please help me on this. I m working with STM32f3 discovery. The code i have written is below: #include ''main.h'' #include <stdio.h> int main() { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f30x.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f30x.c file*/ /* ADCs with DMA configuration ------------------------------------------------------*/ ADC12_Config(); /*start the conversion --------------------------------------------*/ ADC_StartConversion(ADC1); while(1) { ADC1ConvertedVoltage = ADC1ConvertedValue *2938/0xFF; if (i < 256) { buffer[i] = ADC1ConvertedVoltage ; i++; } else { // printf(''valeur rien''); i = 0; } } } void ADC12_Config(void) { ADC_InitTypeDef ADC_InitStructure; ADC_CommonInitTypeDef ADC_CommonInitStructure; DMA_InitTypeDef DMA_InitStruct; GPIO_InitTypeDef GPIO_InitStructure; /* Enable ADC1,ADC2,DMA and GPIOC clockS */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ADC12|RCC_AHBPeriph_GPIOA|RCC_AHBPeriph_DMA1, ENABLE); // this line is optionnal to permits us to return the system clock clockValue=RCC_GetSYSCLKSource(); /* Configures the AHB clock (HCLK) ***/ RCC_HCLKConfig(RCC_SYSCLK_Div1); // RCC_AHB_Clock_Source /* Configure the ADC clock */ //RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div2); /* DMA1 channel1 configuration ----------------------------------------------*/ DMA_DeInit(DMA1_Channel1); DMA_InitStruct.DMA_PeripheralBaseAddr=(uint32_t)(&(ADC1->DR));//peripheral(source) address (DMA1_Channel1->CPAR=(uint32_t)(&(ADC1->DR)); Addr) DMA_InitStruct.DMA_PeripheralBaseAddr=(uint32_t)&ADC1ConvertedValue;// memory (desination) address( DMA1_Channel1->CMAR = (uint32_t)ADC1ConvertedValue; DMA_InitStruct.DMA_DIR = DMA_DIR_PeripheralSRC; DMA_InitStruct.DMA_BufferSize = 1; DMA_InitStruct.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStruct.DMA_MemoryInc = DMA_MemoryInc_Disable; DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; DMA_InitStruct.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; DMA_InitStruct.DMA_Mode = DMA_Mode_Circular; DMA_InitStruct.DMA_Priority = DMA_Priority_High; DMA_InitStruct.DMA_M2M = DMA_M2M_Disable; DMA_Init(DMA1_Channel1, &DMA_InitStruct); //Initializes DMA1 peripherals according to the specified parameters /* Configure PA.01, PA.04 (ADC1 fast Channel1, ADC2 fast Channel1) as analog input -----------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; // |GPIO_Pin_5 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOA, &GPIO_InitStructure); /* ADC1 Configure Common Init */ ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStructure.ADC_Clock = ADC_Clock_SynClkModeDiv4; ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStructure.ADC_DMAMode = ADC_DMAMode_Circular; //ADC_DMAMode_Circular; ADC_CommonInitStructure.ADC_TwoSamplingDelay =0; ADC_CommonInit(ADC1, &ADC_CommonInitStructure); ADC_InitStructure.ADC_ContinuousConvMode = ADC_ContinuousConvMode_Enable; ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ExternalTrigEventEdge = ADC_ExternalTrigEventEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_OverrunMode = ADC_OverrunMode_Disable; ADC_InitStructure.ADC_AutoInjMode = ADC_AutoInjec_Disable; ADC_InitStructure.ADC_NbrOfRegChannel = 1; ADC_Init(ADC1, &ADC_InitStructure); /* Enable DMA1 channel1 */ DMA1_Channel1->CCR |= DMA_CCR_EN; // or by : DMA_Cmd(DMA1_Channel1, ENABLE); /* ADC1 regular channel1 configuration *************************************/ ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_7Cycles5); /* Enable ADC1 DMA */ ADC_DMACmd(ADC1, ENABLE); /* Enable ADC3 */ ADC_Cmd(ADC1, ENABLE); }