Skip to main content
mismee
Associate II
December 25, 2009
Question

Bug in StdPeriphLib Driver

  • December 25, 2009
  • 3 replies
  • 758 views
Posted on December 25, 2009 at 02:36

Bug in StdPeriphLib Driver

    This topic has been closed for replies.

    3 replies

    armmcu
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:35

    Hi mismee,

    I've quickly checked the case and the code as it's now in the library driver v3.1.2, is correct :o :o .

    I guess there is an important note in RM008 that you should consider..

    ''Note:

    Unlike a regular conversion sequence, if JL[1:0] length is less than four, the channels

    are converted in a sequence starting from (4-JL). Example: ADC_JSQR[21:0] = 10 00011 00011 00111 00010 means that a scan conversion will convert the following channel sequence: 7, 3, 3. (not 2, 7, 3)''

    Cheers,.

    [ This message was edited by: armmcu.engineer on 24-12-2009 18:28 ]

    [ This message was edited by: armmcu.engineer on 24-12-2009 18:31 ]

    mismee
    mismeeAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:35

    Hi!

    I`ve found bug in StdPeriph library version 3.1.2. Function ADC_InjectedChannelConfig is incorrect configuring ADC_JSQR register.

    In stm32f10x_adc.c line 974 must

    tmpreg2 = JSQR_JSQ_Set << (5 * (uint8_t)((Rank + 1) - (tmpreg3 + 1)));

    instead

    tmpreg2 = JSQR_JSQ_Set << (5 * (uint8_t)((Rank + 3) - (tmpreg3 + 1)));

    line 978:

    tmpreg2 = (uint32_t)ADC_Channel << (5 * (uint8_t)((Rank + 1) - (tmpreg3 + 1)));

    instead

    tmpreg2 = (uint32_t)ADC_Channel << (5 * (uint8_t)((Rank + 3) - (tmpreg3 + 1)));

    This is done for proper config ADC_JSQR.

    mismee
    mismeeAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:35

    Thanks armmcu.engineer.

    I has not seen this note.

    Thank you