Skip to main content
Visitor II
November 9, 2020
Solved

How to Drive LED on the STM32MP157C-Dk2 by STLinux Shell ?

  • November 9, 2020
  • 3 replies
  • 2612 views

Hello,

I am completely newby on embedded linux stuffs.

Can any one tell me how to drive any available LED on the STM32MP157C-Dk2 board by using the linux shell commands.

Unfortunatelly i did not find the information on the wiki stm32mcu.

Thank you by advance.

    This topic has been closed for replies.
    Best answer by Sisyphus38

    Hello,

    https://github.com/brgl/libgpiod/blob/master/README

    A "new" libgpiod library is installed in the stlinux kernel. ( Apparently Sysfs is deprecated).

    In my case of the STM32MP157C-Dk2 the lib woks well. example

    -"gpiodetect" gives all available GPIOx ports

    -"gpioinfo gpiochip7" gives all pins and the config states

    -"gpioset gpiochip7 7=1" makes the LED7 Orange ON.

    - "gpioget gpiochip0 14" gives the state of the user button USER1.

    Regards

    3 replies

    Technical Moderator
    November 9, 2020
    Visitor II
    November 9, 2020

    Hello Patrick,

    Thank you for your answer.

    This sounds like developping driver module on linux.

    I hoped that some leds where already available for driving from the stlinux shell on this STM32MP157C-Dk2 plateforme.

    Now, lets take this readings !

    Regards.

    Visitor II
    November 9, 2020

    STM32 Education = https://www.st.com/content/st_com/en/support/learning/stm32-education.html Many Sections & Styles

    ST Getting Started = https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:STM32_step_by_step_overview

    ST Development Zone = https://wiki.st.com/stm32mcu/wiki/Development_zone

    I recommend the set of tutorials under education for the STM32 series you have selected (F4, L4, H7...), they seem to be a bit more complete than the others.

    You will see many references to examples in this path, but I found those to mostly be pre-STM32CubeMX

    • C:\Users\<user>\STM32Cube\Repository

    Paul

    Visitor II
    November 9, 2020

    Thank you Paul for this usefull informations. I dive into them.

    Regards

    Sisyphus38AuthorAnswer
    Visitor II
    November 9, 2020

    Hello,

    https://github.com/brgl/libgpiod/blob/master/README

    A "new" libgpiod library is installed in the stlinux kernel. ( Apparently Sysfs is deprecated).

    In my case of the STM32MP157C-Dk2 the lib woks well. example

    -"gpiodetect" gives all available GPIOx ports

    -"gpioinfo gpiochip7" gives all pins and the config states

    -"gpioset gpiochip7 7=1" makes the LED7 Orange ON.

    - "gpioget gpiochip0 14" gives the state of the user button USER1.

    Regards

    Technical Moderator
    November 12, 2020

    Hi @Sisyphus38​ ,

    I confirm your finding.

    You may have find all information in wiki page https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace

    And in an already provided exemple in /usr/local/Linux-A7-examples/GPIO/leds on your target.

    Olivier