Hi there
FMPI2C (high-speed I2C) of ST-micro NUCLEO-F446RE
I’m having trouble with FMPI2C not working.
When observing the waveform with an oscilloscope, a jitter-like waveform is produced.
Because the output pin is a high impedance, it seems that the port cannot be set.
I used HAL with CubeIDE and confirmed the operation.
There seems to be no problem with HAL, because it worked with HAL.
FMPI2C doesn’t work on mbed.
There is no signal at the output pin of the FMPI2C and it is high impedance.
Even if a pull-up resistor is attached to the output pin of FMPI2C, no signal is produced.
If you simply change the definition and change to I2C3, the signal will be output from the I2C3 output pin without any problem.
In I2C3, it works fine.
n the API of I2C, since there is a definition in PinMAP, it seems to be supported.
mbed-os\targets\TARGET_STM\TARGET_STM32F4\TARGET_STM32F446xE\TARGET_NUCLEO_F446RE
MBED_WEAK const PinMap PinMap_I2C_SDA[] =
{PB_3, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, // Connected to SWO
{PB_4, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{PB_7, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_9, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
// FMPI2C1 here
{PC_7, FMPI2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)},
{PC_9, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{PC_12, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
{NC, NC, 0}
} ;
MBED_WEAK const PinMap PinMap_I2C_SCL[] = {
{PA_8, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
{PB_6, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_8, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
{PB_10, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
// FMPI2C1 here
{PC_6, FMPI2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)},
{NC, NC, 0}
};
It is a hypothesis, and I followed it in the source as not being able to switch between fast FMPI2C and normal I2C, but it is difficult.
I looked at the API and driver sources, but I can’t solve it myself.
The tested source code is attached.
In the first definition, you can switch between FMPI2C1 and I2C3.
A little information would be greatly appreciated.
The way you look up the problems is also very helpful.
Thank you very much.
#include "mbed.h"
// ST-micro NUCLEO-F446RE
const int addr7bit = 0x48; // 7 bit I2C address
DigitalOut myled(LED1);
// **FMPI2C not working**
I2C FMPI2C(PC_7, PC_6); // FMPI2C Not working
// I2C3 working
//I2C FMPI2C(PC_9, PA_8); // I2C3 working
void fmpi2cTest() {
char cmd[2];
cmd[0] = 0x01;
cmd[1] = 0x00;
FMPI2C.write(addr7bit, cmd, 2);
wait(0.2); // 200 ms
cmd[0] = 0x00;
FMPI2C.write(addr7bit, cmd, 1);
FMPI2C.read( addr7bit, cmd, 2);
}
int main() {
while(1) {
myled = 1; // LED is ON
fmpi2cTest();
wait(0.2); // 200 ms
myled = 0; // LED is OFF
wait(1.0); // 1 sec
}
}