Help required regarding writing the drivers for ADC on MCF5441x processor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help required regarding writing the drivers for ADC on MCF5441x processor

545 Views
hemanth_mansi
Contributor I

Hello all,

I am working on MCF5441x processor and configuring the ADC channels to read the Battery level of the device.

The problem i am facing is the START0 bit of the ADC_CR1 register is not at all getting set to start the conversion. the steps i used is:

 

    MCF_ADC_CR1 |= MCF_ADC_CR1_STOP0;

    MCF_ADC_CR1 &= ~MCF_ADC_CR1_STOP0;
    MCF_ADC_CR1 |= MCF_ADC_CR1_START0;


Even i tried by removing the above two lines, since at reset the scan will b in stop mode. As per the reference manual it says there should be stable power mode, i have made only the ADC1(since i am using only channel 0-3) to power up by:

 

    MCF_ADC_PWR &= ~(MCF_ADC_PWR_PD0);
    
    while(MCF_ADC_PWR & MCF_ADC_PWR_PSTS0);
   
Any help regarding this will be appreciated, Thank you in advance:smileyhappy: 

Labels (1)
0 Kudos
2 Replies

287 Views
TomE
Specialist II

The manual shows more steps than you've listed in your email, specifically:

 

29.5.8 Power Management DetailsWhen starting up in normal mode:1. Set PUDELAY to the large power up value.2. Clear auto standby (ASB) and auto power down (APD) bits.3. Clear PD0 and PD1 to power up the required converters.4. Poll ADC_PWR[PSTSn] until all required converters are powered up.

Those bits may default properly from reset, but it is preferable to follow all steps in case the code is reused when these conditions might not be true.

 

I'd suggest checking all possible status bits in all ADC registers against their documented values and meanings too.

 

Tom

 

0 Kudos

287 Views
mjbcswitzerland
Specialist V

Hi

 

There are various configuration possibilities and so these must first be correctly defined before starting a conversion.

 

As Tom points out, two important ones are:

- applying power to the ADC module (the flag(s) for the module(s) used is/are cleared in the register ADC_POWER)

- enabling the channel(s) to be used (clearing the channel(s) flag(s) in ADC_ADSDIS)

 

Once these are set up as required clearing the STOP0 bit and setting the START0 in ADC_CTRL1 should start the operation.

 

Regards

 

Mark

 

 

0 Kudos