Evgeny Erenburg

TWR-K70F120 + TWR-LCD-RGB Problem

Discussion created by Evgeny Erenburg on Oct 6, 2016

I have a problem to get the LCD going on the tower system.

I've created a project in Kinetis Design Studio and compiled D4D library.

 

D4D_SCREEN screen_entry;

int main(void)

{

    /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

    PE_low_level_init();

    /*** End of Processor Expert internal initialization.                    ***/

 

    status = D4D_Init((D4D_SCREEN*)&screen_entry);

    D4D_SetOrientation(D4D_ORIENT_LANDSCAPE);

 

  for(;;)

  {

 

  }

 

  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/

  #ifdef PEX_RTOS_START

    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */

  #endif

  /*** End of RTOS startup code.  ***/

  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/

  for(;;){}

  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/

} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

 

When I step into the code with a debugger I get to the D4DLCDHW_Init_K70LCDC function and here

 

#if D4DLCDHWFB_START_ADDRESS == 0

    // Allocate frame buffer memory

    if(d4dlcdhw_k70_lcdc_desc.fb_start_addr)

    {

      D4D_MemFree((void*)d4dlcdhw_k70_lcdc_desc.fb_start_addr);

      d4dlcdhw_k70_lcdc_desc.fb_start_addr = 0;

    }

    d4dlcdhw_k70_lcdc_desc.fb_start_addr = (unsigned long)D4D_MemAlloc(D4DLCDHWFB_X_MAX * D4DLCDHWFB_Y_MAX * D4DLCDHWFB_BPP_BYTE);

    if(!d4dlcdhw_k70_lcdc_desc.fb_start_addr)

      return 0;

  #endif

 

the line d4dlcdhw_k70_lcdc_desc.fb_start_addr = (unsigned long)D4D_MemAlloc(D4DLCDHWFB_X_MAX * D4DLCDHWFB_Y_MAX * D4DLCDHWFB_BPP_BYTE); returns 0 – it fails allocate frame buffer memory.

Should I use the dynamic allocation? Or I can set the start address manually.

Anyway if I configure it manually: #define D4DLCDHWFB_START_ADDRESS 0x80400000

Then I get to D4D_InvalidateScreen(D4D_SCREEN* pScreen, Byte bComplete)

And on the line pScreen->pData->flags |= D4D_SCR_FINT_REDRAWC; I get into some exception interrupt:

PE_ISR(Cpu_Interrupt)

{

  /* This code can be changed using the CPU component property "Build Options / Unhandled int code" */

  PE_DEBUGHALT();

}

 

At this point I have no idea what to do.

 

The D4D library quite complicated with a lot of settings to define. May be something is not properly configured?

What should be the configurations in order to use D4D with TWR-K70F120 + TWR-LCD-RGB?

Outcomes