5 years, 8 months ago.

Problem usage of i2c 2 lpc1768

I can`t use Adafruit / SSD1306 OLED 128x32 or 128x64 with p28 and p27 in lpc1768, does it work on this port? what for the reset pin is use ?, i'm using the i2c.

Question relating to:

1 Answer

5 years, 8 months ago.

The example code uses p27 as Reset pin and p9,p10 for the I2C bus.

....

I2CPreInit gI2C(p9,p10);
Adafruit_SSD1306_I2c gOled2(gI2C,p27);
 
int main()
{   uint16_t x=0;
 
    gOled1.printf("%ux%u OLED Display\r\n", gOled1.width(), gOled1.height());
    gOled2.printf("%ux%u OLED Display\r\n", gOled2.width(), gOled2.height());
    
   ....

When you want to use p27,p28 for the I2C then some other DigitalOut pin should be used for the Reset function. For example:

I2CPreInit gI2C(p28,p27);
Adafruit_SSD1306_I2c gOled2(gI2C,p26);
 
int main()
....

Make sure the reset pin is connected to the display, also make sure you have pull up resistors of 4k7 on SDA and SCL.

Hi Wim,

What if there is no RST pin of Display. My display only has 4 connections. GND, VCC, SCL, SDA.

Do i still need to give some pin for RST? TIA.

Regards

Sohaib

posted by sohaib qamar 26 Sep 2018

In case your display module has no RST pin that means it has been integrated on the display board itself as a reset that is only generated at power-on. Should be OK as long as your code behaves and does not crash the display. In that case you cant press the mbed LPC1768 reset pin to restart your code and thus generate an external reset to start the display again. You will have to cycle the board power to achieve a reset of the display. The lib should still work even if the RST pin is not connected. Just leave the p26 unconnected. The alternative could be to use the "NC" pinname instead of p26, but that might not work depending on how the lib was implemented. Try it out and if it doesnt work live with a wasted pin.

posted by Wim Huiskamp 27 Sep 2018