[STM32GENERIC] FSMC - SRAM

Discussions about the STM32generic core
danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: [STM32GENERIC] FSMC - SRAM

Post by danieleff » Wed Jul 05, 2017 5:50 pm

In system_stm32xxxx.c there is a weak `preinitVariant()` called just below `SystemInit_ExtMemCtl()` just for that, so that variants can override it.
If DATA_IN_ExtSRAM is not defined, SystemInit_ExtMemCtl() is not even compiled in.

User avatar
Pito
Posts: 1625
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] FSMC - SRAM

Post by Pito » Wed Jul 05, 2017 6:18 pm

I did it:
variant.c

Code: Select all

#include "stm32_build_defines.h"
#include "stm32_def.h"

#define DATA_IN_ExtSRAM
#define ADDSET 0   // 
#define DATAST 1   // 

extern void preinitVariant() {
    //Set heap to external SRAM
    setHeap((unsigned char*)0x68000000, (unsigned char*)(0x68000000 + 512 * 1024));
}

void SystemInit_ExtMemCtl(void) {
  __IO uint32_t tmpreg;
  /* FSMC Bank1 NOR/SRAM3 is used for Blue F103ZET and Black F407ZET  */
	blah blah blah
}

void SystemClock_Config(void) {
    RCC_OscInitTypeDef RCC_OscInitStruct;
    RCC_ClkInitTypeDef RCC_ClkInitStruct;
    RCC_PeriphCLKInitTypeDef PeriphClkInit;

    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
    RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
    ....
So where shall I put my SystemInit_ExtMemCtl(void) {} ?
Inside the preinitVariant() in variant.c ??
PS: I left #define DATA_IN_ExtSRAM in system_stm32xx.c too in my attempt..
Pukao Hats Cleaning Services Ltd.

User avatar
Zingg_JM
Posts: 40
Joined: Tue Jan 17, 2017 10:46 am

Re: [STM32GENERIC] FSMC - SRAM

Post by Zingg_JM » Tue Jul 11, 2017 6:31 am

Zingg_JM wrote:
Mon Jun 05, 2017 5:26 pm
Hi all,

Seems I have found the right topic for the following simple question:

Is there an example how to initialize FSMC for use with 1: SRAM, 2: FSMC TFT connector in an Arduino program or C++ library class?

I have a STMF32F407ZET6 board with a 1MB static ram chip on board (e-paper demo board).
And I have black STM32F407VET6 and STM32F407ZET6 boards with FSMC TFT connector (I use bit-bang so far).

This topic indicates the answer is there somewhere, but you might help me with some links, thank you.

Jean-Marc Zingg
Hi STM32 Friends,

Now I have solved also #2, FSMC TFT connection. I have added FSMC IO classes to my GxTFT Arduino library, for both STM32 packages STM32GENERIC and STM32DUINO.

https://github.com/ZinggJM/GxTFT http://forum.arduino.cc/index.php?topic=488605.0

Jean-Marc
I like clickable and valid links that point to relevant information

stevestrong
Posts: 1811
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [STM32GENERIC] FSMC - SRAM

Post by stevestrong » Tue Jul 11, 2017 8:39 am

Jean-Mark, do you use the libmaple FSMC (viewtopic.php?f=39&t=1976&p=26166#p26166)?

User avatar
Zingg_JM
Posts: 40
Joined: Tue Jan 17, 2017 10:46 am

Re: [STM32GENERIC] FSMC - SRAM

Post by Zingg_JM » Tue Jul 11, 2017 10:06 am

stevestrong wrote:
Tue Jul 11, 2017 8:39 am
Jean-Mark, do you use the libmaple FSMC (viewtopic.php?f=39&t=1976&p=26166#p26166)?
I do not fully understand your question, but try to give some answer.

The board I use is a black STM32F407VET6 from ACELEC:
https://www.aliexpress.com/item/Free-sh ... 22721.html
the links are also in the headings of my library sources.
I have 2 versions:

Code: Select all

// this version is for use with Arduino package STM32GENERIC, board "BLACK F407VE/ZE/ZG boards".
// https://github.com/danieleff/STM32GENERIC
and

Code: Select all

// this version is for use with Arduino package STM32DUINO, board "STM32 Discovery F407".
// https://github.com/rogerclarkmelbourne/Arduino_STM32
I took the HAL startup code from STM32GENERIC as a starting point, adapted for the FSMC TFT connection.

Jean-Marc
I like clickable and valid links that point to relevant information

stevestrong
Posts: 1811
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [STM32GENERIC] FSMC - SRAM

Post by stevestrong » Tue Jul 11, 2017 1:34 pm

Hopefully you will not mix up these two different cores.

I just wanted to point out that for the libmaple core (https://github.com/rogerclarkmelbourne/Arduino_STM32) there is already included FSMC support for LCD.

User avatar
Zingg_JM
Posts: 40
Joined: Tue Jan 17, 2017 10:46 am

Re: [STM32GENERIC] FSMC - SRAM

Post by Zingg_JM » Tue Jul 11, 2017 2:58 pm

stevestrong wrote:
Tue Jul 11, 2017 1:34 pm
Hopefully you will not mix up these two different cores.

I just wanted to point out that for the libmaple core (https://github.com/rogerclarkmelbourne/Arduino_STM32) there is already included FSMC support for LCD.
Great, thanks, my confusion about the different STM32 packages is resolved, mostly.
The packages are in constant evolution, e.g. I just had to revert to an older STM32DUINO package, aka Arduino_STM32 (different names in different places used, not easy for users), because of compilation issues (for F1 as far as I remember).

I add here the link to your library: https://github.com/stevstrong/Adafruit_ ... 6bit_STM32, so others have less of an issue to find out what you are writing about.

I will try your library with my board and display. Do you know of other displays with the same connector and pinout?

Thank you

Jean-Marc
I like clickable and valid links that point to relevant information

stevestrong
Posts: 1811
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [STM32GENERIC] FSMC - SRAM

Post by stevestrong » Tue Jul 11, 2017 3:38 pm

I am not paying attention to connectors to be compatible with controller boards because I don't use Arduino "standard" boards, just using wires to connect my STM32 boards to the LCD boards.

User avatar
Zingg_JM
Posts: 40
Joined: Tue Jan 17, 2017 10:46 am

Re: [STM32GENERIC] FSMC - SRAM

Post by Zingg_JM » Tue Jul 11, 2017 3:46 pm

danieleff wrote:
Wed Jun 07, 2017 5:22 am
Steves version is this I guess: https://github.com/stevstrong/Arduino_S ... ple/fsmc.h
...
Or is it this link that does not work (anymore)?
I like clickable and valid links that point to relevant information

User avatar
Zingg_JM
Posts: 40
Joined: Tue Jan 17, 2017 10:46 am

Re: [STM32GENERIC] FSMC - SRAM

Post by Zingg_JM » Tue Jul 11, 2017 3:53 pm

stevestrong wrote:
Tue Jul 11, 2017 3:38 pm
I am not paying attention to connectors to be compatible with controller boards because I don't use Arduino "standard" boards, just using wires to connect my STM32 boards to the LCD boards.
I have some experience with DuPont wires to parallel interface TFTs. Debugging wiring is harder for me than debugging SW, unless the wiring is straight parallel.

The FSMC TFT connector on the black boards is such a welcome connection; its unfortunate there seems to be just one directly matching TFT.
I like clickable and valid links that point to relevant information

Post Reply