Hallo, ich habe ein Acelex STM32F407VET6 Board mit einem passenden Display von Acelex mit ILI9341 darauf. Die Ansteuerung per FSMC funktioniert auch, aber das Display flackert leicht bei jedem Schreibzugriff. Ein anderes Display mit ILI9325 zum Vergleich sieht absolut ruhig aus. An die 3V3 Versorgung habe ich noch einen 220µ Elko angeklemmt, keine Veränderung. Im Init vom ILI9341 habe ich auch schon verschiedene Optionen probiert, das Hintergrund flackern bleibt. Hat hier jemand diese µC+Display Kombi und kann das bestätigen oder wiederlegen? Ich habe mal ein Video auf YT hochgeladen, das ist nur schwer mit der Kamera einzufangen: https://youtu.be/cM-VeylqiPc Es geht mir dabei nicht um das Flackern der Textausgabe, das liegt am Verzug zwischen Hintergrund löschen und Textausgabe. Bei zeichnen auf der Chartfläche wird der Hintergrund nicht verändert, nur der Kurvenzug gezeichnet.
Bei der Initialisierung des ILI9341 Controllers in Zeile drölfzig muss eine 3 statt ein A stehen.
das wars nicht. Init Code vom FSMC oder Display hatte ich auch in Verdacht und verschiedenes probiert. Dabei ist mir wohl der STLink gestorben weil der das Target versorgt hat. Ich hatte zwar extra noch ein USB Kabel an das Target angeschlossen aber über den STLink floss wohl mehr Strom. Dann bin ich auch wieder auf meine Black Magic Probe zurückgewechselt und siehe da - das Bild steht ruhig und das Geflacker ist weg :) Der Display Initcode ist vom STM32duino, den benutzen mehrere Leute und wenn der faul wäre dann wäre das sicher schon aufgefallen. Das FSMC Init aus STM32duino/maplecore konnte ich nicht verwenden weil ich das für mbed portiert habe und da wird die STM HAL drunter verwendet. Da war ein ätzender Fehler drin und der Release Build funktionierte nicht. Ich hatte die BMP verdächtigt und deshalb den STLink von einem Nucleo Board angeklemmt. Der Fehler war aber in der FSMC Init Struktur ein paar Felder nicht gesetzt waren und die im Release auf ungültigen Werten standen und zu den merkwürdigsten Fehlern geführt hatten :( Das ist in der HAL leider sehr hässlich, wenn STM solche Strukturen in neueren Versionen erweitert und man die nicht richtig ausfüllt bekommt man erstmal vielleicht keine Fehler, aber sehr versteckte böse Nebeneffekte. Jedenfalls rennt es jetzt wieder. Ich hänge trotzdem nochmal meine Inits an, vielleicht ist ja doch noch was zu verbessern. Das Display Init von stevestrong von STM32duino verstellt nicht viel und setzt auf defaults, ich habe anderen code angesehen da wird schon mehr eingestellt. FSMC Init:
1 | void fsmc_lcd_init() { |
2 | |
3 | // enable peripherial clocks
|
4 | __HAL_RCC_GPIOD_CLK_ENABLE(); |
5 | __HAL_RCC_GPIOE_CLK_ENABLE(); |
6 | __HAL_RCC_FSMC_CLK_ENABLE(); |
7 | |
8 | // set GPIO Alternate Function FSMC
|
9 | GPIO_InitTypeDef GPIO_InitStructure; |
10 | GPIO_InitStructure.Alternate = GPIO_AF12_FSMC; |
11 | GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; |
12 | GPIO_InitStructure.Pull = GPIO_NOPULL; |
13 | GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH; |
14 | GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | |
15 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | |
16 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; |
17 | HAL_GPIO_Init(GPIOD, &GPIO_InitStructure); |
18 | |
19 | GPIO_InitStructure.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | |
20 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | |
21 | GPIO_PIN_15; |
22 | HAL_GPIO_Init(GPIOE, &GPIO_InitStructure); |
23 | |
24 | FSMC_NORSRAM_InitTypeDef FSMC_NORSRAMInitStructure; |
25 | FSMC_NORSRAMInitStructure.NSBank = FSMC_NORSRAM_BANK1; // ?? |
26 | FSMC_NORSRAMInitStructure.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; |
27 | FSMC_NORSRAMInitStructure.MemoryType = FSMC_MEMORY_TYPE_SRAM; |
28 | FSMC_NORSRAMInitStructure.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16; |
29 | FSMC_NORSRAMInitStructure.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; // disable |
30 | FSMC_NORSRAMInitStructure.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; |
31 | FSMC_NORSRAMInitStructure.WrapMode = FSMC_WRAP_MODE_DISABLE; |
32 | FSMC_NORSRAMInitStructure.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; |
33 | FSMC_NORSRAMInitStructure.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; |
34 | FSMC_NORSRAMInitStructure.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; |
35 | FSMC_NORSRAMInitStructure.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; |
36 | FSMC_NORSRAMInitStructure.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; |
37 | FSMC_NORSRAMInitStructure.WriteBurst = FSMC_WRITE_BURST_DISABLE; // enable? |
38 | FSMC_NORSRAMInitStructure.ContinuousClock = FSMC_CONTINUOUS_CLOCK_SYNC_ASYNC; |
39 | FSMC_NORSRAMInitStructure.WriteFifo = FSMC_WRITE_FIFO_ENABLE; |
40 | FSMC_NORSRAMInitStructure.PageSize = 0; |
41 | |
42 | HAL_StatusTypeDef status = HAL_OK; |
43 | status = FSMC_NORSRAM_Init(FSMC_Bank1, &FSMC_NORSRAMInitStructure); |
44 | |
45 | FSMC_NORSRAM_TimingTypeDef FSMC_NORSRAMTimingInitStructure; |
46 | FSMC_NORSRAMTimingInitStructure.AddressSetupTime = 7; // 100 ns (ADDSET+1)*12.5ns = CS to RW |
47 | FSMC_NORSRAMTimingInitStructure.AddressHoldTime = 0; |
48 | FSMC_NORSRAMTimingInitStructure.DataSetupTime = 3; // 50 ns (DATAST+1)*12.5ns = RW length |
49 | FSMC_NORSRAMTimingInitStructure.BusTurnAroundDuration = 0; |
50 | FSMC_NORSRAMTimingInitStructure.CLKDivision = 0; |
51 | FSMC_NORSRAMTimingInitStructure.DataLatency = 0; |
52 | FSMC_NORSRAMTimingInitStructure.AccessMode = FSMC_ACCESS_MODE_A; |
53 | FSMC_NORSRAM_Init(FSMC_Bank1, &FSMC_NORSRAMInitStructure); |
54 | |
55 | status = FSMC_NORSRAM_Timing_Init(FSMC_Bank1, &FSMC_NORSRAMTimingInitStructure, FSMC_NORSRAM_BANK1); |
56 | |
57 | /* Enable FSMC NOR/SRAM Bank1 */
|
58 | __FSMC_NORSRAM_ENABLE(FSMC_Bank1, FSMC_NORSRAM_BANK1); |
59 | |
60 | fsmcCommand = (volatile uint16_t*)NOR_MEMORY_ADRESS1; // clears A18 |
61 | fsmcData = (fsmcCommand+(1<<18)); // sets A18 |
62 | };
|
ILI9341 init, beide Tabellen werden nacheinander in den Controller geschrieben.
1 | const uint8_t reset_off[] = { |
2 | 0x01, 0, //Soft Reset |
3 | TFTLCD_DELAY8, 150, // .kbv will power up with ONLY reset, sleep out, display on |
4 | 0x28, 0, //Display Off |
5 | 0x3A, 1, 0x55 //Pixel read=565, write=565. |
6 | #ifdef ILI9486
|
7 | // PGAMCTRL(Positive Gamma Control)
|
8 | 0xE0, 15, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, |
9 | 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00, |
10 | // NGAMCTRL(Negative Gamma Control)
|
11 | 0xE1, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, |
12 | 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, |
13 | // Digital Gamma Control 1
|
14 | 0xE2, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, |
15 | 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, |
16 | #endif
|
17 | };
|
18 | |
19 | const uint8_t wake_on[] = { |
20 | 0x11, 0, //Sleep Out |
21 | TFTLCD_DELAY8, 150, |
22 | 0x29, 0, //Display On |
23 | //additional settings
|
24 | // 0x21, 0, // invert off
|
25 | 0x36, 1, 0x48, //Memory Access |
26 | 0xB0, 1, 0x40, //RGB Signal [40] RCM=2 |
27 | };
|
Ohne die Gammakorrektur sieht das Bild besser aus, aber das ist Feintuning.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.
