STM32GENERIC, my arduino implementation

Discussions about the STM32generic core
ChrisMicro
Posts: 308
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: STM32GENERIC, my arduino implementation

Post by ChrisMicro » Mon May 15, 2017 7:07 am

Here is the basic SD-card-wav-player example.
I tried to keep it as simple as possible.

If you have a BlackF407VE and a I2S DAC you can try it.

ChrisMicro
Posts: 308
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: STM32GENERIC, my arduino implementation

Post by ChrisMicro » Mon May 15, 2017 4:55 pm

I just tried to connect an ILI9341 display to the BlackF407VE importing the ILI9351 Lib from Adafruit.
When I use the software SPI with the following setup, the display works with the following settings:

Code: Select all

#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

#define TFT_MOSI PB5
#define TFT_MISO PB4
#define TFT_CLK PB3
#define TFT_RST PA6
#define TFT_DC PA5
#define TFT_CS PA4

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
Very good :D

But now I try to use the hardware SPI.

I could measure the signals of the SPI interface. They are there.
But I couldn't find any pin definition for TFT_RST which seems to be usually provided by an Arduino UNO :?:

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: STM32GENERIC, my arduino implementation

Post by danieleff » Mon May 15, 2017 5:59 pm

I regret putting SDIODirListWriteRead into the board examples.
Please treat it as if it was in the hardware test for developers folder. (I only do not move there now as Victor will create a pull request for it)

TFT_RST is whatever pin you want to use. Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); should work

By the way... I STILL am torn between using PA5/6/7 OR PB3/4/5 for SPI as default on Black F407 boards. PB4 has the problem of not being broken out on the headers, PB3 conflicting with jtag-SWO, and PAx is the default SPI1 in CubeMX, not PBx.

ChrisMicro
Posts: 308
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: STM32GENERIC, my arduino implementation

Post by ChrisMicro » Thu May 18, 2017 3:34 pm

TFT_RST is whatever pin you want to use. Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); should work
Thanks, that worked.
By the way... I STILL am torn between using PA5/6/7 OR PB3/4/5 for SPI as default on Black F407 boards. PB4 has the problem of not being broken out on the headers, PB3 conflicting with jtag-SWO, and PAx is the default SPI1 in CubeMX, not PBx.
Yes, the decision seems not to be easy.
Probably we a list of mandatory Arduino interfaces would be useful:

- SPI ==> mandatory
- I2S ==> mandatory
- JTAG ==> use SWDIO debug interface

Because I have now the compiler for the STM32F7 Discovery, I tried the whestone benchmark

STM32GENERIC-CORE
Loops: 1000, Iterations: 1, Duration: 2135 ms.
C Converted Single Precision Whetstones: 46.84 MIPS

STM-Core
Loops: 1000, Iterations: 1, Duration: 7740 ms.
C Converted Single Precision Whetstones: 12.92 MIPS

Both are to slow, because the STM32F4 Discovery has:

Loops: 1000, Iterations: 1, Duration: 917 ms.
C Converted Single Precision Whetstones: 109.05 MIPS

ag123
Posts: 798
Joined: Thu Jul 21, 2016 4:24 pm

Re: STM32GENERIC, my arduino implementation

Post by ag123 » Sat May 20, 2017 7:18 am

for the whetstone benchmark
try to enable the fpu, i'm not sure if that works for the f7 though :)
http://www.stm32duino.com/viewtopic.php ... 140#p26666
http://www.stm32duino.com/viewtopic.php ... 130#p26638
http://infocenter.arm.com/help/topic/co ... BJHIG.html

Code: Select all

//enable the fpu (cortex-m4 - stm32f4* and above)
void enablefpu()
{
  __asm volatile
  (
    "  ldr.w r0, =0xE000ED88    \n"  /* The FPU enable bits are in the CPACR. */
    "  ldr r1, [r0]             \n"  /* read CAPCR */
    "  orr r1, r1, #( 0xf << 20 )\n" /* Set bits 20-23 to enable CP10 and CP11 coprocessors */
    "  str r1, [r0]              \n" /* Write back the modified value to the CPACR */
    "  dsb                       \n" /* wait for store to complete */
    "  isb"                          /* reset pipeline now the FPU is enabled */

  );
}
update your benchmark in the dhrystone and whetstone thread as well :D
http://www.stm32duino.com/viewtopic.php ... &start=160

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: STM32GENERIC, my arduino implementation

Post by michael_l » Sat May 20, 2017 1:53 pm

I just received small F407VET6 board that has 25Mhz ceramic resonator. Do we have a board variant for this already ? I can try to create one if not. But someone else can decide about the name. Blue4Pill ? :-)

Size is quite nice as it is only two times the size of F103 BluePill.

http://i.imgur.com/epCBlkY.jpg

viewtopic.php?f=39&t=1977&p=28309#p28309

acronis
Posts: 143
Joined: Thu Mar 02, 2017 12:32 pm

Re: STM32GENERIC, my arduino implementation

Post by acronis » Tue Jun 13, 2017 7:50 am

Hello.
I see that added support for the FSMC.
Saw an example, but there is no text output to the display.
Can you tell how to output a simple string on the display ?

ChrisMicro
Posts: 308
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: STM32GENERIC, my arduino implementation

Post by ChrisMicro » Tue Jun 13, 2017 8:45 am

Do you want to tell which board and which type of display? There are several.

acronis
Posts: 143
Joined: Thu Mar 02, 2017 12:32 pm

Re: STM32GENERIC, my arduino implementation

Post by acronis » Tue Jun 13, 2017 1:46 pm

3.2 inch TFT LCD screen with resistive touch screens ILI9341 display module
especially for black Board STM32F407VET6
https://ru.aliexpress.com/item/3-2-inch ... Title=true

ChrisMicro
Posts: 308
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: STM32GENERIC, my arduino implementation

Post by ChrisMicro » Tue Jun 13, 2017 5:53 pm

You can simple use the template in the examples folder.

In the IDE
File -> Examples -> STM32 board examples for users -> Black407VE

Post Reply