FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: BT816 and PIC18F46K22 with external memory (SD CARD)  (Read 9775 times)

elektor18

  • Newbie
  • *
  • Posts: 3
    • View Profile
BT816 and PIC18F46K22 with external memory (SD CARD)
« on: May 07, 2019, 12:01:25 PM »

Hello,

I'm currently using BT816 with PIC18 (example from FTDI website) but what I found is when I upload the code it does not always display it for some reason, especially when I add some extra line with text to display...that is weird. But what I want to achieve is to display "bigger" image from SD card. Can someone help, please?
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #1 on: May 07, 2019, 02:26:42 PM »

Hello,

Can you give me an example of what you change in the display list for the screen to not display?

Also unfortunately we do not have any examples which cover loading data from an SD for PIC MCUs, but one this has been achieved the same EVE procedure can be used to display the image as detailed in BRT_AN_014.

Best Regards,
FTDI Community.
Logged

elektor18

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #2 on: May 07, 2019, 02:34:15 PM »

Thank you for fast reply.

Code: [Select]
void APP_LoadImagePNG(void)
{
    uint16_t Reg_Cmd_Write_Offset = 0;
    uint16_t ParameterAddr = 0;
    uint32_t End_Address = 0;
    uint32_t Width = 0;
    uint32_t Height = 0;
    uint32_t StartAddress = 0;
   

       
    API_LIB_BeginCoProList();                                                   // Begin new co-processor list
  ////////////////////////////////////////////////////////////////////// 

 /////////////////////////////////////////////////////////////////////// 
    API_CMD_LOADIMAGE(StartAddress,0);                                          // Load image command. Extract data to RAM_G + 0, options = 0
    API_LIB_EndCoProList();                                                     // Finish the co-processor list
    API_LIB_WriteDataToCMD(EVE_PNG, sizeof(EVE_PNG));                           // Send data immediately after the command (since we don't select MEDIAFIFO as source in Options))
    API_LIB_AwaitCoProEmpty();                                                  // Await completion of the Load Image. Image will now be in RAM_G
   
 
    // ###### Check parameters of decompressed image ########
    API_LIB_BeginCoProList();                                                   // Begin co-pro list
    API_CMD_GETPROPS(0, 0, 0);                                                  // GetProps command with three dummy 32-bit values
    API_LIB_EndCoProList();                                                     // Finish the co-processor list
    API_LIB_AwaitCoProEmpty();                                                  // Await the command completion

    Reg_Cmd_Write_Offset = EVE_MemRead16(REG_CMD_WRITE);                        // Check current pointer value

    ParameterAddr = ((Reg_Cmd_Write_Offset - 12) & 4095);                       // Go back by 12 bytes to get end address parameter
    End_Address = EVE_MemRead32((RAM_CMD+ParameterAddr));

    ParameterAddr = ((Reg_Cmd_Write_Offset - 8) & 4095);                        // Go back by 8 bytes to get width parameter
    Width = EVE_MemRead32((RAM_CMD+ParameterAddr));   

    ParameterAddr = ((Reg_Cmd_Write_Offset - 4) & 4095);                        // Go back by 4 bytes to get height parameter
    Height = EVE_MemRead32((RAM_CMD+ParameterAddr));   
   
    // ######################################################     
   
    API_LIB_BeginCoProList();                                                   // Begin new screen
    API_CMD_DLSTART();                                                          // Tell co-processor to create new Display List
    API_CLEAR_COLOR_RGB(50, 70, 200);                                               // Specify color to clear screen to
    API_CLEAR(1,1,1);                                                           // Clear color, stencil, and tag buffer
    API_COLOR_RGB(255,255,255);                                                 // White colour will display image with original colours
   
    [b][color=red]API_CMD_GRADIENT(0, 0, 0xF11F11, 0, 160, 0x0101FF); [/color][/b]
 
    API_BITMAP_HANDLE(0);                                                       // Tell FT81x the properties of the bitmap we will display.
    API_BITMAP_SOURCE(StartAddress);                                             
    API_BITMAP_LAYOUT(RGB565, Width*2, Height);                                 // FMT, STR, H
    API_BITMAP_SIZE(BILINEAR, BORDER, BORDER, Width, Height);                   // W, H
    API_BITMAP_LAYOUT_H((Width * 2) >> 10, Height >> 9);
    API_BITMAP_SIZE_H(Width >> 9, Width >> 9);
     
    API_BEGIN(BITMAPS);     
    API_VERTEX2II(85,205,0,0);                                                   // Display image at (200,200)

    [b][color=red]API_CMD_BUTTON(20,20,60,20,14,0,"Page 1");[/color][/b] 
    API_END();
     
    API_DISPLAY();                                                              // Tell EVE that this is end of list
    API_CMD_SWAP();                                                             // Swap buffers in EVE to make this list active
    API_LIB_EndCoProList();                                                     // Finish the co-processor list burst write
    API_LIB_AwaitCoProEmpty();
       
//////////////////////////////////////////////////////////////////////////////////////////////
   
}


Only stuff in bold added.
I've just noticed, bold and colours don't work in code quote..sorry about that.
« Last Edit: May 07, 2019, 02:38:49 PM by elektor18 »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #3 on: May 07, 2019, 03:16:13 PM »

Hello,

What exactly is happening on the screen when you add these two lines.

Also FYI, there is no inbuilt font '14' (in your CMD_BUTTON call), the RAM and ROM fonts can be found in the datasheet, these range from 16-34.

Best Regards,
FTDI Community
Logged

elektor18

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #4 on: May 07, 2019, 03:39:22 PM »

Thank you for that spot, that was it! Wrong font size caused that problem.
Thank you again.
I will back if I find solution to load image from sd card for PIC uC.
Logged