embitzForum
  • Status Unconfirmed
  • Percent Complete
    0%
  • Ticket Type Bug Report
  • Category
  • Assigned To No-one
  • Operating System All
  • Severity Medium
  • Priority Normal
  • Reported Version 1.10
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 0
  • Private No
Attached to Project: EmBitz IDE
Opened by (sevinz) - 2018-11-09

Ticket#293 - stm32f0xx_adc.c - ADC Channel Config Problem

In function:
void ADC_ChannelConfig(ADC_TypeDef* ADCx, uint32_t ADC_Channel, uint32_t ADC_SampleTime)


This line (724):
ADCx->CHSELR |= (uint32_t)ADC_Channel;


Doesn't switch the ADC channel properly, it "ORs" an additional channel with whats already in the register.

I suggest line 724 should be replaced by:
ADCx->CHSELR = (uint32_t)ADC_Channel;


The original line makes it impossible to configure a single channel after another channel has previously been configured. Using my suggestion, if you need to configure multiple channels, just "or" the channels in the function call, ex:
ADC_ChannelConfig(ADC1, ADC_Channel_0 | ADC_Channel_1, ADC_SampleTime);

This ticket does not depend on any other tickets.

Loading...