2009-12-24 05:36 PM
Bug in StdPeriphLib Driver
2011-05-17 04:35 AM
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.2011-05-17 04:35 AM
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 ]2011-05-17 04:35 AM
Thanks armmcu.engineer.
I has not seen this note. Thank you