F303K8 - BusOut bug? some analogIn pins stop working

01 Jul 2019


Setting the digital pins as a BusOut Causes and issue with analogIn PA_6

#include "mbed.h"
Serial pc(USBTX,USBRX,115200);
BusOut muxBus(PB_0, PB_7, PB_6, PB_1, PF_0, PF_1);
AnalogIn ADC[] = {PA_0, PA_1, PA_3, PA_4, PA_5, PA_6};
DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1; // LED is ON
        wait(0.2); // 200 ms
        myled = 0; // LED is OFF
        wait(1.0); // 1 sec
        for(int i = 0; i<=5; i++){
            printf("A%i: %f \t", i,ADC[i].read()*3.3);

Gives the following output


A0: 2.788279 A1: 1.838169 A2: 2.394213 A3: 1.725348 A4: 0.004029 A5: 0.014505

If I remove PB_6 from the BusOut it seems to fix the issue at least for analogIn(PA_6).

01 Jul 2019

I should mention only analog pin PA_6 is connected and the voltage should read approx 0.76 Volts. The other analog channels are floating.

01 Jul 2019

Indeed, by default A5/PA_6 is shorted with D5/PB_6. Also by default A4/PA_5 is shorted with D4/PB_7. You can remove the shorts by removing solderbridges SB16 resp SB18. See manual and schematics for details.

The shorts are there to make the boards compatible with the arduino nano or whatever it is called.

02 Jul 2019