- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to connect a smaller OLED screen to my PSOC 4 Pioneer kit. The code seems to work for a larger version of this OLED (128x64), but when I try to modify it for the smaller 64x32 screen, I cannot get it to work. I updated the size related parameters and I can get my text to display, but just scrolling across the top small portion of the screen. I have looked around and cannot find any solution to this.
I have attached the project.
Thank you for any help you can give.
Regards,
Tom
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ToVa_285016 ,
Have you checked this already existing code example here , which interfaces the SSD1306 128*64 OLED with PSoC 4? Due to the limited resources at my end, I request you to please try this code example for once at your end and check if making changes to this project really works for the SSD1306 64*32 screen at your end?
Please do let us know your comments regarding this and we will try to help you out further.
Best Regards,
Aashita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your comment. In order to simplify things, I took your link and made only two code changes in SSD1306.c:
#define DISPLAYWIDTH 64
#define DISPLAYHEIGHT 32
And being unable to display anything, I made the following edit based on this here link (the author is attempting to do a similar thing)
void display_update(void) {
uint8 cmdbuf[] = {
0x00,
SSD1306_COLUMNADDR,
0x20, // start
(0x20 + (DISPLAYWIDTH-1)), // end
SSD1306_PAGEADDR,
0, // start
7 // end
};
display_write_buf( cmdbuf, sizeof(cmdbuf) );
display_write_buf( SSD1306_buffer, sizeof(SSD1306_buffer) );
}
This gets me to where I was before, only displaying a few lines correctly and not consistently:
I attached the updated project. Let me know if you have any questions or can help further.
Regards,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I just downloaded your project and took a short look at ssd1306.c and in display_init() there was a line
// call before first use of other functions
void display_init( uint8 i2caddr ){
...
SSD1306_SETMULTIPLEX, 0x3f,//(DISPLAYHEIGHT - 1),
If it's DISPLAYHEIGHT -1 = 32 - 1 = 31 = 0x1F
So how about trying
SSD1306_SETMULTIPLEX, 0x1f,//(DISPLAYHEIGHT - 1),
moto
(Edited) Some English correction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for the suggestion. I have tried this before, but I had it commented out because it did not work. Instead of getting anything to display, I get a total white noise screen instead:
If I use the 0x3F value, I at least get some of the display to show (see my post reply to Aashita above.
Let me know if you have any other suggestions.
Regards,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm sorry for my poor suggestion.
I googled a little for 64x32 SSD1306 OLED and the one I found was WINSTAR WEA006432A.
And in its datasheet there was
So you may need to offset the segment by 32 otherwise segment 0-31 won't be shown.
Note: If the display you are using has different configuration, this does not apply.
Meantime, I read the SSD1306 datasheet a little, and I added some comments in the cmdbuf[] in ssd1306.c
Since you can see some letters on the display, may be electrical setting is not wrong but some other settings
such as SSD1306_SETMULTIPLEX and SSD1306_SEGREMAP need to be considered again.
uint8 cmdbuf[] = {
0x00,
SSD1306_DISPLAYOFF,
SSD1306_SETDISPLAYCLOCKDIV, 0x80, // suggested ratio
// A[3:0] divide reatio (D) of DCLK, A[7:4]: Oscillator Frequency
SSD1306_SETMULTIPLEX, 0x3f, //(DISPLAYHEIGHT - 1),
// Set MUX ratio to N+1 MUX A[5:0] from 16MUX to 64MUX. RESET = 111111b = 0x3F
// 0-14 are invalid entry
SSD1306_SETDISPLAYOFFSET, 0x00, // No offset
// Set vertical shift by COM from 0d ~ 63d, reset = 0x00
SSD1306_SETSTARTLINE | 0x00, // Line 0
// Set display RAM display start line from 0 - 63, reset = 0x00
SSD1306_CHARGEPUMP, 0x10, // External VCC 0x10, else 0x14
SSD1306_MEMORYMODE, 0x00,
// 0: Horizontal Addressing, 1: Vertical Addressing, 2: Page Addressing 3: invalid
SSD1306_SEGREMAP | 0x1, // Set Segment Re-map
// A0: column address 0 is mapped to SEG0 (Reset)
// A1: column address 127 is mapped to SEG0
SSD1306_COMSCANDEC, // COM output scan directin
// C8: COM63 to COM0, C0: COM0 to COM63
SSD1306_SETCOMPINS, 0x12, // Set COM PIns Hardware Configuration
// 0 0 A5 A4 0 0 1 0
// A5 Enable COM Left/Right remap
// A4 0: Sequential COM pin, 1: Alternative COM pin
SSD1306_SETCONTRAST, 0x1F,
SSD1306_SETPRECHARGE, 0x22, // External VCC 0x22, else 0xF1
SSD1306_SETVCOMDETECT, 0x00,
SSD1306_DISPLAYALLON_RESUME,
SSD1306_NORMALDISPLAY,
SSD1306_DEACTIVATE_SCROLL,
SSD1306_DISPLAYON
};
In your picture, as I wrote the letters were written OK, although it seemed to have offset.
I wonder if you are drawing any graphic-pixels? or it may be natural that un-initialized pixel area is showing some random pattern.
And at the end of the datasheet, there was a software initialization Flow Chart,
which is slightly different from the cmdbuf[] sequence in ssd1306.c.
This may not be a problem, but if I were you, I would try to re-organize the command sequence to match with the datasheet's suggestion.
After all, I'm sorry that I don't have any concrete suggestion nor answer,
but this is what I could find so far 😉
BTW, what is the model number/name of your OLED display?
moto