Jump to content

gfxInit() does not return


Laoky

Recommended Posts

Hello all,

I'm currently struggling with a strange effect. I've just finished to include uGFX on my Adafruit Feather M0 (ARM Cortex M0) arduino zero breakout.

The display i try to use is a TFT 5'' 800x480 touchscreen with a RA8875 driver. I use the driver file included in the library "gdisp_lld_RA8875.c"

At this point i've followed the arduino readme.txt file in the Teensy example included in the library. Everything is set up as described, and everything compiles.

I'm using VMicro on Visual Studio to program my board. At this point it is impossible to debug with a step by step functionality on my board.

What I've done to find the problem was to inserting "return" statement on the gfxInit() method, after each call made by this method. Actually the program does not return from _gdispInit() called from gfxInit().
I did a deeper search into the gdisp.c file to find out what's wrong, as this method is not called :
    LLDSPEC bool_t gdisp_lld_init(GDisplay *g) (declared into the uGFX "gdisp_lld_RA8875.c" driver.)

I think the program is sort of crashing before this method, because in the init_board method called in the beginning of
    LLDSPEC bool_t gdisp_lld_init(GDisplay *g)

is not called. As proof I've put some Serial.print(...) and even digitalWrite to a led, and it never happens :
    void RA8875_init_board(void) {
        Serial.println("init : " + millis());
        pinMode(RA8875_CS, OUTPUT);
        pinMode(RA8875_INT, INPUT);
        pinMode(RA8875_RESET, OUTPUT);
        digitalWrite(RA8875_CS, HIGH);
        //digitalWrite(RA8875_INT, HIGH);
        Serial.println("init : " + millis());
    }

At this point i dont know what could be wrong, as the error seems to be in the library and not in my board file, which would be more logical btw.

Can you help me ? I've attached my project files.

Thanks

gfx.zip

Edited by Laoky
Link to comment
Share on other sites

    // Get a new driver instance of the correct size and initialize it
    pd = gfxAlloc(vmt->objsize);
    
    if (!pd)
        return 0;
    memset(pd, 0, vmt->objsize);
    pd->vmt = vmt;
	digitalWrite(13, HIGH); //CALLED
    if (vmt->init && !vmt->init(pd, param, dinstance, sinstance)) {
        while (1) //NEVER CALLED
        {
            digitalWrite(13, HIGH);
            delay(100);
            digitalWrite(13, LOW);
            delay(100);
        }
        gfxFree(pd);
        return 0;
    }
    while (1) //NEVER CALLED NEITHER
    {
        digitalWrite(13, HIGH);
        delay(300);
        digitalWrite(13, LOW);
        delay(300);
    }

UPDATE : so I've managed to find where it crashes a bit further (in driver.c), by putting a test code with a while(1) blinking a led. The program crashes in the if test condition, as neither its content nor the following code is called. I'll keep you updated of my progression.

Edited by Laoky
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...