cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 and ILI9320

kantarofilip
Associate II
Posted on February 20, 2012 at 13:54

Hi everyone,

I am working on project with stm32f and ili9320 lcd driver but i have a problem with FSMC inicialization.

can someone help me?

i am using also eCos operating system.....

thx..

#lcd #stm32-fsmc #ili9320
4 REPLIES 4
jpeacock2399
Associate II
Posted on February 20, 2012 at 16:23

On a 3210E Eval board I use FSMC Access Mode A,  NOR/SRAM bank 1 chip select 4,

Burst Access Mode disable, address setup time 10 (about 14ns), address hold time 0, data setup time 10 (about 14ns), bus turn 0, 16 bit bus.  This is based on a 72MHz clock.

I found the Ilitek ILI9320 seems to work well with 150ns write cycle, 300ns read cycle.

What is the FSMC problem?

  Jack Peacock

kantarofilip
Associate II
Posted on February 20, 2012 at 16:58

Hi Jack,

now it's OK with FSMC....but now i can only read the driver code(9320).....

kantarofilip
Associate II
Posted on February 20, 2012 at 17:11

to distinguish between Status/Index Register and LCD RAM I'am using A[1].......

0x6c00 0000 Status/Index

0x6c00 0002 LCD RAM

for both Status Read and Driver Code Read i've got -27872(hex) 9320(dec)

kantarofilip
Associate II
Posted on February 21, 2012 at 12:13

Here's what I've done...

These are parts of my code.....


#define add_0 0x00000002 

// RS of ILI9320 is connected to A[0] of FSMC //

// In case of a 16-bit external memory width(like ILI9320), the FSMC will 

// internally use HADDR[25:1] to generate the

// address for external memory A[24:0].

// Therefore HADDR[1] is used as RS


CYG_ADDRESS LCD_base=0x6C000000;

CYG_ADDRESS FSMC_base=0xA0000000;


void
lcd_write(unsigned 
char
offset,unsigned 
short
data)

{

HAL_WRITE_UINT16(LCD_base,offset);

HAL_WRITE_UINT16(LCD_base|add_0,data);

 //0x6C000000|0x00000002

}


short
lcd_read_status( 
void
)

{

short
data;

HAL_READ_UINT16(LCD_base,data);

return
data;

}


short
lcd_read_code( 
void
)

{

short
data;

HAL_WRITE_UINT16(LCD_base,0x00);

HAL_READ_UINT16(LCD_base|add_0,data);

return
data;

}


void
fsmc_config(
short
offset,
int
data)

{

HAL_WRITE_UINT16(FSMC_base+offset,data);

}


int
main( 
void
){

int
fsmc_c1,fsmc_c2,fsmc_c3; //FSMC configuration values

fsmc_c1=0x000050D1; //FSMC_BCR4

fsmc_c2=0x00000D0B; //FSMC_BTR4

fsmc_c3=0x00000B0B; //FSMC_BWTR4


fsmc_config(0x18,fsmc_c1); 
//0xA000 0000 + 8(4-1) //bank 1 region 4

fsmc_config(0x1C,fsmc_c2); 
//0xA000 0000 + 0x04 + 8(4-1)

fsmc_config(0x104,fsmc_c3); 
//0xA000 0000 + 0x104 + 8(4-1) **EXTMOD = ENABLE**


lcd_init(); 
// this works fine

printf(
''status: %d \t code: %d
''
,lcd_read_status(),lcd_read_code()); 

// I've got -27872(9320 in decimal) for both

return
0;

}

from the equations for FSMC timing I've got ADDSET=10(decimal) DATASET=10(decimal) maybe i am missing something.... any ideas? thanks, Filip.