Skip to main content
Visitor II
May 31, 2007
Question

Possibly I've found a bug in std library for STR7...

  • May 31, 2007
  • 3 replies
  • 871 views
Posted on May 31, 2007 at 13:30

Possibly I've found a bug in std library for STR7...

    This topic has been closed for replies.

    3 replies

    0xef15hAuthor
    Visitor II
    May 12, 2007
    Posted on May 12, 2007 at 09:37

    Look at this code in adc12.h:

    inline void ADC12_ChannelSelect(ADC12_Channels ADC12_Channel)

    {

    /* Update the CSR by the value of the selected channel */

    ADC12->CSR |= ADC12_Channel;

    }

    It's impossible to select channel 0 after seelcting channel 1,

    without manual clearing of some bits in CSR.

    Should be rewrited as:

    ADC12->CSR = (ADC12->CSR & ~(ADC_all_channels_mask)) | ADC12_Channel;

    Am I right or not?

    Visitor II
    May 14, 2007
    Posted on May 14, 2007 at 06:43

    Yes you are right:

    We have already detected this problem and the bug will be corrected in the next library version and the correction will be:

    void ADC12_ChannelSelect(ADC12_Channels ADC12_Channel)

    {

    /* Clear present selected channel */

    ADC12->CSR &= 0xFFCF;

    /* Update the CSR by the value of the selected channel */

    ADC12->CSR |= ADC12_Channel;

    }

    Thanks.

    [ This message was edited by: M3allem on 14-05-2007 10:56 ]

    Visitor II
    May 31, 2007
    Posted on May 31, 2007 at 13:30

    Yes, we confirm. thanks for your information.