1k views
in GUI Development by

Hello Experts

I have a custom board made with STM32L471 controller.

At the minimum, i only wanted to see something in display.

It is a Black and white display, so i have configured Index8 in profile.

I have following things done.

I have a separate component which takes care of LCD initialization and updating the LCD Frame buffer to LCD, in a separate 100ms raster ! (no LTDC or chromeart, simply passing to LCD via parallel port)

Initialized the EmWiz app in main function. Check the code below.


tlsf_t MemPool;
extern BYTE LcdRam[LCD_RAM_BUFFER_SIZE];
#define LCD_FB_START_ADDRESS (LcdRam) // LcdRam is the LCD mirror data and it is copied to LCD display, by different raster(100ms)


static void EmWiMainLoop( const void* arg );

/* define pyhiscal dimension of the LCD framebuffer */
#define FRAME_BUFFER_WIDTH    255
#define FRAME_BUFFER_HEIGHT   160

/* calculated addresses for framebuffer(s) and memory manager */
#define FRAME_BUFFER_SIZE     FRAME_BUFFER_WIDTH * FRAME_BUFFER_HEIGHT * FRAME_BUFFER_DEPTH
#define FRAME_BUFFER_ADDR     (void*)(LCD_FB_START_ADDRESS)

#define MEMORY_POOL_SIZE      0x1000
const BYTE memPool[MEMORY_POOL_SIZE]={0};
#define MEMORY_POOL_ADDR      ((void*)memPool )


#define EW_SURFACE_ROTATION 0
#define FREE_RTOS 0


CoreRoot   rootObject;
XViewport* viewport;

BYTE emWizInit(void)

{
    SetBackLight(TRUE);
       
    /* initialize tlsf memory manager */
    MemPool = tlsf_create_with_pool( MEMORY_POOL_ADDR, MEMORY_POOL_SIZE );
    
    /* initialize the Graphics Engine and Runtime Environment */
    if ( EwInitGraphicsEngine( 0 ) != 0)
    {
        dontComeIn = TRUE;
        return 1;
    }

    rootObject = (CoreRoot)EwNewObjectIndirect( EwApplicationClass, 0 );
    EwLockObject( rootObject );
    CoreRoot__Initialize( rootObject, EwScreenSize );
    
    viewport = EwInitViewport( EwScreenSize, EwNewRect( 0, 0, FRAME_BUFFER_WIDTH, FRAME_BUFFER_HEIGHT ),
                                0, 255, FRAME_BUFFER_ADDR, DOUBLE_BUFFER_ADDR, 0, 0 );
    return 0;
}

void EmWiMainLoop( const void* arg ) // this is in 100ms raster.
{

                Update( viewport, rootObject );

                /* after each processed message start the garbage collection */
                EwReclaimMemory();

}

void Update( XViewport* aViewport, CoreRoot aApplication )
{
    XBitmap*       bitmap     = EwBeginUpdate( aViewport );
    GraphicsCanvas canvas     = EwNewObject( GraphicsCanvas, 0 );
    XRect          updateRect = {{ 0, 0 }, { 0, 0 }};

    /* let's redraw the dirty area of the screen. Cover the returned bitmap
    objects within a canvas, so Mosaic can draw to it. */
    if ( bitmap && canvas )
    {
        GraphicsCanvas__AttachBitmap( canvas, (XUInt32)bitmap );
        updateRect = CoreRoot__UpdateGE20( aApplication, canvas );
        GraphicsCanvas__DetachBitmap( canvas );
    }

    /* complete the update */
    if ( bitmap )
    {
        EwEndUpdate( aViewport, updateRect );
    }

    /* check if there is a dirty area so that the screen should be updated */
    if (( updateRect.Point2.X - updateRect.Point1.X <= 0 ) || ( updateRect.Point2.Y - updateRect.Point1.Y <= 0 ))
    {
        return;
    }
}

 I have configured the EmWiSystemTicks to get updated on every 1ms.

code comes till EwNewObjectIndirect function and gets lost. Later it stucks at EwPanic function.

I dont have a serial console to see the output.

What and all the minimum things i should take care ?? 

please help !

--

Maha

1 Answer

0 votes
by

Hi,

since your controller does not have hardware components as LTDC or DMA2D - it might be the best starting point to use the STM32F407 Platform Package and Build Environment as a foundation for your project. Within the files ew_bsp_display.c you will find the access to the LCD and you can adapt it according your needs.

Furthermore, this Build Environment supports the scratch-pad buffer update, which makes it possible to have only a small buffer instead of a full screen framebuffer.

Best regards,

Manfred.

Embedded Wizard Website | Privacy Policy | Imprint

...