STM32F746 Discovery display and Arduino

Are there any Arduino display examples for STM32F746 Discovery. There are not too many examples in general for that board.

Plenty of examples in the LTDC library here: GitHub - fpistm/Arduino_Core_STM32 at LTDC_TS_TEST_1.9.0

I have now two libraries. How should I use yours?
This is in IDE preferences
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

Yours. Is this a normal Arduino library? Installed from a zip-file?

I use the LTDC folder from the LTDC_TS_TEST_1.9.0 core, as a normal Arduino library (copy it into the sketchbook libraries folder).

I studied the examples in the LTDC folder and the code in the library itself, in order to learn how to use the library, and that was more than I needed to get going.

Same for the touch screen (TS folder).

This worked to create a fine audio spectrum analyzer with a waterfall display. Not much to the code!

// waterfall audio spectrum, time increases to the right, frequency to the top
#include <arduinoFFT_f.h>
// single precision float version, 7 ms for 1024 point transform on STM32F746G at 200 MHz
#include "LTDC_F746_Discovery.h"
#include "heat565.h"

LTDC_F746_Discovery tft;

// 480x272 pixel
#define H_RES 480
#define V_RES   272
#define SIGNAL_LENGTH 2048

float real[SIGNAL_LENGTH] = {0}, imag[SIGNAL_LENGTH] = {0};

// 45.45 kHz sample rate
#define SAMPLING_TIME_US      22
#define ANALOG_SIGNAL_INPUT PA0

// define signal area on screen
#define ss_xmin 0
#define ss_xmax 479
#define ss_ymin 11
#define ss_ymax 271

int ss_w = ss_xmax - ss_xmin;
int ss_h = ss_ymax - ss_ymin;
// 45 kHz, 22.5 kHz fmax, 2048 samples, 1024 amplitude bins -> 22 Hz/bin
int fft_bins = ss_ymax-ss_ymin;

arduinoFFT FFT = arduinoFFT(); /* Create FFT object */

void setup()
{
  // The buffer is memory mapped
  // draw on the screen by writing to the buffer -> 261120 bytes!
  uint16_t *buffer = (uint16_t *)malloc(LTDC_F746_ROKOTECH.width * LTDC_F746_ROKOTECH.height);
  tft.begin((uint16_t *)buffer);
  tft.fillScreen( LTDC_BLACK );
  tft.setRotation(1); // horizontal wide screen
  tft.setCursor(0, 2);
  tft.setTextColor(LTDC_GREEN);  //tft.setTextSize(3);
  tft.setTextSize(1);
  tft.print("sample freq: "); tft.print(1000000 / SAMPLING_TIME_US); tft.println(" Hz ");

  analogReadResolution(12);
//  Serial.begin(9600); //debug print output
//  while (!Serial); 
//  Serial.println("Starting");
}


void loop(void)
{
  static int n, line = ss_xmin, printed = 0;
  uint32_t start, time;
  start = micros();
  // record signal
  for (n = 0; n < SIGNAL_LENGTH; n++)
  {
    real[n] = analogRead( ANALOG_SIGNAL_INPUT );
    imag[n] = 0.0;

    while ((time = micros()) - start < SAMPLING_TIME_US); //wait for next sample interval
    start = time;
  }

  // subtract DC offset

  float avg = 0.0;
  for (n = 0; n < SIGNAL_LENGTH; n++) avg += real[n];
  avg = avg / SIGNAL_LENGTH;
  for (n = 0; n < SIGNAL_LENGTH; n++) real[n] -= avg;

  start = micros();
  FFT.Windowing(real, SIGNAL_LENGTH, FFT_WIN_TYP_HAMMING, FFT_FORWARD);  /* Weight data */
  FFT.Compute(real, imag, SIGNAL_LENGTH, FFT_FORWARD); /* Compute FFT */
  FFT.ComplexToMagnitude(real, imag, SIGNAL_LENGTH); /* Compute magnitudes */
  time = micros() - start;
  if (!printed) {
    tft.setCursor(180, 1); tft.println(time);
    printed = 1; //print the first FFT timing value, in usec
    delay(3000);
      //clear spectrum portion of screen
  tft.fillRect(ss_xmin, ss_ymin, ss_w, ss_h, LTDC_BLACK);
  }

  float Amax = -1.0E10, Amin = 1.0E10;
  for (n = 0; n < fft_bins; n++) {
    //linear scaling
    if (real[n] > Amax) Amax = real[n];
    if (real[n] < Amin) Amin = real[n];
  }

  //typical scale factors 0.02 @50% max music volume, 0.6 for noise

  float scaleAmp = (float) 255.0 / (Amax - Amin);
  // clear print area
//  tft.fillRect(0, 0, 471, 10, LTDC_BLACK);
//  tft.setCursor(0, 2);
//  tft.print(Amin, 0); tft.print(" "), tft.print(Amax, 0); tft.print(" scale "); tft.println(scaleAmp, 4);

// fixed scale factor for now, heatmap index
   scaleAmp = 0.03;
// plot vertical axis = frequency, horizontal axis = time

  for (n = 0; n < fft_bins; n++) {
    int val = scaleAmp * (real[n]-Amin);
    if (val > 255) val = 255;
    if (val < 0) val = 0;
    tft.drawPixel(line, fft_bins-n+ss_ymin, heatmap[val]);  //y decreases with spectrum index n
  }
    line++;  //set up for next vertical spectrum
    if (line > ss_xmax) line = ss_xmin;
}

heat565.h (3.31 KB)

OK, thanks. I'll try and see what happens.