Author Topic: STM32F407 & ILI9341 FSMC  (Read 10490 times)

0 Members and 1 Guest are viewing this topic.

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #50 on: January 06, 2022, 12:55:45 pm »
If you can help, I'd like to know how.
That kind of knowledge escapes me.
With a 245 page datasheet, the idea that I could ever understand the concepts seems overwhelming.
I a heading to the idea that I won't be ever able to understand and should just throw it in a box and give up. :(
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #51 on: January 06, 2022, 01:24:32 pm »
I haven't tried inserting the array code yet because I wanted to understand why all the demos had failed.

I always wondered why there were 2 sets of resistors, 3 together, that were stacked high and low on the backside of the TFT.
I got busy in the ILI9341 manual and the first thing I noticed is no bookmarks, After 30 minutes of my life wasted making chapter and sub chapters in the PDF, I had my answer for what those resistors could doing.
Taking out the latest in superb Chinese technology multimeter as I didn't want to goose the TFT with 9V from my old Fluke, I probed the top and bottom rails of the board to ground and 3V3.
What I found was very logical. The top rail was 3V3 and the bottom ground.
Finding the TFT's 40 pin FPC pinout explained further. The last few pins 37-40 were the IM[3-0] config bits.
On my panel, all IM bits are grounded. The resulting configuration is 8 bit mode D7-0, not 16 bit!
I'll try to move the 5K1 resistor on bit IM0 to 3V3, in accordance to the config chart to make it 16 bit.
 :popcorn:

Ok before we go down the bit shift rabbit hole I relooked at a few ILI9341 boards and manuals and not all pinouts are the same so its only a assumption that yours matches exactly.
Could you be reading the Bits backwords ? eg IM0=IM3 in which case you are switching to 16bit mode 2, this requires the bits being shifted e.g "Data = Colour <<8|Colour;"
I also see that there is R1/4/6/7 which also seems to be 0ohm resistors for selection so that mean we now have 5 bits not just 3 bits you originally saw.
Also why is it so important that it must operate in 16bit mode ? it was working fine in 8 bit and you should use that to gain experience with the lcd or with programming lcd's in general,  have some fun learning to code before you whip out the old 85watt wella and start causing yourself more work, personally i would learn bitbashing the 8 bit bus before you try to complicate the issue.



darkspr1te
« Last Edit: January 06, 2022, 01:31:43 pm by darkspr1te »
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #52 on: January 06, 2022, 05:51:37 pm »
Here is the actual seller: https://www.aliexpress.com/item/32991977705.html?spm=a2g0o.9042311.0.0.762d4c4dfXfR0D
Only this black board should be used when referencing the FFC pinout.
pin 37 - IM 3 is grounded through a via as well as the previous 2 pins 35 & 35, making FSMC 16 II impossible to achieve.
The other resistors are on pins 17 & 18 - (DB0 & DB1)
I need the 16 bit mode because it fits on the 407VET board pin for pin and 16 bit mode is desirable for speed for one point and I don't know if resolution is at play or not.
I don't why the China and other provided examples don't work...the all say they except the don't.
Please if you can help with a working example as this would take a year or more for a dimwit :( like me to understand.
                        FFC Pin#/Function
   17  18                    17 = DB0
    |   |                    18 = DB1
    ▄   ▄
   R6   R7
____▄   ▄         
|       |____?               ? = Disappears through a micro via to parts unknown
|   13  |                    13 = SPI SDI/SDA
|   ▄|  ▄
|  R1   R4
|___▄   ▄____14              14 = SPI-SDO
« Last Edit: January 06, 2022, 05:56:25 pm by Quarlo Klobrigney »
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #53 on: January 07, 2022, 06:13:16 am »
Here is the actual seller: https://www.aliexpress.com/item/32991977705.html?spm=a2g0o.9042311.0.0.762d4c4dfXfR0D
Only this black board should be used when referencing the FFC pinout.
pin 37 - IM 3 is grounded through a via as well as the previous 2 pins 35 & 35, making FSMC 16 II impossible to achieve.
The other resistors are on pins 17 & 18 - (DB0 & DB1)
I need the 16 bit mode because it fits on the 407VET board pin for pin and 16 bit mode is desirable for speed for one point and I don't know if resolution is at play or not.
I don't why the China and other provided examples don't work...the all say they except the don't.
Please if you can help with a working example as this would take a year or more for a dimwit :( like me to understand.
                        FFC Pin#/Function
   17  18                    17 = DB0
    |   |                    18 = DB1
    ▄   ▄
   R6   R7
____▄   ▄         
|       |____?               ? = Disappears through a micro via to parts unknown
|   13  |                    13 = SPI SDI/SDA
|   ▄|  ▄
|  R1   R4
|___▄   ▄____14              14 = SPI-SDO
In order to confirm your findings we are going to have to run some test's. This means writing test code designed to replicate the FSMC function but diving us more control. That is not easily done , we also need you to understand the bus a little more so you in turn understand things like bit shifting, bit bashing as thats needed in your lcd case.

In the manual it states that in 8 bit mode the UPPER 8-bits are used, in 16 then the upper and lower 8 bits are used. This means we need to reverse the bits when *writing in the different modes ,
so 0xFFAA becomes 0xAAFF , that is the lower 8 bits of OUR data get push to the top and the top goes to the bottom.
see this page that also mentions is, http://www.lcdwiki.com/3.2inch_16BIT_Module_ILI9341_SKU:MRB3205

another thing mentioned in the manual is we can read data, including the model number and ID's, this is good as we can use this to test the databus (confirm your findings too)

So lets first look at the read function as we know what it should give us hex value 0x93 and 0x41
in 16 bit mode thats one read of LCD and we should have two reads, one dummy byte and then actual 16 bit data,
e.g
uint16_t dummy=0x0
uint16_t value = 0x9341
and in 8 bit mode it should be
uint8_t ID1 = 0x0
uint8_t ID2 = 0x41
uint8_t ID3 = 0x93

which is three reads

in real code it could be something like this
Code: [Select]

uint8_t readData8()
{
  return *(uint8_t*)DataAccess;
}

uint16_t readData16()
{
  return *(uint16_t*)DataAccess;
}


so there are our code parts for the read data primary function, no we have to add more code to do actual reads

Code: [Select]

uint32_t readID()
{
  return readRegister(0xD3, 0, 3); // 0xd3 is second ID register, 0x04 is first
}

uint32_t readRegister(uint8_t nr, uint8_t index, uint8_t bytes)
{
  uint32_t rv = 0;
  bytes = 4;
 
 writeCommand(nr);
  readData(); // dummy
  for (uint8_t i = 0; i < index; i++)
  {
    readData(); // skip
  }
  for (; bytes > 0; bytes--)
  {
    rv <<= 8;
    rv |= readData();
  }
 endTransaction();
  return rv;
}


so once you have added the above code then in main you add
HAL_UART_write(readID());
and it should print out via serial port (if you have set it up that is, if not you should as its vital part of debug)



darkspr1te
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #54 on: January 08, 2022, 01:34:11 pm »
Before I try that, Platform IO was given another shot. The downloads on Microsoft's web page for Windows don't all work or are behind in revision. Nothing that I download will recognize the path to Arduino.h, Every search is all questions but no answers or people saying it's a bug. Any insight and what version do you have?
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #55 on: January 08, 2022, 02:31:47 pm »
Before I try that, Platform IO was given another shot. The downloads on Microsoft's web page for Windows don't all work or are behind in revision. Nothing that I download will recognize the path to Arduino.h, Every search is all questions but no answers or people saying it's a bug. Any insight and what version do you have?
Can you check you have follwed everything this guide
https://docs.platformio.org/en/latest/integration/ide/vscode.html
normally when vscode says is cant find Arduino.h is means platformio is not installed into vscode.

my vscode version is
Version: 1.63.2 (user setup)
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:40:02.816Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19044

darkspr1te
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #56 on: January 08, 2022, 02:52:00 pm »
Same version, I downloaded VS Code, added Platform IO from the left panel... and still the error. I did uninstall it a few times and reinstalled. The last reinstall was with the Chocolatey package manager, https://chocolatey.org/ still no help. I like Chocolatey because it does official packages as well as version compatibility.
« Last Edit: January 08, 2022, 02:54:33 pm by Quarlo Klobrigney »
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #57 on: January 08, 2022, 03:03:49 pm »
In your platformio.ini file do you have
framework = arduino
or
framework = stmcube ?

 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #58 on: January 08, 2022, 03:18:29 pm »
Using the code you provided waaay back:

[env:genericSTM32F407VET6]
platform = ststm32
board = genericSTM32F407VET6 // black_f407ve
framework = arduino
lib_deps = mbed-hudakz/ILI9341_STM32F4@0.0.0+sha.5c2870105122
upload_protocol = stlink
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #59 on: January 08, 2022, 03:38:06 pm »
Using the code you provided waaay back:

[env:genericSTM32F407VET6]
platform = ststm32
board = genericSTM32F407VET6 // black_f407ve
framework = arduino
lib_deps = mbed-hudakz/ILI9341_STM32F4@0.0.0+sha.5c2870105122
upload_protocol = stlink
can you remove the " //black_f407ve" and try and compile again, it may be interfering with the process as in the ini file only ; is allowed for comments.
another trick to try is a blank arduino project with no other code (using platformio home screen)

darkspr1te
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #60 on: January 08, 2022, 03:49:54 pm »
Still waiting to make a new project as the "default" folder is not where I want it to be. It's stuck on please be patient.
It needs an internet connection to change the project folder. :-- That does not give me confidence that this program is not stealing info. After this test I may make it go away.
« Last Edit: January 08, 2022, 03:51:56 pm by Quarlo Klobrigney »
Voltage does not flow, nor does voltage go.
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #61 on: January 08, 2022, 03:53:58 pm »
It still has the squigglies. It's an ongoing problem.#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit "\Platform IO Projects\src\main.cpp)".

[env:uno]
platform = atmelavr
board = uno
framework = arduino

Code: [Select]
#include <Arduino.h>
int PIN_LIGHT = PIN_A7;      // we define out LED0 here//  LED0/LED1 HIGH/LOW value inverted due to MCU providing drain/GND for led and not source/3.3v
void setup()
{  // put your setup code here, to run once: 
    pinMode(PIN_LIGHT,OUTPUT); 
    digitalWrite(PIN_LIGHT,LOW); // LED comes via 3.3v 
    for (int count=0;count<100;count++) 
{   
    delay(100);
    digitalWrite(PIN_LIGHT,HIGH); // turn off led0   
    delay(100);   
    digitalWrite(PIN_LIGHT,LOW); // turn on led0  }}
    void loop()
{  // put your main code here, to run repeatedly:}
« Last Edit: January 08, 2022, 04:05:16 pm by Quarlo Klobrigney »
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #62 on: January 09, 2022, 05:57:28 pm »
Quote
[env:uno]
platform = atmelavr
board = uno
framework = arduino
your platform is wrong for a start if that is the one you are using, also you wont get plugins like code following and such until you actually install them, the key point is when it's correct does it compile ? the code following is a feature we can chase later but if your platformio.ini is wrong then you will not go much further.
When starting a new project , type the name and then in the BOARD text box type stm32f407ve , scroll until you see genericstm32f407ve and select that, then once in the project click the build icon which is a tick mark in lower left corner , next to it is upload and clean.
my playformio.ini on blank 8mhz chipped 407ve for arduino is as follow's

Code: [Select]
[env:genericSTM32F407VET6]
platform = ststm32
board = genericSTM32F407VET6
framework = arduino


darkspr1te
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #63 on: January 09, 2022, 06:44:49 pm »
It's not wrong, what do you think I already had in #59?
You asked me to try with Arduino.
I did and that was the setup that still failed finding Arduino.h.
Voltage does not flow, nor does voltage go.
 

Offline darkspr1te

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: zm
Re: STM32F407 & ILI9341 FSMC
« Reply #64 on: January 09, 2022, 09:45:59 pm »
then i give up  >:( you seem setup for fail, you wont post a singled bit of data that covers anything apart from a re post.
am out, ive written enough code here.
darkspr1te out
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #65 on: January 09, 2022, 10:26:31 pm »
I don't know what to say. I have done what you have asked. I still don't understand how to run PIO but I do know that Arduino.h has squiggly lines under it because it cannot find the path and I can do nothing to correct the issue.
Voltage does not flow, nor does voltage go.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6912
  • Country: ca
Re: STM32F407 & ILI9341 FSMC
« Reply #66 on: January 09, 2022, 10:58:59 pm »
Is a way in yiur IDE to specify Include and Source paths? Like in Project Properties or something. Try adding a path to where that header resides.

Facebook-free life and Rigol-free shack.
 

Offline Quarlo KlobrigneyTopic starter

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: pt
  • This Space For Rent
Re: STM32F407 & ILI9341 FSMC
« Reply #67 on: January 09, 2022, 11:41:55 pm »
Yes I did I added the whole path with <> and or "" and it still protested.
That's why I did a simple Arduino Blinky and it failed as well.
I do not understand how to open a previous project in Platform IO after it has been already been saved. They show up on the left pane but I cannot just do an "open project"
I saw no easy way for me, but I don't use the program I was trying to accommodate DarkSpr1te if he wanted to program in that platform.
One has to know how to use PIO and I don't have much luck getting the IDE to behave.
Even after uninstalling, and reinstalling it remembered all my settings. Not a good thing. It also wanted to share my project after repeatedly saying no.
Voltage does not flow, nor does voltage go.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6912
  • Country: ca
Re: STM32F407 & ILI9341 FSMC
« Reply #68 on: January 12, 2022, 07:33:37 pm »
It may be another header file that Arduino.h referenced inside that could not be found, I've seen this type of nested errors .
Facebook-free life and Rigol-free shack.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf