Author Topic: ILI9163 dosen't seem to recieve data.  (Read 1493 times)

0 Members and 1 Guest are viewing this topic.

Offline msalkoTopic starter

  • Newbie
  • Posts: 5
  • Country: cz
ILI9163 dosen't seem to recieve data.
« on: August 07, 2015, 11:56:56 am »
Hi. I'm working on a project with ili9163 lcd and tiny gecko.
the display works, but it won't recieve image data i send in.

do you guys know what might be the issue?

here is my code:
Code: [Select]
void LCD_init(void)
{
// enable peripheral and spi clock
CMU_ClockEnable(cmuClock_GPIO,1);
CMU_ClockEnable(cmuClock_USART1,1);

// set maximal speed
CMU_ClockDivSet(cmuClock_HFPER,1);


GPIO_PinModeSet(LCD_CS_PORT, LCD_CS_PIN, gpioModePushPull, 1);
GPIO_PinModeSet(LCD_CLK_PORT, LCD_CLK_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_A0_PORT, LCD_A0_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_TX_PORT, LCD_TX_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_RST_PORT, LCD_RST_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_LED_PORT, LCD_LED_PIN, gpioModePushPull, 0);

LCD_USART->CTRL |= USART_CTRL_SYNC; //set sinchronous mode
LCD_USART->FRAME |= USART_FRAME_DATABITS_EIGHT; // set nine databits

LCD_USART->CMD |= USART_CMD_TXEN; // enable transmit
LCD_USART->CMD |= USART_CMD_RXEN; // enable recieve
LCD_USART->CMD |= USART_CMD_MASTEREN; // enable master mode

LCD_USART->ROUTE |= LCD_USART_LOC; // set desired location
LCD_USART->ROUTE |= USART_ROUTE_CLKPEN; //enable clock
LCD_USART->ROUTE |= USART_ROUTE_CSPEN; //enable clock
LCD_USART->ROUTE |= USART_ROUTE_TXPEN; //enable clock

LCD_USART->CTRL |= USART_CTRL_CLKPHA_SAMPLELEADING; // set sample leading
LCD_USART->CTRL |= USART_CTRL_AUTOCS; //set auotomatic cs
LCD_USART->CTRL |= USART_CTRL_MSBF; //set most significant bit first

LCD_USART->CLKDIV = 0x0; // set some delay

}


/**************** basic functions ********************/

void LCD_ON(void)
{
// turn led on
GPIO_PinOutSet(LCD_LED_PORT, LCD_LED_PIN);

//activate sequence
GPIO_PinOutSet(LCD_RST_PORT, LCD_RST_PIN);
delay_ms(1);

GPIO_PinOutClear(LCD_RST_PORT, LCD_RST_PIN);
delay_ms(10); // warning time critical!!

GPIO_PinOutSet(LCD_RST_PORT, LCD_RST_PIN);
delay_ms(50);


//************* Start Initial Sequence **********//
LCD_CMD(LCD_CMD_soft_reset); //reset registers

LCD_CMD(LCD_CMD_sleep_mode_exit); //Exit Sleep
delay_ms(10);

LCD_CMD(LCD_CMD_display_on); // Display On;

LCD_CMD(LCD_CMD_idle_mode_exit); // exit idle

LCD_CMD(LCD_CMD_mode_normal); // normal mode

LCD_CMD(LCD_CMD_set_pixel_format);
LCD_data(0b00000110); // set pixel format to 18 bit;

}

void LCD_OFF(void)
{
LCD_Push(1,0x28);
GPIO_PinOutClear(LCD_LED_PORT, LCD_LED_PIN);
}

/******************** end of basic functions ***************/




/******************** data io functions ********************/

void LCD_Push(uint8_t DC,uint8_t data)
{

//wait for it
while( !(USART1->STATUS & USART_STATUS_TXBL));

GPIO->P[3].DOUT = (GPIO->P[3].DOUT & ~(1<<LCD_A0_PIN)) | ((DC & 1)<<LCD_A0_PIN);

//send data
LCD_USART->TXDATA= (data) & 0xff;

}

void LCD_CMD(uint8_t data)
{
LCD_Push(0, data);
}

void LCD_data(uint8_t data)
{
LCD_Push(1, data);
}

/******************** end of data io functions ********************/




/******************** simplifying functions ***********************/
void LCD_data_ADRESS(uint16_t start_adr, uint16_t end_adr) // send adress data
{
//send start adress
LCD_data(start_adr & 0xff); //send lower byte
LCD_data((start_adr >> 8) & 0xff); //send higher byte

//send end adress
LCD_data(end_adr & 0xff);
LCD_data((end_adr >> 8) & 0xff);
}
void LCD_data_color(bitmap_t color) // send color data
{

// data needs to be R,G,B and only 6b per color
LCD_data((color.R & 0b111111) << 2);
LCD_data((color.G & 0b111111) << 2);
LCD_data((color.B & 0b111111) << 2);
}


/******************** end of simplifying functions ****************/


void LCD_Pset(uint16_t X, uint16_t Y, bitmap_t color)
{
LCD_CMD(LCD_CMD_adress_column);
LCD_data_ADRESS(X,X+1);

LCD_CMD(LCD_CMD_adress_page);
LCD_data_ADRESS(Y,Y+1);

LCD_CMD(LCD_CMD_memory_write_start);
LCD_data_color(color);
}


and this is main:
Code: [Select]
int main(void)
{
uint32_t a;
bitmap_t bmp;

bmp.R = 63;
bmp.G = 63;
bmp.B = 63;


CHIP_Init();

GPIO_DriveModeSet(gpioPortD,gpioDriveModeStandard);
GPIO_PinModeSet(gpioPortD,7,gpioModePushPull,0);

delay_init();

//initialize lcd
LCD_init();

//turn lcd on
LCD_ON();

for (a = 0; a < 0xfff; a++)
{
LCD_Pset(a,a,bmp);
}





}

void SysTick_Handler(void)
{
msTicks++;       /* increment counter necessary in Delay()*/
}
 

Offline msalkoTopic starter

  • Newbie
  • Posts: 5
  • Country: cz
Re: ILI9163 dosen't seem to recieve data.
« Reply #1 on: August 11, 2015, 12:46:27 pm »
Doh! I forgot to set internal voltages  |O
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf