cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157F-DK2 pin configuration?

ABoni.1
Associate II

Hi! I'm really new to this world, so I'll appreciate the simplicity of your answers.

I have an STM32MP157F-DK2 at the University and I need to measure a voltage signal and an UART signal. Can I use only the dual Cortex®-A7 32 bits for configuring the board pins? Or do I must use the Cortex®-M4?

Either way, I'm having problems with understanding all this. I have finished reading the instalation wikis, what's the difference between working with the Cortex®-M4 with STM32CubeMP1 installed, and working with the Cortex®-A7 32 bits with the Linux Kernell?

I need to create a GUI that shows the voltage signal an the UART that represents temperature, but I need the pins of the board for detecting those signals.

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

Hi,

in_voltage6_raw correspond to ADCx_INP6

Here is a step by step to acquire ADC1_INP6 on DK2 with ecosystem v4.x

  • Reset the board and press a key within uBoot just after autoboot little pause and select choice '2' (stm32mp157f-dk2-a7-examples). This is to use a device tree which includes some additional ADC inputs of the board0693W00000UnTP9QAN.png
  • Type the grep command below and look at the device number for ADC1 (as per product Reference Manual, 0x48003000 is the base address of ADC1 and ADC2 and ADC1 is @0 and ADC2 is @100). Here ADC1 is iio:device5
root@stm32mp1:~# grep -H "" /sys/bus/iio/devices/*/name | grep adc
/sys/bus/iio/devices/iio:device5/name:48003000.adc:adc@0
/sys/bus/iio/devices/iio:device6/name:48003000.adc:adc@100
  • Confirm the available inputs of ADC1 (linked to chosen device tree according to your board)
root@stm32mp1:~# ls /sys/bus/iio/devices/iio:device5/in*_raw
/sys/bus/iio/devices/iio:device5/in_voltage0_raw
/sys/bus/iio/devices/iio:device5/in_voltage13_raw
/sys/bus/iio/devices/iio:device5/in_voltage18_raw
/sys/bus/iio/devices/iio:device5/in_voltage19_raw
/sys/bus/iio/devices/iio:device5/in_voltage1_raw
/sys/bus/iio/devices/iio:device5/in_voltage6_raw
  • Do the raw acquisition and also get scale and offset data (to convert raw value in mV) :
root@stm32mp1:~# cat /sys/bus/iio/devices/iio:device5/in_voltage6_raw
47065
root@stm32mp1:~# cat /sys/bus/iio/devices/iio:device5/in_voltage_scale
0.038146972
root@stm32mp1:~# cat /sys/bus/iio/devices/iio:device5/in_voltage_offset
0
  • Compute scaled value = (raw + offset) * scale. Here it is (47065+0)*0.038146972 = 1.795V . This result is ok as I connected externally Arduino A5 (ADC1_INP6) to an 1.8V supply.

Regards,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
PatrickF
ST Employee

Hi @Andrés Bonilla​ 

Except if you have very tight real-time constrains, you should probably being able to do what you want by using STM32MP157F-DK2 starter package and Cortex-A7 Linux.

Cortex-M4 is usually required when there is hard real time constrains (e.g. motor control, high input reactivity, etc...).

Some ADC and TTY(UART) trials with Linux command lines are possible

(note that you need to choose '2: stm32mp157f-dk2-a7-examples' during boot to get confirmation listed below) :

see https://wiki.st.com/stm32mpu/wiki/How_to_use_the_IIO_user_space_interface#How_to_do_a_simple_ADC_conversion_using_the_sysfs_interface

Some ADC pins are available with this starter package Device Tree on DK2 board (please also refer to board documentation:(

  • ADC1_INP0 and ADC2_INP0 on pin ANA0 (Arduino connector A2)
  • ADC1_INP1 and ADC2_INP0 on pin ANA1 (Arduino connector A3)
  • ADC1_INP6 on pin PF12 (Arduino connector A5)
  • ADC1_INP13 on pin PC3 (Arduino connector A4)
  • ADC2_INP2 on pin PF13 (Arduino connector A1)
  • ADC2_INP6 on PF14 (Arduino connector A0)

For UART,

See https://wiki.st.com/stm32mpu/wiki/Serial_TTY_overview

  • ttySTM1 is USART3 (RX/TX/RTS/CTS on GPIO connector)
  • ttySTM2 is UART7 (RX/TX on Arduino connector)

Then, you could use them from any application (e.g. in python).

For GUI, I'm not expert, but there is many possible options with Weston Wayland (https://wiki.st.com/stm32mpu/wiki/Wayland_Weston_overview).

Demo is using GTK (https://wiki.st.com/stm32mpu/wiki/GTK_demo_launcher), but there is certainly other options.

Regards

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
ABoni.1
Associate II

Ok, I understand the pin configuration! I appreciate a lot your answer.

Now, once I have those measurements, how can I use that information for the GUI? 

Or even then, how can I run Python on the STM for showing the measurements in a Python implemented GUI, do I need to use the STMcube IDE or SDK?

Or implementing a GUI in Python is not needed and I can jump to Weston Wayland directly for showing those measurements?

Hi,

I'm not expert of application development on Linux. That's a very generic embedded Linux question not really linked to a specific processor.

Maybe not the right place to post this question.

There is many way to do what you expect, but STM32CubeIDE is usually not required (used mostly today only for M4 FW development). Nevertheless, you could refer to this example of debug of user space application https://wiki.st.com/stm32mpu/wiki/How_to_debug_a_user_space_application_with_STM32CubeIDE/User_space_GTK_library_project

Python or C code are languages to build your application, not a GUI.

Wayland is a display framework which could be used by an application to build a GUI based on libraries like: GTK (native on Starter package), Qt, etc....

Here you need to get your own insight to develop your application and the associated GUI.

I guess it is similar issue than on any Linux PC, except that using different display management and that you do cross development on a PC then download the application to the STM32MP1 target filesystem.

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
ABoni.1
Associate II

Hi! I'm trying to do the voltage meausure with this pins

  • ADC1_INP0 and ADC2_INP0 on pin ANA0 (Arduino connector A2)
  • ADC1_INP1 and ADC2_INP0 on pin ANA1 (Arduino connector A3)
  • ADC1_INP6 on pin PF12 (Arduino connector A5)
  • ADC1_INP13 on pin PC3 (Arduino connector A4)
  • ADC2_INP2 on pin PF13 (Arduino connector A1)
  • ADC2_INP6 on PF14 (Arduino connector A0)

But I'm having problems with the terminal configuration. Here: https://wiki.stmicroelectronics.cn/stm32mpu/index.php?title=How_to_use_the_IIO_user_space_interface&diff=prev&oldid=75950 it says that I must use the device matching the ADC peripheral.

How do I know wich device is associated to the pin that I am using for measure the voltage? Because in there it says as an example "in_voltage6_raw", but I don't know wich pin is that.

PatrickF
ST Employee

Hi,

in_voltage6_raw correspond to ADCx_INP6

Here is a step by step to acquire ADC1_INP6 on DK2 with ecosystem v4.x

  • Reset the board and press a key within uBoot just after autoboot little pause and select choice '2' (stm32mp157f-dk2-a7-examples). This is to use a device tree which includes some additional ADC inputs of the board0693W00000UnTP9QAN.png
  • Type the grep command below and look at the device number for ADC1 (as per product Reference Manual, 0x48003000 is the base address of ADC1 and ADC2 and ADC1 is @0 and ADC2 is @100). Here ADC1 is iio:device5
root@stm32mp1:~# grep -H "" /sys/bus/iio/devices/*/name | grep adc
/sys/bus/iio/devices/iio:device5/name:48003000.adc:adc@0
/sys/bus/iio/devices/iio:device6/name:48003000.adc:adc@100
  • Confirm the available inputs of ADC1 (linked to chosen device tree according to your board)
root@stm32mp1:~# ls /sys/bus/iio/devices/iio:device5/in*_raw
/sys/bus/iio/devices/iio:device5/in_voltage0_raw
/sys/bus/iio/devices/iio:device5/in_voltage13_raw
/sys/bus/iio/devices/iio:device5/in_voltage18_raw
/sys/bus/iio/devices/iio:device5/in_voltage19_raw
/sys/bus/iio/devices/iio:device5/in_voltage1_raw
/sys/bus/iio/devices/iio:device5/in_voltage6_raw
  • Do the raw acquisition and also get scale and offset data (to convert raw value in mV) :
root@stm32mp1:~# cat /sys/bus/iio/devices/iio:device5/in_voltage6_raw
47065
root@stm32mp1:~# cat /sys/bus/iio/devices/iio:device5/in_voltage_scale
0.038146972
root@stm32mp1:~# cat /sys/bus/iio/devices/iio:device5/in_voltage_offset
0
  • Compute scaled value = (raw + offset) * scale. Here it is (47065+0)*0.038146972 = 1.795V . This result is ok as I connected externally Arduino A5 (ADC1_INP6) to an 1.8V supply.

Regards,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
ABoni.1
Associate II

Hi! I've been stuying the GUI development for the STM32. If I want to do it with Python, I should develop the code and then import the code and the libraries to the board, right?

While I was investigating I also ran into "Embedded Wizard". Is another a good option for extracting the measure from the pins and displaying in the monitor?