Using FreeSoC2 with SSD1331 SPI oled module and Littlev GL ends up in infinite loop

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SaKrst
Level 3
Level 3
5 likes given First like received First like given

Hello good people from Cypress forum,

I have a problem using mentioned OLED module with Littlev graphic library that uses SPI to communicate as it ends up in infinite loop of IntDefaultHandler function.

Here is the screenshot from debug session

Debugger.jpg

When I go step by step, everything works fine until 135 line of lv_task.c file. After that I need to pause debugging and it ends up as shown on image that I posted above.

By using Google search I found that ending up in this infinite loop is (mostly) related to memory problems, but then when using I2C protocol to send data to SSD1306 controller everything works fine even though the same library is used, and the only difference is in using I2C instead of SPI.

The Littlev library was successfully used with ILI9341 controller in parallel mode with no problems as well.

Also, here is the minimal archive of the project in the attachment.

Any kind of help to resolve the problem or to understand what is going on would be great,

Thanks

0 Likes
1 Solution
SaKrst
Level 3
Level 3
5 likes given First like received First like given

The problem was resolved on LittlevGL forum by one of the developers of the graphic library.

I made a mistake in main.c while declaring gbuff[SSD1331_BUFF] array.

Instead of static uint8 gbuff[SSD1331_BUFF] it should have been static lv_color_t gbuff[SSD1331_BUFF].

After that all of the examples that I've tried are now working.

In the attachment is updated project archive with working examples if somebody is interested in trying it out.

Thanks RakshithM_16​ for quick response.

View solution in original post

5 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi SaKr_2051156​,

I downloaded your project and tried to build it. I am not able to find 'src/lv_version.h' file and it is throwing an error.  Can you please let me know if I am missing something?

This error occurs generally when you are trying to access a memory which is not allotted or if there is a stack/heap overflow. The project has a lot of files and a lot of nested functions.I see that you have increased stack and heap size. Can you also please verify that there is no stack/heap overflow?

As you have said that the library works without error, the chances of illegal memory access are low.

Also, is there any hardware changes to be made for the OLED display to be interfaced using SPI/I2C?

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes

Hi RakshithM_16​,

It seems that when I archived the project without including the lv_version.h file in the project file tree the file wasn't archived so I'm sorry about that.

Here is new attachment that has all the files needed, and that is successfully built in PSoC Creator.

I also posted about this problem on LittlevGL forum on this link https://forum.littlevgl.com/t/problem-with-ssd1331-spi-oled-module/1558

The problem occurs in for loop of lv_draw_basic.c line 693(I have put breakpoint there) when row gets to 40. Then obj->design_cb gets the value 0xFFFFFFFF which it shouldn't.

I did increase stack and heap size as that was recommended in IntDefaultHandler, but it didn't help. Also I don't know how to verify that there is no stack/heap overflow.

I think OLED module came configured for SPI communication and that SSD1331 doesn't support I2C by default, at lest that's what datasheet says.

Thank you,

Sava

0 Likes
SaKrst
Level 3
Level 3
5 likes given First like received First like given

The problem was resolved on LittlevGL forum by one of the developers of the graphic library.

I made a mistake in main.c while declaring gbuff[SSD1331_BUFF] array.

Instead of static uint8 gbuff[SSD1331_BUFF] it should have been static lv_color_t gbuff[SSD1331_BUFF].

After that all of the examples that I've tried are now working.

In the attachment is updated project archive with working examples if somebody is interested in trying it out.

Thanks RakshithM_16​ for quick response.

Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi SaKr_2051156,

Glad your issue has been resolved

Thanks a lot for sharing your project. I am sure it will definitely help others who are interested in interfacing SSD1331 OLED module.

Also, for further information regarding detection of stack overflow you can refer to the following threads -

how can i detect stack overflow?

How to trace stack overflow in running mode?

Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

Hi RakshithM_16​,

Thanks for useful information about stack overflow. I will try to make some buffer with FM25VN10-G memory so I'm sure it will be useful.

Thank you,

Sava

0 Likes