8 years, 3 months ago.

Multiple analogIn not working

I have the following program, when both of the analogIn are declared, no light shows up, however, when only one of the two analogIn statements are in the program it works, why is this... is it a bug? - my mbed library is up to date as of 3rd Feb 2016

#include "mbed.h"

DigitalOut frontTX(PB_3);

AnalogIn LF(PA_6);
AnalogIn RF(PA_1);

int main()
{
    while(1) {
        frontTX = 1;
    }
}

I want to be able to have 6 analog inputs, but this is currently prohibitive

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F303K8T6 microcontroller.

oops, posted in the wrong place.

posted by philippe s. 23 Feb 2016

3 Answers

8 years, 3 months ago.

Hi, I am having the same problem, with my 303RE project

if any Analog in 8-13 are initialised, the processor wont come out of reset.

my solution does not use a crystal, so running at 64MHz not 72MHz.

AD6 = PA_6 works on this board, but not AD8-AD13, yet AD14 and AD15 work ok ....

this all worked on the Nucleo 072.. frustrating...

In the fine print on page 313 of 1137 of RM0316 it says some A/Ds are not available on some packages. there is a post for this problem I think, https://developer.mbed.org/teams/Delta/code/mbed-src/rev/d80869345ae6, since it specifically notes the STM32F303

posted by Nick Marsh 06 Feb 2016

ADC3 is not initialised in PeripheralPins.c this is why PB0 and PB1 dont work. With the new mbed library installed from above, PC_0,1,2,3 now all work, but PB_0,1 still stops the processor coming up.

posted by Nick Marsh 06 Feb 2016

pls see post on this subject https://developer.mbed.org/forum/bugs-suggestions/topic/25926/

posted by Nick Marsh 06 Feb 2016

Would it be possible for your to share a basic/template program with this modification, I do not know how to implement these changes myself. I tried importing mbed-src and editing that file, but it wouldn't compile. In the short term, I have ordered a F042K6 board which documentation says has only 1 ADC, I am hoping that this may overcome the problem. Although it is not ideal

posted by stephenr.pit@... 06 Feb 2016

1 ADC, but many channels is the norm... I am a newbee here too, I dont know how to post a " repo " usually, you delete the old mbed folder in your project. then add the mbed-src library then do the mods per topic 25926 as shown above, it has worked for me several times. .

posted by Nick Marsh 07 Feb 2016

the files "PeripheralPins.c , PeripheralNames.h " are found under:

mbed-src / targets / hal / STM / 303RE for my board.

posted by Nick Marsh 08 Feb 2016
7 years, 2 months ago.

Hi There,

I'm sorry to resurrect this old thread, but I still have the issue mentioned above.

I was hoping that the issue was fixed in the main mbed repo, but it seams not to be the case, so I went ahead and tried the repo that Philipe S. posted, but that one trows a lot of errors related to the CAN. Even if I know that it shouldn't been done, I deleted all of the references to the CAN files, but then it stars complaining about I2C....

On a side note, why those fixes hadn't been pushed to the main mbed repo?

I don't have any deep knowledge about mbed or the arm ecosystem either, but I'm definitely here to learn, so tell me and I will do my best to follow.

Thanks, Carlo

I had to move away from MBED since the printf hardfault killed my project offline

now I am using HAL and it works really well.

posted by Nick Marsh 16 Feb 2017

Could you explain more on HAL. I know that ARM gives some libraries called cmsis, but I haven't tried them yet.

Thanks, Carlo

posted by Carlo Maragno 16 Feb 2017
8 years, 2 months ago.

You can find an explanation and fix of the problem here: https://developer.mbed.org/questions/67997/NUCLEO-F303K8ADC/

This fork of mbed-dev fixes both the adc and the dac problems: https://developer.mbed.org/users/neurofun/code/mbed-dev/

Hello Philippe would you min sharing the exact diff or patch that solved the issue ? We can then push the changes into mbed main repo as suggested by Carlo thanks in advance Laurent

posted by Laurent Meunier 16 Feb 2017

@Laurent Meunier I will look into the code made by @philippe s. and get you a diff

posted by Carlo Maragno 11 Mar 2017

Think this is the diff you are looking for: https://developer.mbed.org/users/neurofun/code/mbed-dev/rev/b3a5af880266

posted by philippe s. 12 Mar 2017

Thank you Philippe - I have proposed a fix to handle multiple instances in parallel that will be reviewed and later integrated in MBED master branch. Here is the proposal: https://github.com/ARMmbed/mbed-os/pull/4623 Any feedback or tests results are welcome. Sorry for the delay.

posted by Laurent Meunier 23 Jun 2017