Hi, I want to achieve the following sequence: > 1. Select the desired pin. > 2. Trigger a single conversion, and wait for it to finish. > 3. Read the result.
This is not possible because the channel configuration cannot be changed at runtime. But you can achieve similar functionality just by disable DMA conversion and use software triggers. Then each software trigger will start conversion on the next pin in the configured sequence. A simple example. You have a channel sequence set up like this: /* Identifying number of each ADC channel */ > > static const uint8_t g_chanlist1[3] = > { > 9, > 15, > 8 > }; Then in the application you trigger the conversion (software trigger) and read the data from a single channel: /* Start convertion on the first configured channel (ADC channel 9) > */ > > ret = ioctl(fd, ANIOC_TRIGGER, 0); > > /* Read data from the first convertion (channel 9) */ > > nbytes = read(fd, sample, sizeof(struct adc_msg_s)); > > /* Start convertion on the second configured channel (ADC channel > 15) */ > > ret = ioctl(fd, ANIOC_TRIGGER, 0); > > /* Read data from the second convertion (channel 15) */ > > nbytes = read(fd, sample, sizeof(struct adc_msg_s)); > > /* Start convertion on the third configured channel (ADC channel 8) > */ > > ret = ioctl(fd, ANIOC_TRIGGER, 0); > > /* Read data from the third convertion (channel 8) */ > > nbytes = read(fd, sample, sizeof(struct adc_msg_s)); > > /* The next trigger will start from the beginning (ADC channel 9) */ > pon., 14 gru 2020 o 17:29 Fotis Panagiotopoulos <f.j.pa...@gmail.com> napisał(a): > Hi, > > anyone on this? > > As I see, it is impossible to set multiple channels on STM32F4xx. > To have multiple ADC channels configured for an STM32, it is required to > have DMA enabled for the ADC, which seems not to be supported on STM32F4. > > Is that correct? So the F4s can use only one pin in ADC? > > Στις Πέμ, 10 Δεκ 2020 στις 4:04 μ.μ., ο/η Fotis Panagiotopoulos < > f.j.pa...@gmail.com> έγραψε: > > > Hi everybody! > > > > I am trying to use the ADC on an STM32F427. > > I am able to properly register the driver and access the ADC device. > > > > However, I am really confused on the proper use of the driver. > > I have 8 ADC-capable pins on my board that I want to read. > > > > I want to achieve the following sequence: > > 1. Select the desired pin. > > 2. Trigger a single conversion, and wait for it to finish. > > 3. Read the result. > > > > What is the correct way to achieve this? > > >