diff --git a/.gitignore b/.gitignore index 013734d..59758b8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,11 @@ # ---------------------------- firmware/build/ +# ---------------------------- +# CMake cache +# ---------------------------- +__cmake_systeminformation/ + # ---------------------------- # Python # ---------------------------- diff --git a/firmware/app/CMakeLists.txt b/firmware/app/CMakeLists.txt index e69de29..587dfcf 100644 --- a/firmware/app/CMakeLists.txt +++ b/firmware/app/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(OpenParcelBox) + +target_sources(app PRIVATE + src/main.c + src/board.c +) \ No newline at end of file diff --git a/firmware/app/.gitkeep b/firmware/app/app.overlay similarity index 100% rename from firmware/app/.gitkeep rename to firmware/app/app.overlay diff --git a/firmware/app/include/.gitkeep b/firmware/app/include/board.h similarity index 100% rename from firmware/app/include/.gitkeep rename to firmware/app/include/board.h diff --git a/firmware/app/src/.gitkeep b/firmware/app/include/board_config.h similarity index 100% rename from firmware/app/src/.gitkeep rename to firmware/app/include/board_config.h diff --git a/firmware/app/prj.conf b/firmware/app/prj.conf index e69de29..f308594 100644 --- a/firmware/app/prj.conf +++ b/firmware/app/prj.conf @@ -0,0 +1,10 @@ +CONFIG_GPIO=y +CONFIG_I2C=y +CONFIG_PWM=y + +CONFIG_SERIAL=y +CONFIG_CONSOLE=y + +CONFIG_LOG=y +CONFIG_LOG_MODE_IMMEDIATE=y +CONFIG_LOG_DEFAULT_LEVEL=3 \ No newline at end of file diff --git a/firmware/app/src/board.c b/firmware/app/src/board.c new file mode 100644 index 0000000..e69de29 diff --git a/firmware/app/src/main.c b/firmware/app/src/main.c new file mode 100644 index 0000000..e69de29 diff --git a/hardware/BOM.md b/hardware/BOM.md index 1e03944..13ce458 100644 --- a/hardware/BOM.md +++ b/hardware/BOM.md @@ -1,6 +1,8 @@ # Bill Of Materials (BOM) -Cette nomenclature sera complétée progressivement au cours du reverse engineering et du développement matériel. +Cette nomenclature regroupe l'ensemble des composants nécessaires à la réalisation d'OpenParcelBox. + +Les éléments réutilisés de la Boks One sont distingués des nouveaux composants afin de faciliter le reverse engineering et la conception du PCB. --- @@ -14,39 +16,86 @@ Cette nomenclature sera complétée progressivement au cours du reverse engineer # Éléments conservés de la Boks One -| Désignation | Quantité | Statut | -| ------------------------- | -------- | -------------- | -| Clavier d'origine 2 × 6 | 1 | Conservé | -| Mécanisme de verrouillage | 1 | Conservé | -| Batterie d'origine | 1 | À étudier | -| Capteur d'origine | 1 | À caractériser | +| Désignation | Quantité | Statut | +| -------------------------------- | ------------ | --------- | +| Façade | 1 | Conservée | +| Mécanisme de verrouillage KR-S79 | 1 | Conservé | +| Compartiment piles (8 × AAA) | 1 | Conservé | +| Connectique interne | Selon besoin | Conservée | + +--- + +# Clavier + +Le PCB d'origine est remplacé par un nouveau PCB compatible avec la façade d'origine. + +| Désignation | Quantité | Statut | +| --------------------- | -------- | ----------- | +| Boutons poussoirs | 12 | Nouveau PCB | +| Matrice clavier 4 × 3 | 1 | Validée | + +--- + +# NFC + +Le contrôleur NFC est assuré par le nRF52840 intégré au Seeed Studio XIAO. + +| Désignation | Quantité | Statut | +| -------------------------------------- | -------- | ----------- | +| Antenne NFC 13,56 MHz | 1 | À concevoir | +| Réseau d'accord NFC (Matching Network) | 1 | À concevoir | + +--- + +# Commande de la serrure + +L'ouverture de la serrure est réalisée par une impulsion de **+12 V** appliquée sur l'entrée **SIG**. + +| Référence | Désignation | Quantité | Statut | +| -------------------------------------------------------------- | ------------------------ | --------- | -------------- | +| MOSFET P-Channel (Logic Level) ou circuit High-Side équivalent | Commande de l'entrée SIG | 1 | À sélectionner | +| Résistances de polarisation | Selon schéma | À définir | + +--- + +# Signalisation + +Les LEDs CMS du PCB d'origine ne sont pas réutilisables. + +| Désignation | Quantité | Statut | +| ------------------ | -------- | -------------- | +| LED Rouge | 1 | À sélectionner | +| LED Verte | 1 | À sélectionner | +| LED Bleue | 1 | À sélectionner | +| Buzzer actif 3,3 V | 1 | Validé | --- # Alimentation -| Référence | Désignation | Quantité | Statut | -| --------- | -------------------------- | -------- | --------- | -| TBD | Circuit de mesure batterie | 1 | À définir | -| TBD | Protection alimentation | 1 | À définir | +| Référence | Désignation | Quantité | Statut | +| ---------------------------------------- | ------------------- | ----------- | -------------- | +| Buck 12 V → 5 V | Convertisseur DC/DC | 1 | À sélectionner | +| Circuit de mesure de la tension batterie | 1 | À concevoir | +| Protection d'alimentation | 1 | À définir | --- -# Interface de programmation +# Protection électrique -| Référence | Désignation | Quantité | Statut | -| --------- | -------------- | -------- | --------- | -| TBD | Connecteur SWD | 1 | À définir | +| Référence | Désignation | Quantité | Statut | +| --------- | ----------------------------------------- | -------- | -------------- | +| TBD | Protection contre l'inversion de polarité | 1 | À sélectionner | --- # Connectique -| Référence | Désignation | Quantité | Statut | -| --------- | ------------------- | ------------ | --------- | -| TBD | Connecteur clavier | À identifier | À définir | -| TBD | Connecteur verrou | À identifier | À définir | -| TBD | Connecteur batterie | À identifier | À définir | +| Référence | Désignation | Quantité | Statut | +| ------------------- | ----------- | --------- | ------ | +| Connecteur clavier | 1 | À définir | +| Connecteur serrure | 1 | À définir | +| Connecteur batterie | 1 | À définir | --- @@ -58,38 +107,57 @@ Cette nomenclature sera complétée progressivement au cours du reverse engineer --- -# Matériel de développement disponible +# Contraintes matérielles -| Désignation | Statut | -| ------------------------------ | ---------- | -| Seeed Studio XIAO BLE nRF52840 | Disponible | -| Pied à coulisse | Disponible | -| Plaques PCB de prototypage | Disponible | +## Alimentation + +- Alimentation par **8 piles AAA** d'origine. +- La serrure est alimentée directement par le pack de piles. +- Le Seeed Studio XIAO est alimenté par un convertisseur **Buck 12 V → 5 V**. +- Une masse commune est utilisée pour l'ensemble du système. + +## Serrure + +- Alimentation : **8 piles AAA**. +- Ouverture par impulsion de **+12 V** sur l'entrée **SIG**. +- Validation de l'ouverture par le changement d'état du contact **COM/NC**. +- Aucune temporisation fixe n'est utilisée pour confirmer une ouverture. + +## Clavier + +- Matrice **4 × 3**. +- 12 touches. +- Disposition verticale **2 × 6**. +- Nouveau PCB compatible avec la façade d'origine. + +## NFC + +- Utilisation du contrôleur NFC intégré au **nRF52840**. +- Antenne NFC intégrée au PCB. --- -# Informations à collecter lors du reverse engineering +# Informations restant à déterminer ## Priorité haute -* Tension batterie. -* Type de batterie. -* Brochage du clavier. -* Brochage du capteur. -* Brochage du verrou. -* Courant consommé lors de l'ouverture. +- Conception de l'antenne NFC. +- Sélection du composant de commande High-Side (MOSFET ou circuit dédié). +- Choix du convertisseur Buck. +- Choix des LEDs. +- Conception du circuit de mesure batterie. ## Priorité moyenne -* Consommation en veille. -* Courant maximal. -* Type exact du capteur. +- Choix des connecteurs. +- Implantation du PCB. +- Protection ESD. ## Priorité basse -* Références détaillées des composants passifs. -* Compatibilité avec d'autres batteries. -* Optimisations mécaniques éventuelles. +- Optimisation de la consommation. +- Réduction du nombre de composants. +- Compatibilité avec d'autres variantes matérielles. --- @@ -97,8 +165,15 @@ Cette nomenclature sera complétée progressivement au cours du reverse engineer ## V0 -* XIAO BLE nRF52840 retenu. -* Clavier d'origine conservé. -* Mécanisme de verrouillage conservé. -* Façade conservée sans modification. -* Communication Zigbee retenue pour la V1. +- Seeed Studio XIAO BLE nRF52840 retenu. +- Zephyr RTOS retenu. +- Communication Zigbee retenue. +- Façade conservée sans modification. +- Mécanisme de verrouillage KR-S79 conservé. +- Compartiment piles 8 × AAA conservé. +- Validation de l'ouverture par le contact COM/NC. +- Commande de la serrure par impulsion de +12 V sur SIG. +- Clavier redéveloppé sous forme d'une matrice 4 × 3. +- Contrôleur NFC intégré au nRF52840 retenu. +- Buzzer actif retenu. +- Alimentation du XIAO via un convertisseur Buck 12 V → 5 V. \ No newline at end of file diff --git a/tools/bootstrap/bootstrap-sdk.cmd b/tools/bootstrap/bootstrap-sdk.cmd new file mode 100644 index 0000000..43f2e8a --- /dev/null +++ b/tools/bootstrap/bootstrap-sdk.cmd @@ -0,0 +1,5 @@ +@echo off + +call "%USERPROFILE%\Dev\.venv\Scripts\activate.bat" + +west sdk install \ No newline at end of file diff --git a/tools/bootstrap/bootstrap-zephyr.cmd b/tools/bootstrap/bootstrap-zephyr.cmd new file mode 100644 index 0000000..b4d7ec4 --- /dev/null +++ b/tools/bootstrap/bootstrap-zephyr.cmd @@ -0,0 +1,64 @@ +@echo off +setlocal + +echo ========================================== +echo OpenParcelBox - Zephyr Bootstrap +echo ========================================== +echo. + +set DEV=%USERPROFILE%\Dev +set VENV=%DEV%\.venv +set ZEPHYR=%DEV%\zephyrproject + +echo [1/8] Creation du dossier Dev... +if not exist "%DEV%" mkdir "%DEV%" + +echo. +echo [2/8] Creation du Virtual Environment... +if not exist "%VENV%" ( + python -m venv "%VENV%" +) + +call "%VENV%\Scripts\activate.bat" + +echo. +echo [3/8] Mise a jour de pip... +python -m pip install --upgrade pip + +echo. +echo [4/8] Installation de west... +python -m pip install west + +echo. +echo [5/8] Initialisation du workspace Zephyr... +if not exist "%ZEPHYR%" ( + west init --mr v4.4.0 "%ZEPHYR%" +) + +cd /d "%ZEPHYR%" + +echo. +echo [6/8] Telechargement des modules... +west update + +echo. +echo [7/8] Installation des dependances Python... +west packages pip --install + +echo. +echo [8/8] Verification de la toolchain... +west zephyr-export + +echo. +echo ========================================== +echo Bootstrap termine. +echo ========================================== +echo. + +echo Compilation de verification... +west build -p always -b xiao_ble/nrf52840 zephyr\samples\hello_world + +echo. +echo Si la compilation s'est terminee sans erreur, +echo votre environnement est pret. +pause \ No newline at end of file diff --git a/zephyr-env.bat b/zephyr-env.bat new file mode 100644 index 0000000..f4f0c13 --- /dev/null +++ b/zephyr-env.bat @@ -0,0 +1,8 @@ +@echo off + +call "%USERPROFILE%\Dev\.venv\Scripts\activate.bat" + +set ZEPHYR_BASE=%USERPROFILE%\dev\zephyrproject\zephyr +set ZEPHYR_SDK_INSTALL_DIR=%USERPROFILE%\dev\zephyr-sdk-1.0.1 + +cmd \ No newline at end of file