2010-09-15 10:18 PM
ADC injected simultaneous mode
2011-05-17 05:07 AM
If you insist on programming the STM32 at the register bit level you will need to become more self-sufficient.
2011-05-17 05:07 AM
Using the code in your ADC_DualMode_Config() function...
The 2 images attached suggest that you have not included the 2nd conversion in the conversion sequence, either for ADC1 or ADC2. (The 'include in sequence' item next to the 2nd conversion is not checked.) Also 'enable external trigger' is not set for ADC2.2011-05-17 05:07 AM
Here at the images that are attached to the previous message:
2011-05-17 05:07 AM
/*ADC Configuration Function*/
void ADC_DualMode_Config(void) { RCC->APB2ENR|=0x601; //Enable ADC1, ADC2 and AFIO peripheral clock/*ADC1 Configuration*/
ADC1->CR1=0x00050100; //injected conversion selction ADC1->CR2=0x0020F102; //injected conversion selction //ADC1->JSQR=0x00100800; //0x40 ADC1->JSQR=0x00110000; //ch0 and ch2/*ADC2 Configuration*/
ADC2->CR1=0x00050100; ADC2->CR2=0x0020F102; //ADC2->JSQR=0x00108c00;//0x61; //ch1 and ch3 ADC2->JSQR=0x00118400; } i have changed my code as above , in the simulator i am able to see the output but in the hardware i am not getting the output...2011-05-17 05:07 AM
If you want to check your revised code in the Crossware graphical ADC1 and ADC2 code creation wizards, download the evaluation suite from here:
Create a project for your target chip. (This will create a main.c or main.cpp file.) Paste your ADC_DualMode_Config(void) function into this initial source file. Put a 'g_p' at the front of each ADC and RCC. I.e: Change ADC1 to g_pADC1, change ADC2 to g_pADC2 and change RCC to g_pRCC. Then select all of the lines of code. Open the ADC1 wizard from the Wizards menu to see how you code is configuring ADC1. Then cancel out and open the ADC2 wizard from the Wizards menu to see how you code is configuring ADC2. You should see some things that are incorrect in the 'Injected channels' tabs.