cancel
Showing results for 
Search instead for 
Did you mean: 

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

Sisyphus38
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Sisyphus38
Associate III

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

View solution in original post

6 REPLIES 6
PatrickF
ST Employee

Hello,

maybe this will help : https://community.st.com/s/article/FAQ-STM32MP1-How-to-get-initialized-a-generic-GPIO-to-control-a-LED-with-a-pull-up-pull-down

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.
Paul1
Lead

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

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

Regards

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.

Sisyphus38
Associate III

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

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

Olivier GALLIEN
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.