Skip to content

Commit

Permalink
Add doc for STM32 perif configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
trietngh committed Sep 24, 2024
1 parent 587c393 commit 918fe7f
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
- [Installation](elec_soft/stm32cubeide/installation.md)
- [Création d'un nouveau projet](elec_soft/stm32cubeide/new_project.md)
- [Configuration d'un STM32](elec_soft/stm32cubeide/peripheral_config.md)
- [Configuration d'un project](elec_soft/stm32cubeide/project_config.md)
- [Astuce pour le code](elec_soft/stm32cubeide/write_code.md)
- [Compilation et flashage](elec_soft/stm32cubeide/build_and_flash.md)
- [Debug](elec_soft/stm32cubeide/debug.md)
- [STMLIB](elec_soft/stmlib/index.md)
- [Elecsoft Checklist 1o1 😢](elec_soft/elecsoft_checklist.md)
- [⚡ Electronique Matérielle (Elec-hard)](elec_hard/index.md)
Expand Down
Empty file added src/elec_soft/stm32/gpio.md
Empty file.
Empty file added src/elec_soft/stm32/timer.md
Empty file.
10 changes: 10 additions & 0 deletions src/elec_soft/stm32cubeide/build_and_flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Comment builder et flasher ton code sur le STM32

En 2 lignes :
- Build : bouton "Hammer" ou (Ctrl+B)
- Flash (télécharger ton code sur le STM32) : bouton "Play" ou (Ctrl+Shift+B)

![Build and Flash](../../images/elecsoft/stm32cubeide/build_and_flash.png)

**Notes :**
- Le Flash fait aussi le Build si t'as pas encore buildé.
1 change: 1 addition & 0 deletions src/elec_soft/stm32cubeide/debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Comment debug ton STM32 avec STM32CubeIDE
9 changes: 5 additions & 4 deletions src/elec_soft/stm32cubeide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ STM32CubeIDE is a software development environment that enables developers to wo

## Table of Contents
- [Installation](installation.md)
- [Creating a new project](#creating-a-new-project)
- [Building the project](#building-the-project)
- [Debugging the project](#debugging-the-project)
- [Flashing the project](#flashing-the-project)
- [Creating a new project](new_project.md)
- [Configuring a STM32](peripheral_config.md)
- [Configuring your project](project_config.md)
- [Building and flashing the project](#building-the-project)
- [Debugging the project](#debugging-the-project)
5 changes: 4 additions & 1 deletion src/elec_soft/stm32cubeide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
Lien de téléchargement : [STM32CubeIDE](https://www.st.com/en/development-tools/stm32cubeide.html)

## Notes
Vous aurez besoin d'un compte STMicroelectronics pour utiliser le logiciel.
Vous aurez besoin d'un compte STMicroelectronics pour utiliser le logiciel.

## Ensuites
Voir [Création d'un nouveau projet](new_project.md) pour créer un nouveau projet STM32CubeIDE.
5 changes: 4 additions & 1 deletion src/elec_soft/stm32cubeide/new_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Vous arrivez en suite sur la page de configuration du microcontrôleur.

![Microcontroller Configuration](../../images/elecsoft/stm32cubeide/cubeide_configpage.png)

Voir ensuite dans [guide de configuration](../stm32cubeide/peripheral_config.md) pour configurer votre STM32.
## Ensuite
Voir ensuite dans [Configuration d'un STM](peripheral_config.md) pour configurer votre STM32.

Ou dans [Configurer ton project](project_config.md) pour configurer ton project STM32CubeIDE.


75 changes: 74 additions & 1 deletion src/elec_soft/stm32cubeide/peripheral_config.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# Guide pour configurer d'un STM32


Oula, ce sujet est très vaste. On essaie de couvrir le minimale pour avoir une idée, après ça dépend vraiment chaque périphérique.

D'ailleur, si tu ne comprends pas ce que c'est un périphérique, je te conseille de lire [ce document](../stm32/index.md).

## Table des matières
- [Pin](#pin)
- [GPIO](#gpio)
- [Timer](#timer)
- [Clock](#clock)
- [UART](#uart)

## Pin
Un pin est une broche de sortie ou d'entrée. Il peut être relier à un "Entrée/Sortie Général" (GPIO), ou à un périphérique spécifique (Timer, UART, SPI, etc).

***Pour configurer un pin***, cliquez sur le pin dans le schéma de votre microcontrôleur. Vous pouvez choisir entre plusieurs options.

![Pin](../../images/elecsoft/stm32cubeide/perif_pin.png)

Souvent, autre que le GPIO, le pin sera automatiquement assigné à une fonction quand tu configure une périphérique.

***Pour trouver un pin alternative qui peut assure la même fonction***, gardez Ctrl puis cliquez sur le pin. Vous devez voir les pins alternatives clignotent. Cliquez sur un pin pour le choisir.

![Pin alternative](../../images/elecsoft/stm32cubeide/perif_pin_alternative.png)

## GPIO
Pour la théorie des GPIO, voir [ce document](../stm32/gpio.md).

***Pour commencer***

Choisissez le fenêtre de configuration de GPIO ici :
![GPIO](../../images/elecsoft/stm32cubeide/perif_gpio_1.png)

**Quelques configurations indispensables pour un GPIO:**
- Mode: Output Push-Pull, Output Open-Drain, Input, Analog
- Pull-up/Pull-down: seulement pour les modes Input
- User Label: pour identifier le pin

***Exemple**:*

Configurer un GPIO pour un sortie '0' et '1' "normal" :
- Mode: Output Push-Pull
- User Label: `motor_dir`

![GPIO](../../images/elecsoft/stm32cubeide/perif_gpio_2.png)

**Notes:**
Tu peux nommer les pins utilsés par un autre périphérique dans les onglets correspondants (voir image ci-dessus, en haut à gauche).

## Timer

Un Timer peut servir à plusieurs choses :
- Générer des interruptions à intervalles réguliers
- Mesurer le temps (compter)
- Générer des signaux PWM
- Compter des événements externes

Voir [ce document](../stm32/timer.md) pour plus d'informations.

### Pour générer un PWM
![Timer](../../images/elecsoft/stm32cubeide/perif_timer.png)

- Choisir le Clock Source (normalement, c'est le clock interne du microcontrôleur)
- Choisir un channel et asigner le mode PWM Generation CHx pour ce channel (un pin sera automatiquement assigné à ce channel)
- Configurer la fréquence du signal PWM en changant la "Prescaler" et la "Counter Period"

```
pwm_frequency = clock_frequency / [(prescaler+1) * (counter_period+1)]
```


## Clock

## UART
1 change: 1 addition & 0 deletions src/elec_soft/stm32cubeide/project_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Comment configurer ton project STM32CubeIDE
1 change: 1 addition & 0 deletions src/elec_soft/stm32cubeide/write_code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Quelques astuces pour écrire du code dans STM32CubeIDE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/elecsoft/stm32cubeide/perif_gpio_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/elecsoft/stm32cubeide/perif_pin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/elecsoft/stm32cubeide/perif_timer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 918fe7f

Please sign in to comment.