Arm Mbed OS support forum

NUCLEO F411RE I2C_3 pinmap

Hello everyone.

I’m working on a project which requires I2C. During PCB design I connected a NVSRAM to the I2C_3 of the STM32F411RE, which pins are PB_4 (SDA) and PA_8 (SCL), but when I create the I2C instantiation with the mentioned pins, the microcontroller crashes with the error message “pinmap not found for peripheral”. I opened the PeripheralPinMaps.h file and found the declaration of the PA_8 pin commented:
// {PA_8, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, // Connected to MCO
When I uncomment this line, the program stops crashing.

The board is programmed through:

NRST -> Pin 7 (NRST)
TCK -> PA_14
TMS -> PA_13
SWO -> PB_3
UART-TX -> PA_2
UART-RX -> PA_3
MCO -> OSC_IN (PF0)

I think there is a reason why this line is commented, but I can’t figure it out, because MCO is connected to another pin and soon will get rid of it, enabling the 8 Mhz crystal.

Edit: using Mbed OS 6.3

Any help will be really appreciated.
Thank you.

Hello Mixtli,

My guess is that the line is commented by a mistake. Although, according to the datasheet, the PA8 pin alternate function could be also MOC_1 but it isn’t configured that way (at least I was not able to find such code). However, the PA8 pin is indeed connected to the MCO line, but according to the schematics on the STM32F103CBT6’s MCU (used for the ST-LINK/V2-1) rather than on the STM32F411RE’s one. This could confuse the code designer.

Best regards, Zoltan

The MCO can be used for checking the clock or supplying a fixed clock to other devices. The on board STLink uses this to supply the main MCU with the clock (saves a few cents for an additional xtal).
On the main MCU, the pin can be used for another function when MCO is not needed. But for this modification in the Mbed-os you should create a custom target, otherwise it will be overwritten by an update and you will search again:)
Some targets support also supplying a static pinmap, that may work also, but I haven’t tried it yet.

Hi

My guess is that the line is commented by a mistake

I agree… :frowning:
I will try to update it soon

Thx for report

Jerome

Thank you all.

Greetings