ILI9163 dosen't seem to recieve data. - Page 1
Forum section: electronics / projects

author: msalko
author_rank: Newbie
timestamp: August 07, 2015, 11:56:56 am
content: 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:void LCD_init(void){// enable peripheral and spi clockCMU_ClockEnable(cmuClock_GPIO,1);CMU_ClockEnable(cmuClock_USART1,1);// set maximal speedCMU_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 modeLCD_USART->FRAME |= USART_FRAME_DATABITS_EIGHT; // set nine databitsLCD_USART->CMD |= USART_CMD_TXEN; // enable transmitLCD_USART->CMD |= USART_CMD_RXEN; // enable recieveLCD_USART->CMD |= USART_CMD_MASTEREN; // enable master modeLCD_USART->ROUTE |= LCD_USART_LOC; // set desired locationLCD_USART->ROUTE |= USART_ROUTE_CLKPEN; //enable clockLCD_USART->ROUTE |= USART_ROUTE_CSPEN; //enable clockLCD_USART->ROUTE |= USART_ROUTE_TXPEN; //enable clockLCD_USART->CTRL |= USART_CTRL_CLKPHA_SAMPLELEADING; // set sample leadingLCD_USART->CTRL |= USART_CTRL_AUTOCS; //set auotomatic csLCD_USART->CTRL |= USART_CTRL_MSBF; //set most significant bit firstLCD_USART->CLKDIV = 0x0; // set some delay}/**************** basic functions ********************/void LCD_ON(void){// turn led onGPIO_PinOutSet(LCD_LED_PORT, LCD_LED_PIN);//activate sequenceGPIO_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 registersLCD_CMD(LCD_CMD_sleep_mode_exit); //Exit Sleepdelay_ms(10);LCD_CMD(LCD_CMD_display_on); // Display On;LCD_CMD(LCD_CMD_idle_mode_exit); // exit idleLCD_CMD(LCD_CMD_mode_normal); // normal modeLCD_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 itwhile( !(USART1->STATUS & USART_STATUS_TXBL));GPIO->P.DOUT = (GPIO->P.DOUT & ~(1<<LCD_A0_PIN)) | ((DC & 1)<<LCD_A0_PIN);//send dataLCD_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 adressLCD_data(start_adr & 0xff); //send lower byteLCD_data((start_adr >> 8) & 0xff); //send higher byte//send end adressLCD_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 colorLCD_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: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 lcdLCD_init();//turn lcd onLCD_ON();for (a = 0; a < 0xfff; a++){LCD_Pset(a,a,bmp);}}void SysTick_Handler(void){msTicks++; /* increment counter necessary in Delay()*/}

author: msalko
author_rank: Newbie
timestamp: August 11, 2015, 12:46:27 pm
content: Doh! I forgot to set internal voltages