Posted on December 16, 2016 at 00:08The original post was too long to process during our migration. Please click on the attachment to read the original post.
thank you for your reply, i am still in my early stages learning and not sure how the injected channels mode work. any example code for the multi channels using an injected channel mode I can start with? many thanks
and it reads two channels. However, it reads OK for few seconds and then the the values swap for a second and then come back, so value[0] becomes value[1] and vice versa and only happes for a second then its fine. Further why it reads
ADC_CHANNEL_2 in value[0], I though the one with the lower rank number will be read first, is that correct?
I am trying to use DMA now as its more straightforward but still not working for me. Ain[0 below is only reading some weired voltage .17 instead of 1.3V and Ain[1] reads nothing stays 0. can you please have a look and let me know what might have gone wrong:
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{ Error_Handler(); }
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = 1; HAL_ADC_ConfigChannel(&hadc1, &sConfig); if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } // All Channels has to be preconfgured here as above}