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

Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Topics - pravin

Pages: [1]
1
General Discussion / FT812 DISPLAY
« on: September 15, 2018, 10:53:04 AM »
Hi , i bought FT812 display few days before and wants to communicate with over SPI. I am using freescale MK22FX512VLL12 controller.

 I am not able to  read chip id( 0x7c ).Always getting 0 in RX Buffer

Please help me to work this,

I am referring FT800 sample code and i have also changed REG_ADD according to FT81XX DATASHEET

My code is:

        SpiHostCommand(FT_GPU_EXTERNAL_OSC);
   Delay(1);
   SpiHostCommand(FT_GPU_ACTIVE_M);
   Delay(1);
   SpiHostCommand(FT_GPU_PLL_48M);          //  Ensure configured to 48 MHz
   Delay(1);
   SpiHostCommand(FT_GPU_CORE_RESET);     // Reset the core     
   Delay(1);
   SpiHostCommand(FT_GPU_ACTIVE_M);
        Delay(1);       
       chipid = 0x00;                                  // Read the Chip ID to check comms with the FT800 - should be 0x7C
   while(chipid != 0x7C){
      SpiSendAddresstoLcd(REG_ID); // REG_ID   302000h
      chipid = SpiReadLcd();  // Read the actual value
   }

 
void SpiHostCommand(unsigned char  HostCommand)
{
   unsigned char SentData;
   PORT_LCD_CS1B &= ~GPIO_PDOR_PDO(GPIO_PIN(LCD_CS1B));
   SentData=(HostCommand & 0x3F | 0x40 );
   SPI_Send_byteToLcd(SentData);
   SentData=0x00;
   SPI_Send_byteToLcd(SentData);
   SentData=0x00;
   SPI_Send_byteToLcd(SentData);
   PORT_LCD_CS1B |= GPIO_PDOR_PDO(GPIO_PIN(LCD_CS1B));
   
}

void SpiSendAddresstoLcd(unsigned long Memory_Address)///read data from memory address
{
   unsigned char SPI_Writebyte;
   
   PORT_LCD_CS1B &= ~GPIO_PDOR_PDO(GPIO_PIN(LCD_CS1B));
   SPI_Writebyte = ((Memory_Address & 0x00FF0000) >> 16);  // Mask off the first byte to send
   SPI_Writebyte = (SPI_Writebyte & 0x3F);                 // Since this is a read, the upper two bits are forced to 00
   SPI_Send_byteToLcd(SPI_Writebyte);                       // Call the low-level SPI routine for this MCU to send this byte
      
   SPI_Writebyte = ((Memory_Address & 0x0000FF00) >> 8);   // Mask off the next byte to be sent
   SPI_Send_byteToLcd(SPI_Writebyte);                       // Call the low-level SPI routine for this MCU to send this byte

   SPI_Writebyte = (Memory_Address & 0x000000FF);          // Mask off the next byte to be sent (least significant byte)
   SPI_Send_byteToLcd(SPI_Writebyte);                       // Call the low-level SPI routine for this MCU to send this byte
                  
       // Send dummy 00 as required in the FT800 datasheet when doing a read
   SPI_Writebyte = 0x00;                                   // Write dummy byte of 0
   SPI_Send_byteToLcd(SPI_Writebyte);                       //

}

unsigned char SpiReadLcd()
{
   unsigned char Data=0x00;
   
   Data=SPI_Receive_byteFromLcd();
   PORT_LCD_CS1B |= GPIO_PDOR_PDO(GPIO_PIN(LCD_CS1B));
   return Data;
   
}

Pages: [1]