cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Channel Conversion in Dual Mode

bluewaters213
Associate III
Posted on February 11, 2013 at 08:24

Hello,

I will like to convert 4 Channel Voltages in STMF103RB ADC in dual mode configuration.Please correct me if I am mistaken, from the reference manual (Reference manual RM0008:: 11.9.1 Injected simultaneous mode) ADC1 covert CH13 -CH10 while ADC1 convert CH10-CH13 i.e when ADC2 is converting CH13, ADC1 is simultanously converting CH10.I want a situation where by ADC1 convert CH10 & CH11  only while ADC2 Convert CH12 & Ch13 simultanously. How do I go about it?.

----------------ADC Initialization Code---------------

/* ADC Configuration for CH10 - CH13 in Dual Simultaneous Injected Mode*/

void Init_ADC(void)

{

/*Injected simultaneous Mode Only | Interrupt enable for injected channels | Scan Mode*/

  ADC1->CR1 = ADC_CR1_SCAN | (ADC_CR1_DUALMOD_0 | ADC_CR1_DUALMOD_2) | ADC_CR1_JEOCIE;

/* Turn On ADC from Power Down Mode |Conversion on external event enabled |

 * Timer 4 CC4 event | DMA Enable*/

  ADC1->CR2 = ADC_CR2_ADON | ADC_CR2_JEXTTRIG | ADC_CR2_JEXTSEL_0 |

              ADC_CR2_DMA;

  ADC1->SMPR1 = ((uint32_t)0x00000000); //CH10 - CH13 Sample Time = 1.5 cycles

  ADC1->JSQR = ADC_JSQR_JL |                      //4 Injected conversions

              (ADC_JSQR_JSQ1_1 | ADC_JSQR_JSQ1_3) | //CH10=> 1st Conversion

              (ADC_JSQR_JSQ2_0 | ADC_JSQR_JSQ2_1 | ADC_JSQR_JSQ2_3)| //CH11 => 2nd Conversion

              (ADC_JSQR_JSQ3_2 | ADC_JSQR_JSQ3_3) |     //CH12=> 3rd Conversion

              (ADC_JSQR_JSQ4_0 | ADC_JSQR_JSQ4_2 | ADC_JSQR_JSQ4_3); //CH13 => 4th Conversion

}

Slim

Please forgive my English
1 REPLY 1
raptorhal2
Lead
Posted on February 11, 2013 at 15:09

I haven't tried this yet, but I think the answer is ''yes''. Figure 30 in RM0008, the All Densities Reference Manual illustrates doing that for 4 channels. Doing it for your 2 channels per ADC is a change to the  ADC_RegularChannelConfig statements. The Standard Peripheral Library has a Regular Simultaneous example which you should be able to adapt for Injected Simultaneous mode.

Cheers, Hal