[STM32GENERIC] F746 Discovery

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

[STM32GENERIC] F746 Discovery

Post by ChrisMicro » Mon Jun 05, 2017 5:35 am

Because Daniel enabled the display driver on the Board, I made some examples.

The simple oscilloscope demo has an auto-trigger which gives a fast responsive and stable graphic when sampling for e.g. a sine wave.
The mandelbrot set example is quite nice and the MCU fast the only trade off is the flickering display when calculation the mandelbrot set.
This is due to missing double buffering of the graphics.

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

Re: [STM32GENERIC] F746 Discovery

Post by ChrisMicro » Thu Jun 08, 2017 12:38 pm

How can I access the touch controller of the display.
The data sheet says it is connected to I2C3

I tried to see if the I2C3 is responding with the I2C scanner, but it is not:

Code: Select all

#include <Wire.h>

TwoWire I2Cinterface(I2C3);

#define SERIALINTERFACE Serial

void enableDevices()
{
  //on certain boards the I2C devices have to be enabled first
  // please put here your code to enable the devices
  // e.g. for the STM32F4 Discovery enabling the I2C codec is
  // pinMode(PD4,OUTPUT);
  // digitalWrite(PD4,HIGH);  
}



void setup()
{
  I2Cinterface.begin();
  
  enableDevices();

  SERIALINTERFACE.begin(115200);
  delay(5000);
  SERIALINTERFACE.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  SERIALINTERFACE.println("Scanning...");
  delay(2000);

  nDevices = 0;
  for (address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    I2Cinterface.beginTransmission(address);
    I2Cinterface.write(0);
    error = I2Cinterface.endTransmission();

    if (error == 0)
    {
      SERIALINTERFACE.print("I2C device found at address 0x");
      if (address < 16)  SERIALINTERFACE.print("0");
      SERIALINTERFACE.print(address, HEX);
      SERIALINTERFACE.println("  !");

      nDevices++;

    }
    else if (error == 4)
    {
      SERIALINTERFACE.print("no device found at address 0x");
      if (address < 16) SERIALINTERFACE.print("0");
      SERIALINTERFACE.println(address, HEX);
    }
  }
  if (nDevices == 0)
  {
    SERIALINTERFACE.println("No I2C devices found\n");
    SERIALINTERFACE.println("Did you configure the chip select for your device?\n");
  }
  else
    SERIALINTERFACE.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

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

Re: [STM32GENERIC] F746 Discovery

Post by Pito » Thu Jun 08, 2017 4:22 pm

Did you try this?

Code: Select all

..
  Wire.begin();

  Wire.stm32SetInstance(I2C3);
  Wire.stm32SetSDA(Pxxx);
  Wire.stm32SetSCL(Pyyy);
  ..
Pukao Hats Cleaning Services Ltd.

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

Re: [STM32GENERIC] F746 Discovery

Post by ChrisMicro » Fri Jun 09, 2017 4:08 am

Thank you for that hint.
I tried this one:

Code: Select all

  Wire.begin();
  
  Wire.stm32SetInstance(I2C3);
  Wire.stm32SetSDA(PH8);
  Wire.stm32SetSCL(PH7);
But the scanner gets stuck when calling "Wire.endTransmission".

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

Re: [STM32GENERIC] F746 Discovery

Post by danieleff » Fri Jun 09, 2017 4:27 am

Call Wire.begin(); after setting the pins, not before.

Edit: Actually the constructor also can take pins, so alternatively modify your first version: TwoWire I2Cinterface(I2C3, PH8, PH7);

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

Re: [STM32GENERIC] F746 Discovery

Post by ChrisMicro » Fri Jun 09, 2017 4:40 am

Thanks Daniel,

I just found it myself in parallel. Now the scanner is working with:

Code: Select all

  Wire.stm32SetInstance(I2C3);
  Wire.stm32SetSDA(PH8);
  Wire.stm32SetSCL(PH7);

  Wire.begin();

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

Re: [STM32GENERIC] F746 Discovery

Post by ChrisMicro » Fri Jun 09, 2017 8:08 am

Here you can find the touch example.

We should discuss how to handle the sharing of the I2C3 between the codec and the touch controller.

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

Re: [STM32GENERIC] F746 Discovery

Post by danieleff » Fri Jun 09, 2017 8:32 am

First of all, does this library not work with the touch screen? https://github.com/adafruit/Adafruit_FT6206_Library This is for a slightly different chip.

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

Re: [STM32GENERIC] F746 Discovery

Post by ChrisMicro » Fri Jun 09, 2017 10:16 am

Hmm ... it is a different chip.
It cost me some hours this morning to find out how to use the this other library. The question is: would it be necessary to use Adafruits Lib?
The next question is: Did you also find a library for the codec? Ehernet would be good also ....
What are you working on?

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

Re: [STM32GENERIC] F746 Discovery

Post by danieleff » Fri Jun 09, 2017 3:30 pm

Sorry for your time, the library seems to work

Code: Select all

#include "Wire.h"
#include "Adafruit_FT6206.h" // library manager, search for FT6206

Adafruit_FT6206 touch = Adafruit_FT6206();

void setup() {
    Serial.begin(115200);
    
    Wire.stm32SetInstance(I2C3);
    Wire.stm32SetSDA(PH8);
    Wire.stm32SetSCL(PH7);
    
    touch.begin();
}

void loop() {
  if (touch.touched()) {
    TS_Point p = touch.getPoint();
    Serial.print(p.x);
    Serial.print(" ");
    Serial.println(p.y);
  }
}
The chip is a different version, but the protocol is the same.

However there will be no arduino library for audio chip, or ethernet. Too STM32 specific
Edit: I try to make centralized DMA, and I2S with DMA

Post Reply