cancel
Showing results for 
Search instead for 
Did you mean: 

ADC injected simultaneous mode

madhu13
Associate II
Posted on September 16, 2010 at 07:18

ADC injected simultaneous mode

5 REPLIES 5
Posted on May 17, 2011 at 14:07

If you insist on programming the STM32 at the register bit level you will need to become more self-sufficient.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
stforum2
Associate II
Posted on May 17, 2011 at 14:07

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.

stforum2
Associate II
Posted on May 17, 2011 at 14:07

Here at the images that are attached to the previous message:

0690X00000602huQAA.jpg

0690X00000602hzQAA.jpg

madhu13
Associate II
Posted on May 17, 2011 at 14:07

/*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...

stforum2
Associate II
Posted on May 17, 2011 at 14:07

If you want to check your revised code in the Crossware graphical ADC1 and ADC2 code creation wizards, download the evaluation suite from here:

http://www.crossware.com/trialware/21499113stm/index.htm

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.