1 year ago.

I2C and SPI pin names in Mbed documentation

The Mbed example program for SPI documentation uses the Arduino digital pin names D11, D12, D13 as shown here: https://os.mbed.com/docs/mbed-os/v5.14/apis/spi.html The Mbed example program for I2C documentation uses pin names preceded with 'I2C', as defined in the PinNames.h for the corresponding target. https://os.mbed.com/docs/mbed-os/v5.14/apis/i2c.html

Is this a convention to be followed? Will there be a consistency in how SPI and I2C pin names are defined for various targets?

1 Answer

1 year ago.

The pinnames D11, D12, I2C_SDA, USBTX etc are really just aliases for the actual port pinnumbers (eg P0_3). The Arduino names are used for the mbed boards that have an Arduino type connector (eg STM nucleos). Boards like the original mbed LPC1768 dont have that connector and use another convention (p7, p8,..) which are also placeholders for the actual pinnumbers. What is consistent is that USBTX, USBRX, MOSI, MISO, SCK, I2C_SDA, I2C_SCL etc are typically defined on all targets. This makes porting code between mbed platforms a bit easier. You still need to figure out where the actual pin can be found.

Accepted Answer

Thank you for the response. A follow up question to that: Is Mbed (or ARM) enforcing a standard to use pin names aliases like I2C_SDA and I2C_SCL in the board support package for the Mbed enabled boards?

Does the use of these aliases in the Mbed official documentation for I2C: https://os.mbed.com/docs/mbed-os/v5.14/apis/i2c.html, prove that this is a standard to follow or was it simply used to show a use-case?

posted by Malavika S 25 Nov 2019