4 years, 9 months ago.

OLED I2C with SSD1306 Driver

Hi Mbed Guru's,

I'm trying to make a i2c OLED display work with a KL43z board and I am getting hung up on what I may be seeing in the error list (i.e. what the mbed run-time it's trying to tell me about how I'm using it).

I started out with the adafruit SSD1306 driver (for i2c) and I tried to use pins PTE0 and PTE1 for the scl/sda lines. The test script compiles okay but when I run it (for these two pins) it says:

"mbed assertation failed: obj->pin != (PinName)NC, file: /extras/mbed_6f327212ef96/TARGET_KL43Z /TARGET_Freescale/TARGET_KLXX/gpio_object.h"

I didn't see the gpio_object.h (easily) and recalling some comments I read when trying to make a 4-line LCD/I2C app work that PTE0 and PTE1 had possible conflict problems with the KL43z I switched over to a different pair of data lines to use for i2c, being PTC1 and PTC2

With these two pins I get this error when I execute:

"pinmap not found for peripheral"

Can anyone point me in a direction to go from here?

I'm using one of the Adafruit "simple" routines I've imported from mbed called I2C_SSD1306_Helloworld_WIZwiki-W7500

I declare the pins as:

"I2C myI2C(PTC1,PTC2);"

1 Answer

4 years, 9 months ago.

"I started out with the adafruit SSD1306 driver (for i2c) and I tried to use pins PTE0 and PTE1 for the scl/sda lines."

Maybe you mixed up SDA and SCL? Try

I2C myI2C(PTE0, PTE1);  // PinName parameters are SDA, SCL  

The PTC1, PTC2 pair doesnt show up as valid I2C pair on the KL43 platform page.

Accepted Answer

I have a long history of D'oh moments, so I tried things both ways but no joy. :)

posted by Rick Knowles 07 Jan 2017

A little more digging. The problem isn't with the I2C, it is with the Adafruit OLED driver. When I comment this invocation out the test routine sees 0x78 coming back from the I2C interface. When I install the invocation for the Adafruit library things go bad:

mbed assertation failed: obj->pin != (PinName)NC, file: /extras/mbed_6f327212ef96/TARGET_KL25Z/TARGET_Freescale/TARGET_KLXX/gpio_object.h, line 36

is the return in that case. I've tried another version of the Adafruit GFX library and updated it too but no luck.

Is there anyone using the Adafruit GFX library who can help with this problem?

Thanks - Ott

posted by Rick Knowles 07 Jan 2017

Just to keep this thread up to date. I've gotten a version of the SSD1306 / Adafruit working - sort of. The version of the library I'm using has a problem in that the first two rows of the display start at the bottom of the screen and subsequent rows begin at the top. (The library's author (Neal Horman) notes that that version is only experiemental). I've adjusted the configuration .h files for 128x64 but no joy. I'm going to work with it a little more and then ask a question about it once I get a clearer picture of what is going on. L8R

posted by Rick Knowles 08 Jan 2017

I'm closing this question out as I've resolved my various concerns. Thanks to all.


posted by Rick Knowles 08 Jan 2017