Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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 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.