286
General Discussion / Re: How to read REG_ID register
« on: October 13, 2021, 01:18:07 PM »
Hi,
It will depend on which display you have and which EVE family device you use,
The Programmers guide for your EVE device will have details of the start-up sequence e.g. see section 2.4 if you use BT81x
https://brtchip.com/wp-content/uploads/2021/09/BRT_AN_033_BT81X-Series-Programming-Guide.pdf
It is also best to check the documentation for your module as it may have additional requirements.
Here is a rough start-up sequence just as a guide,
Best Regards, BRT Community
It will depend on which display you have and which EVE family device you use,
The Programmers guide for your EVE device will have details of the start-up sequence e.g. see section 2.4 if you use BT81x
https://brtchip.com/wp-content/uploads/2021/09/BRT_AN_033_BT81X-Series-Programming-Guide.pdf
It is also best to check the documentation for your module as it may have additional requirements.
Here is a rough start-up sequence just as a guide,
Code: [Select]
// Reset the display
MCU_Delay_20ms();
HAL_PowerDown(1);
MCU_Delay_20ms();
HAL_PowerDown(0);
MCU_Delay_20ms();
#if (defined EVE1_ENABLE)
// FT80x_selection - FT80x modules generally use external crystal
// You can also send the host command to set the PLL here if you want to change it from the default of 48MHz (FT80x) or 60MHz (FT81x)
// Clock selection and clock rate selection will put EVE to sleep and so must be before the Active command
// for example:
HAL_HostCmdWrite(0x44, 0x00); // 0x44 = HostCMD_CLKEXT
HAL_HostCmdWrite(0x62, 0x00); // 0x64 = HostCMD_CLK48M
#endif
#if defined (EVE3_ENABLE) || defined (EVE4_ENABLE)
// can optionally set to 72MHz system clock here
// In this case also adjust REG_FREQUENCY a few lines down from here in this file
HAL_HostCmdWrite(0x44, 0x00); // 0x44 = HostCMD_CLKEXT
HAL_HostCmdWrite(0x61, 0x46);
#endif
#if defined (EVE2_ENABLE) || defined (EVE3_ENABLE)|| defined (EVE4_ENABLE)
HAL_HostCmdWrite(0x68, 0x00); // Reset
#endif
// Set active
HAL_HostCmdWrite(0, 0x00);
// MCU_Delay_500ms(); // Optional delay can be commented so long as we check the REG_ID and REG_CPURESET
// Read REG_ID
while ((val = HAL_MemRead8(EVE_REG_ID)) != 0x7C)
{
}
// Ensure CPUreset register reads 0 and so FT8xx is ready
while (HAL_MemRead8(EVE_REG_CPURESET) != 0x00)
{
}
#if defined (EVE3_ENABLE) || defined (EVE4_ENABLE)
HAL_MemWrite32(EVE_REG_FREQUENCY, 72000000);
#endif
// LCD display parameters
// Active width of LCD display
HAL_MemWrite16(EVE_REG_HSIZE, EVE_DISP_WIDTH);
// Total number of clocks per line
HAL_MemWrite16(EVE_REG_HCYCLE, EVE_DISP_HCYCLE);
// Start of active line
HAL_MemWrite16(EVE_REG_HOFFSET, EVE_DISP_HOFFSET);
// Start of horizontal sync pulse
HAL_MemWrite16(EVE_REG_HSYNC0, EVE_DISP_HSYNC0);
// End of horizontal sync pulse
HAL_MemWrite16(EVE_REG_HSYNC1, EVE_DISP_HSYNC1);
// Active height of LCD display
HAL_MemWrite16(EVE_REG_VSIZE, EVE_DISP_HEIGHT);
// Total number of lines per screen
HAL_MemWrite16(EVE_REG_VCYCLE, EVE_DISP_VCYCLE);
// Start of active screen
HAL_MemWrite16(EVE_REG_VOFFSET, EVE_DISP_VOFFSET);
// Start of vertical sync pulse
HAL_MemWrite16(EVE_REG_VSYNC0, EVE_DISP_VSYNC0);
// End of vertical sync pulse
HAL_MemWrite16(EVE_REG_VSYNC1, EVE_DISP_VSYNC1);
// Define RGB output pins
HAL_MemWrite8(EVE_REG_SWIZZLE, EVE_DISP_SWIZZLE);
// Define active edge of PCLK
HAL_MemWrite8(EVE_REG_PCLK_POL, EVE_DISP_PCLKPOL);
// Turn on or off CSpread
HAL_MemWrite8(EVE_REG_CSPREAD, EVE_DISP_CSPREAD);
// Turn on or off Dither
HAL_MemWrite8(EVE_REG_DITHER, EVE_DISP_DITHER);
// Write first display list
HAL_MemWrite32((EVE_RAM_DL + 0), EVE_ENC_CLEAR_COLOR_RGB(0,0,0));
HAL_MemWrite32((EVE_RAM_DL + 4), EVE_ENC_CLEAR(1,1,1));
HAL_MemWrite32((EVE_RAM_DL + 8), EVE_ENC_DISPLAY());
HAL_MemWrite8(EVE_REG_DLSWAP, EVE_DLSWAP_FRAME);
// Read the GPIO register for a read/modify/write operation
regGpio = HAL_MemRead8(EVE_REG_GPIO);
// set bit 7 of GPIO register (DISP) - others are inputs
regGpio = regGpio | 0x80;
// Enable the DISP signal to the LCD panel
HAL_MemWrite8(EVE_REG_GPIO, regGpio);
// Write the PCLK or PCLK_FREQ register
// If setting PCLK_FREQ then also set REG_PCLK to 1 to enable extsync mode
#if (defined EVE4_ENABLE) && (defined SET_PCLK_FREQ)
HAL_MemWrite16(EVE_REG_PCLK_FREQ, EVE_DISP_PCLK_FREQ);
HAL_MemWrite8(EVE_REG_PCLK, 1);
# else
// Now start clocking data to the LCD panel
HAL_MemWrite8(EVE_REG_PCLK, EVE_DISP_PCLK);
#endif
HAL_MemWrite8(EVE_REG_PWM_DUTY, 127);
// ---------------------- Touch and Audio settings -------------------------
// Eliminate any false touches
HAL_MemWrite16(EVE_REG_TOUCH_RZTHRESH, 1200);
// turn recorded audio volume down
HAL_MemWrite8(EVE_REG_VOL_PB, EVE_VOL_ZERO);
// turn synthesizer volume down
HAL_MemWrite8(EVE_REG_VOL_SOUND, EVE_VOL_ZERO);
// set synthesizer to mute
HAL_MemWrite16(EVE_REG_SOUND, 0x6000);
// --------------------- Clear screen ready to start -----------------------
EVE_LIB_BeginCoProList();
EVE_CMD_DLSTART();
EVE_CLEAR_COLOR_RGB(0, 0, 0);
EVE_CLEAR(1,1,1);
EVE_DISPLAY();
EVE_CMD_SWAP();
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();
#if (defined EVE2_ENABLE || defined EVE3_ENABLE || defined EVE4_ENABLE)
// ---------------------- Reset all bitmap properties ------------------------
EVE_LIB_BeginCoProList();
EVE_CMD_DLSTART();
EVE_CLEAR_COLOR_RGB(0, 0, 0);
EVE_CLEAR(1,1,1);
for (i = 0; i < 16; i++)
{
EVE_BITMAP_HANDLE(i);
EVE_CMD_SETBITMAP(0,0,0,0);
}
EVE_DISPLAY();
EVE_CMD_SWAP();
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();
# else
// ---------------------- Reset all bitmap properties ------------------------
EVE_LIB_BeginCoProList();
EVE_CMD_DLSTART();
EVE_CLEAR_COLOR_RGB(0, 0, 0);
EVE_CLEAR(1,1,1);
for (i = 0; i < 16; i++)
{
EVE_BITMAP_HANDLE(i);
//EVE_CMD_SETBITMAP(0,0,0,0);
EVE_BITMAP_LAYOUT(0, 0, 0);
EVE_BITMAP_SIZE(0, 0, 0, 0, 0);
}
EVE_DISPLAY();
EVE_CMD_SWAP();
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();
#endif
Best Regards, BRT Community