Hi,Is there any library for RA2L1MCU's SSD1306 OLED using I2C interface,If yes please provide the link, Thanks.
Hello izrtn,
I've made such library for RA2A1 MCU but I'm pretty sure it will work for RA2L1 as well. Here is the tutorial about it, and the link is at the end of it. https://www.circuitbread.com/tutorials/renesas-ra-8-porting-the-arduino-oled-library-to-the-renesas-ra-family
Kind regards,
Sergey
If this response, or one provided by another user, answers your question, please verify the answer. Thank you!
Renesas Engineering Community Moderatorhttps://community.renesas.com/https://academy.renesas.com/https://en-support.renesas.com/knowledgeBase/
is there any library which is written on C
ssd1306.zip
This is the port of the C library for RL78 MCU. You will just need to change some functions in the Adafruit_SSD1306.c file. Also please pay attention to the resolution of the display. In my program it's 64x32.
I have implemented the communication between Ra2l1 and SSD1306 OLED 0.96 inch 128*64;I'm not able to display proper values , getting speckled screen, what would be the issue
It looks like the display has been initialized but no data has been sent into it. Have you properly replaced all the I2C related functions?
Also if you have some oscilloscope or logic analyzer, you can check the signals if they are correct on the SCL and SDA pins. Otherwise you can just make sure that everything is transmitted correctly using the debugger and step-by-step execution.
hii sergey
i am facing same issue did i connect SDA and SCL pin with pullup resistor with the 5V? because i see some arcticles.
I using custom board for R7FA2l1.
thanks
Nikhil Kumar
Hello Nikhil Kumar,
If you use the display on the board you don't need any pull-up resistors as they already are attached on this board. Also please refer to this tutorial https://www.circuitbread.com/tutorials/renesas-ra-8-porting-the-arduino-oled-library-to-the-renesas-ra-family. Even if you use C instead of C++ you still can use the same functions to work with the I2C as in this tutorial.
Thanks sergey
Hlo i tried but screen will showing like this
And when i debug step by step then it is show if i didn't debug the code the no s reen will be visible. Pls give me some idea what i do wrong.
Try to add some delay (about 1 s ) after MCU reset before accessing to the display
Ok but what about the values it is showing only one page
Maybe wrong initialization. Have you changed the display dimensions in the Adafruit_SSD1306.h file?
You need to uncomment "#define SSD1306_128_64" and comment the "#define SSD1306_64_32".
I changed
Can you send me your project so I could check it?
i2c_oled.zip
Here is my test project. i am using R7FA2L1A93CFL MCU.
Nikhil kumar
OK, seems like I've found it.
In your project in the oled_display function you use this code:
And in the library I used this code looks different
So in your code it sends only one line while in my code it sends the whole display
Dear sergey,
i still facing same problem which is mention below:
1. I changed the code according to you but agein it will showing same.
2. If i use debugger and debug the code step by step then it will run only one page is run and if i run the code without debug step by step then the screen is showing only random pixels. no value will be display
3. why only one page is showing did i need to use different library or something or their is another methiod to initialize the code.
You need to assign the value I2C_MASTER_EVENT_ABORTED to the i2cMaster_event variable before the transmission because otherwise it keeps I2C_MASTER_EVENT_TX_COMPLETE and the loop finishes instantly.
Please check my function i2c_write from the above C++ library I provided.
void Adafruit_SSD1306::i2c_write(uint8_t* buf, uint16_t len) { fsp_err_t err; uint32_t timeout_ms = I2C_TRANSACTION_BUSY_DELAY; /* Send data to I2C slave */ g_i2c_callback_event = I2C_MASTER_EVENT_ABORTED; err = R_IIC_MASTER_Write(&g_i2c_master0_ctrl, buf, len, false); if (err == FSP_SUCCESS) { /* Since there is nothing else to do, block until Callback triggers*/ while ((I2C_MASTER_EVENT_TX_COMPLETE != g_i2c_callback_event) && timeout_ms) { R_BSP_SoftwareDelay(1U, BSP_DELAY_UNITS_MILLISECONDS); timeout_ms--;; } if (I2C_MASTER_EVENT_ABORTED == g_i2c_callback_event) { __BKPT(0); } } }
now it is working but code is stuck here anyidea what can i do
if (I2C_MASTER_EVENT_ABORTED == i2cMaster_event) { __BKPT(0); }
Probably at some point the I2C interface can't work out and gives this status. Actually you can just remove these lines if you are sure that the communication will restore normally.
I attached my updated code and result window,
The result window is showing same by using your code and my code
void oled_display(void) { fsp_err_t err; uint8_t tempbuf[17]; uint16_t MAX; ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0 ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0 ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0 // MAX = SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT/8; // I2C for (uint16_t y=0; y<SSD1306_LCDHEIGHT; y++) { tempbuf[0] = 0x40; for (uint8_t x=0; x<16; x++) { tempbuf[x+1] = buffer[y*16+x];//here is old code // tempbuf[x+1] = buffer[y];// here is your code both showing same display // y++; } /* Send data to I2C slave */ i2cMaster_event = I2C_MASTER_EVENT_ABORTED; err = R_IIC_MASTER_Write(&g_i2c_master0_ctrl, tempbuf, 17, false);// 0x40 + 16 data bytes if (err == FSP_SUCCESS) { while ((I2C_MASTER_EVENT_TX_COMPLETE != i2cMaster_event) && timeout_ms) { R_BSP_SoftwareDelay(1U, BSP_DELAY_UNITS_MILLISECONDS); timeout_ms--;; } } // y--; } }
i couldn't understand why output window is stuck there
code
Output window
I frankly don't see any reason for such behavior unless your MCU is reset for some reason in the middle of data transfer. Check the behavior with the step-by-step execution. Check the content of the "buffer"array after the "clearbuffer" function to make sure it's really clear.