S1D13781 über FSMC an STM32F7

Gast #4701268
Lesenswert?

hi

ich versuche es kurz zu fassen:

µC:   STM32F745
LCDC: Epson S1D13781
TFT:  3,5" 24bit RGB

benutzt wird CubeMX und die HAL lib

Der S1D13781 über indirect 8bit mode am FSMC verbunden:
1
  /** FMC GPIO Configuration
2
  PE2   ------> FMC_A23   ---> P/C#
3
  PD14  ------> FMC_D0    ---> DB0
4
  PD15  ------> FMC_D1    ---> DB1
5
  PD0   ------> FMC_D2    ---> DB2
6
  PD1   ------> FMC_D3    ---> DB3
7
  PE7   ------> FMC_D4    ---> DB4
8
  PE8   ------> FMC_D5    ---> DB5
9
  PE9   ------> FMC_D6    ---> DB6
10
  PE10  ------> FMC_D7    ---> DB7
11
  PD4   ------> FMC_NOE   ---> RD
12
  PD5   ------> FMC_NWE   ---> WR
13
  PD7   ------> FMC_NE1   ---> CS
14
  */
15
  // GPIO Parameter: 
16
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
17
  GPIO_InitStruct.Pull = GPIO_PULLUP;
18
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
19
  GPIO_InitStruct.Alternate = GPIO_AF12_FMC;

FSMC ist folgendermaßen initialisiert:
1
static void MX_FMC_Init(void)
2
{
3
  FMC_NORSRAM_TimingTypeDef Timing;
4

5
  /** Perform the SRAM1 memory initialization sequence
6
  */
7
  hsram1.Instance       = FMC_NORSRAM_DEVICE;
8
  hsram1.Extended       = FMC_NORSRAM_EXTENDED_DEVICE;
9
  /* hsram1.Init */
10
  hsram1.Init.NSBank       = FMC_NORSRAM_BANK1;
11
  hsram1.Init.DataAddressMux     = FMC_DATA_ADDRESS_MUX_DISABLE;
12
  hsram1.Init.MemoryType     = FMC_MEMORY_TYPE_SRAM;
13
  hsram1.Init.MemoryDataWidth     = FMC_NORSRAM_MEM_BUS_WIDTH_8;
14
  hsram1.Init.BurstAccessMode     = FMC_BURST_ACCESS_MODE_DISABLE;
15
  hsram1.Init.WaitSignalPolarity   = FMC_WAIT_SIGNAL_POLARITY_LOW;
16
  hsram1.Init.WaitSignalActive     = FMC_WAIT_TIMING_BEFORE_WS;
17
  hsram1.Init.WriteOperation     = FMC_WRITE_OPERATION_ENABLE;
18
  hsram1.Init.WaitSignal     = FMC_WAIT_SIGNAL_DISABLE;
19
  hsram1.Init.ExtendedMode     = FMC_EXTENDED_MODE_DISABLE;
20
  hsram1.Init.AsynchronousWait     = FMC_ASYNCHRONOUS_WAIT_DISABLE;
21
  hsram1.Init.WriteBurst     = FMC_WRITE_BURST_DISABLE;
22
  hsram1.Init.ContinuousClock     = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
23
  hsram1.Init.WriteFifo     = FMC_WRITE_FIFO_DISABLE;
24
  hsram1.Init.PageSize       = FMC_PAGE_SIZE_NONE;
25
  /* Timing */
26
  Timing.AddressSetupTime     = 10;
27
  Timing.AddressHoldTime     = 0;
28
  Timing.DataSetupTime       = 40;
29
  Timing.BusTurnAroundDuration     = 0;
30
  Timing.CLKDivision       = 0;
31
  Timing.DataLatency       = 0;
32
  Timing.AccessMode       = FMC_ACCESS_MODE_B;
33
  if (HAL_SRAM_Init(&hsram1, &Timing, NULL ) != HAL_OK)
34
  {
35
    Error_Handler();
36
  }
37

38
  /*Configure GPIO pin : PA8 */
39
  GPIO_InitStruct.Pin = GPIO_PIN_8;
40
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
41
  GPIO_InitStruct.Pull = GPIO_NOPULL;
42
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
43
  GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
44
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
45

46
  HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_2);// 8Mhz
47
}
mit den Modi und den Timings habe ich schon gespielt.



Daraus ergeben sich folgende Adressen:
1
volatile char * LCD_COMMAND_ptr = ((char *)  0x60000000);
2
volatile char * LCD_DATA_ptr   = ((char *) (0x60000000 + ( 1 << 23)));  // RS an pin A23


Laut datenblatt des S1D13781 :
1
//write : 
2
*LCD_COMMAND_ptr = (UInt8) addr;
3
*LCD_COMMAND_ptr = (UInt8)(addr>> 8);
4
*LCD_COMMAND_ptr = (UInt8)(addr>>16);
5

6
*LCD_DATA_ptr = (UInt8) val;
7
*LCD_DATA_ptr = (UInt8)(val>> 8);
8

9
// read
10
*LCD_COMMAND_ptr = (UInt8) addr;
11
*LCD_COMMAND_ptr = (UInt8)(addr>> 8);
12
*LCD_COMMAND_ptr = (UInt8)(addr>>16);
13
UInt16 Value     = (UInt16)*LCD_DATA_ptr<<0;
14
       Value    |= (UInt16)*LCD_DATA_ptr<<8;



Jedoch kommt nicht das heraus was im Datenblatt steht
Hat vieleicht jemand den Epson controler am laufen und kann tips geben?
Oder mache ich am FSMC was falsch?

Vielen dank
Grüße
Gast #4701339
Lesenswert?

ergänzung:


ich habe etwas experimentiert und nun gesehen das er 16bit zugriffe zu 
machen scheint.

bei 3byte adresse und 1byte daten wird der WR pin 2x auf LOW gezogen
sollte aber 4x sein.


scheint so als wäre der zurgiff immernoch auf 16bit...

teste gerade diverse forenbeiträge die ähnliches behandeln
1
#define LCD_REG              (*((volatile unsigned char *)  0x60000000)) /* RS = 0 */
2
#define LCD_RAM              (*((volatile unsigned char *) (0x60000000+( 1 << 23)))) /* RS = 1 */
Gast #4703440
Lesenswert?

Idee zu später Stunde....

Ich gebe ja 5 Werte aus...
3x Adresse und 2x Daten

2xadressbytes  und er schiebt raus ...
1x Adresse +1x Daten und er schiebt raus
Das letzt datenbTe wird verschluckt

Das erklärt die 2x Weite



Er arbeitet quasi immer 16bittig

Ich versuche mal 16 Bit Zugriffe und nutze nur die unteren 8 Bit.
Gast #4703685
Lesenswert?

caches !!!


LCD_REG8   = (uint8_t)(addr>> 0);
__DSB();
LCD_REG8   = (uint8_t)(addr>> 8);
__DSB();
LCD_REG8   = (uint8_t)(addr>> 16);
__DSB();

jetzt sieht es zumindest brauchbar aus ... ob das funzt weiß ich noch 
nicht
Gast #4706440
Lesenswert?

so funzt das erstmal


auch über DMA schent es keine Probleme zu machen


das problem tritt nur auf wenn man die CPU async zur peripherie betreibt
und caches an hat.
dann verhaspelt er sich


bild läuft !!

ende

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren