deploy: 7d2c80574a
This commit is contained in:
1 parent
ece96b9b02
commit
76094a5056
56 files changed
+620358
-1141
No files matched your search
@@ -1,8 +0,0 @@
|
||||
Hardware
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
hw_description
|
||||
@@ -1,108 +0,0 @@
|
||||
# Hardware Description
|
||||
|
||||
## Overview
|
||||
|
||||

|
||||
|
||||
The above block diagram gives a general overview regarding the operation of components. For better illustration it has been divided into four functional blocks. Furthermore these functional blocks can be subdivided and will be explained below.
|
||||
|
||||
* Input Stage
|
||||
- DCC Signal Level Shift
|
||||
- Bridge Rectifier & Voltage Regulator
|
||||
* Motor Driver
|
||||
- Motor Driver
|
||||
- Back EMF measurement (ADC)
|
||||
* General Purpose
|
||||
- GPIO
|
||||
- Auxillary output
|
||||
* Microcontroller
|
||||
- Flash memory
|
||||
- Crystal oscillator
|
||||
|
||||
## Characteristics
|
||||
|
||||
|
||||
| Parameter | Symbol | Minimum | Maximum | Unit |
|
||||
| ----------------------------------------------------- | -------------- | ------- | -------- | ---- |
|
||||
| Absolute max. DCC Input Voltage | V<sub>DCC</sub> | -25 | +25 | V |
|
||||
| Absolute max. GPIO Voltage<sup>(0)</sup> | V<sub>PIN</sub> | -0.5 | 3.3+0.5 | V |
|
||||
| Input Voltage High<sup>(0)</sup> | V<sub>IH</sub> | 2.145 | 3.6 | V |
|
||||
| Input Voltage Low<sup>(0)</sup> | V<sub>IL</sub> | 0 | 1.155 | V |
|
||||
| Total GPIO Current<sup>(0)</sup> | I<sub>IOVDD_MAX</sub>| | 50 | mA |
|
||||
| Absolute max. motor output current<sup>(1)</sup> | I<sub>MOTOR</sub> | | 2.8 | A |
|
||||
| Absolute max. auxillary output current<sup>(2)</sup> | I<sub>AUX</sub> | | 400 | mA |
|
||||
|
||||
(0): According to: [RP2040 Datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) (assuming V<sub>DD</sub> = 3.3V)
|
||||
|
||||
(1): According to: [BDR6133 Datasheet](https://datasheet.lcsc.com/lcsc/2101211904_Bardeen-Micro--BDR6133_C2687793.pdf)
|
||||
|
||||
(2): According to: [T2N7002BK Datasheet](https://datasheet.lcsc.com/lcsc/1810271831_TOSHIBA-T2N7002BK-LM_C146372.pdf)
|
||||
|
||||
## Input Stage
|
||||
|
||||

|
||||
|
||||
D1 Rectifies the DCC square-wave into +V, the amplitude is not critical as long as its within the 25V limit. The rectified voltage +V is then provided to the 3.3V voltage regulator (U1) and to the motor driver (U2).
|
||||
|
||||
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V<sub>GS</sub> > V<sub>GS,th</sub>), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V<sub>GS</sub> doesnt exceed ±20V.
|
||||
|
||||
## Motor Driver
|
||||
|
||||

|
||||
|
||||
The Motor Driver is a complete H-Bridge IC specifically made for DC-Motors.
|
||||
|
||||
In order to control the motor, it is necessary to measure the back-EMF. This is done by the ADC which measures at Points ADC_EMF_A and ADC_EMF_B respectively. The two resistors are used as a voltage divider.
|
||||
|
||||
## Auxillary Output
|
||||
|
||||

|
||||
|
||||
Switching of loads up to a maximum of about ~400mA can be done using four N-Channel MOSFETS. They are switching on the low-side which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
|
||||
|
||||
## GPIO
|
||||
|
||||
To switch lighter loads six soldering pads on the back side of the PCB are connected to GPIO0 - GPIO5 pins . Although not implemented yet they could theoretically be used as inputs as well (e.g. Reed switch).
|
||||
|
||||
## Microcontroller
|
||||
|
||||

|
||||
|
||||
The Microcontroller needs a crystal oscillator to function properly. External flash memory is also needed as it holds the configuration variables and the program itself. R3 & C14 are used to filter ADC_AVDD (ADC Reference Voltage).
|
||||
|
||||
|
||||
|
||||
## Complete Schematic
|
||||
|
||||

|
||||
|
||||
BOM & Alternative Parts
|
||||
--------------------------
|
||||
|
||||
| Ref | Quantity | Value | Component Type | Component Name | Footprint |
|
||||
| ----------------------------------------------------- | -------------- | ------- | -------- | ---- |---- |
|
||||
| C1, C2, C5, C6, C14 | 5 | 10u | Ceramic Capacitor | / | 0603_1608Metric |
|
||||
| C3, C4, C7, C8, C9, C10, C11, C12, C13, C15 | 10 | 100n | Ceramic Capacitor | / | 0603_1608Metric |
|
||||
| C16, C17 | 2 | 33p | Ceramic Capacitor | / | 0603_1608Metric |
|
||||
| D1 | 1 | V<sub>RMS</sub> = 40V , I<sub>F</sub> = 2A | Bridge Rectifier | KMB24F | MBS (TO-269AA) |
|
||||
| Q1, Q2, Q3, Q4, Q5 | 5 | V<sub>DS</sub> = 60V , I<sub>D</sub> = 0.4A | N-Channel MOSFET |T2N7002BK | SOT-23 |
|
||||
| R1, R2, R5, R6 | 4 | 6k8 | Resistor | / | 0603_1608Metric |
|
||||
| R3 | 1 | 200 | Resistor | / | 0603_1608Metric |
|
||||
| R7, R8, R9 | 3 | 1k | Resistor | / | 0603_1608Metric |
|
||||
| U1 | 1 | V<sub>OUT</sub> = 3.3V | Low Dropout Voltage Regulator | HT7533S | SOT-23 |
|
||||
| U2 | 1 | I = 2.8A | H-Bridge driver | BDR6133 | SOIC-8 |
|
||||
| U3 | 1 | 64Mb | Serial Flash Memory | W25Q64JVSSIQ | SOIC-8 |
|
||||
| U4 | 1 | / | Raspberry Pi RP2040 Microcontroller | RP2040 | QFN-56-1EP_7x7mm_P0.4mm |
|
||||
| Y1 | 1 | f = 12MHz | Crystal Oscillator | X322512MSB4SI | Crystal_SMD_3225-4Pin_3.2x2.5mm |
|
||||
|
||||
NOTE: Keep capacitor V<sub>max</sub> in mind!
|
||||
|
||||
Alternatives for BDR6133:
|
||||
|
||||
[PT5126A-S-TP](https://lcsc.com/product-detail/Motor-Driver-ICs_PTC-Princeton-Tech-PT5126A-S-TP_C162093.html)
|
||||
|
||||
[PT2476](https://lcsc.com/product-detail/Motor-Driver-ICs_PTC-Princeton-Tech-PT2476_C481903.html)
|
||||
|
||||
Alternative for HT7533S:
|
||||
|
||||
[GS7533-33TR3](https://www.lcsc.com/product-detail/Linear-Voltage-Regulators-LDO_Gainsil-GS7533-33TR3_C7427372.html)
|
||||
@@ -0,0 +1,18 @@
|
||||
Hardware
|
||||
======================
|
||||
|
||||
Revision 1.0
|
||||
------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
rev_1_0/hw_description
|
||||
|
||||
Revision 0.3
|
||||
------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
rev_0_3/hw_description
|
||||
+69
-46
@@ -1,36 +1,35 @@
|
||||
Hardware Description
|
||||
Overview
|
||||
====================
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
.. image:: https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Block_Diagram.svg
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/Block_Diagram_Hardware.svg
|
||||
:alt: Block Diagram
|
||||
|
||||
Harware block diagram
|
||||
|
||||
The above block diagram gives a general overview regarding the operation of components. For better illustration it has been divided into four functional blocks. Furthermore, these functional blocks can be subdivided and will be explained below.
|
||||
|
||||
* **Input Stage**
|
||||
- DCC Signal Level Shift
|
||||
- Bridge Rectifier & Voltage Regulator
|
||||
* **Motor Driver**
|
||||
- Motor Driver
|
||||
- Back EMF measurement (ADC)
|
||||
* **General Purpose**
|
||||
- GPIO
|
||||
- Auxiliary output
|
||||
* **Microcontroller**
|
||||
- Flash memory
|
||||
- Crystal oscillator
|
||||
- **Input Stage**
|
||||
- DCC Signal Level Shift
|
||||
- Bridge Rectifier & Voltage Regulator
|
||||
- **Motor Driver**
|
||||
- Motor Driver
|
||||
- Back EMF measurement (ADC)
|
||||
- **General Purpose**
|
||||
- GPIO
|
||||
- Auxiliary output
|
||||
- **Microcontroller**
|
||||
- Flash memory
|
||||
- Crystal oscillator
|
||||
|
||||
Characteristics
|
||||
---------------
|
||||
.. table:: Characteristics table
|
||||
Electrical Characteristics
|
||||
====================
|
||||
.. table:: Electrical Characteristics & Absolute Maximum Ratings
|
||||
:widths: auto
|
||||
|
||||
===================================================== ============================= ========= ========= =====
|
||||
Parameter Symbol Minimum Maximum Unit
|
||||
===================================================== ============================= ========= ========= =====
|
||||
Absolute max. DCC Input Voltage V\ :sub:`DCC`\ -25 +25 V
|
||||
Absolute max. DCC Input Voltage difference V\ :sub:`DCC`\ +24 V
|
||||
Absolute max. GPIO Voltage\ :sup:`(0)`\ V\ :sub:`PIN`\ -0.5 3.3+0.5 V
|
||||
Input Voltage High\ :sup:`(0)`\ V\ :sub:`IH`\ 2.145 3.6 V
|
||||
Input Voltage Low\ :sup:`(0)`\ V\ :sub:`IL`\ 0 1.155 V
|
||||
@@ -42,60 +41,69 @@ Characteristics
|
||||
|
||||
(0): According to: `RP2040 Datasheet <https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf>`_ (assuming V\ :sub:`DD`\ = 3.3V)
|
||||
|
||||
(1): According to: `BDR6133 Datasheet <https://datasheet.lcsc.com/lcsc/2101211904_Bardeen-Micro--BDR6133_C2687793.pdf>`_
|
||||
(1): According to: `BDR6133 Datasheet <https://www.lcsc.com/datasheet/lcsc_datasheet_2409291808_Bardeen-Micro--BDR6133_C2687793.pdf>`_
|
||||
|
||||
(2): According to: `T2N7002BK Datasheet <https://datasheet.lcsc.com/lcsc/1810271831_TOSHIBA-T2N7002BK-LM_C146372.pdf>`_
|
||||
(2): According to: `T2N7002BK Datasheet <https://toshiba.semicon-storage.com/info/T2N7002BK_datasheet_en_20191025.pdf?did=30376&prodName=T2N7002BK>`_
|
||||
|
||||
Input Stage
|
||||
-----------
|
||||
====================
|
||||
|
||||
.. image:: https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Input_Stage.svg
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/Input_Stage.svg
|
||||
:alt: Input Stage
|
||||
|
||||
Input stage
|
||||
|
||||
D1 Rectifies the DCC square-wave into +V, the amplitude is not critical as long as it's within the 25V limit. The rectified voltage +V is then provided to the 3.3V voltage regulator (U1) and to the motor driver (U2).
|
||||
|
||||
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V<sub>GS</sub> > V<sub>GS,th</sub>), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V<sub>GS</sub> doesn't exceed ±20V.
|
||||
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V\ :sub:`GS`\ > V\ :sub:`GS,th`\), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V\ :sub:`GS`\ doesn't exceed ±20V.
|
||||
|
||||
Motor Driver
|
||||
------------
|
||||
====================
|
||||
|
||||
.. image:: https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Motor_Driver.svg
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/Motor_Driver.svg
|
||||
:alt: Motor Driver
|
||||
|
||||
The Motor Driver is a complete H-Bridge IC specifically made for DC-Motors.
|
||||
Motor driver
|
||||
|
||||
In order to control the motor, it is necessary to measure the back-EMF. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B respectively. The two resistors are used as a voltage divider.
|
||||
The Motor Driver is a special H-Bridge IC that is made for DC motors. To control the motor, it is necessary to measure the back-EMF voltage, which is directly related to the motor's speed. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B. The two resistors work together as a voltage divider.
|
||||
|
||||
Auxiliary Output
|
||||
----------------
|
||||
Auxiliary Outputs
|
||||
====================
|
||||
|
||||
.. image:: https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Aux_Outputs.svg
|
||||
:alt: Auxiliary Output
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/Aux_Outputs.svg
|
||||
:alt: Auxiliary Outputs
|
||||
|
||||
Auxiliary Outputs
|
||||
|
||||
Switching of loads can be done using four N-Channel MOSFETs (Q2 to Q5). The amount of current is somewhat dependend on either static R\ :sub:`DS(on)`\ losses and/or switching losses using PWM. They are switching on the low-side, which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
|
||||
|
||||
Switching of loads up to a maximum of about ~400mA can be done using four N-Channel MOSFETs. They are switching on the low-side, which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
|
||||
|
||||
GPIO
|
||||
-----
|
||||
====================
|
||||
|
||||
To switch lighter loads, six GPIO soldering pads are connected to GPIO0 to GPIO5 pins. Although not yet set up in the software, they could be used as inputs as well (e.g. reed switch). GPIO0 and GPIO1 can also be used to facilitate stdio logging via UART, which can easily be set up in CMakeLists.txt.
|
||||
|
||||
To switch lighter loads, six soldering pads on the back side of the PCB are connected to GPIO0 - GPIO5 pins. Although not implemented yet, they could theoretically be used as inputs as well (e.g., Reed switch).
|
||||
|
||||
Microcontroller
|
||||
---------------
|
||||
====================
|
||||
|
||||
.. image:: https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Microcontroller.svg
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/Microcontroller.svg
|
||||
:alt: Microcontroller
|
||||
|
||||
The Microcontroller needs a crystal oscillator to function properly. External flash memory is also needed as it holds the configuration variables and the program itself. R3 & C14 are used to filter ADC_AVDD (ADC Reference Voltage).
|
||||
Microcontroller, flash memory, crystal oscillator, ...
|
||||
|
||||
The Microcontroller needs a crystal oscillator for its clock. External flash memory holds the configuration variables and the program itself. R3 & C14 are used to filter ADC_AVDD (ADC Reference Voltage).
|
||||
|
||||
Complete Schematic
|
||||
------------------
|
||||
====================
|
||||
|
||||
.. image:: https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/RP2040-Decoder.svg
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/RP2040-Decoder.svg
|
||||
:alt: Complete Schematic
|
||||
|
||||
|
||||
Complete Schematic
|
||||
|
||||
BOM & Alternative Parts
|
||||
------------------------
|
||||
====================
|
||||
.. table:: BOM
|
||||
:widths: auto
|
||||
|
||||
@@ -122,12 +130,27 @@ BOM & Alternative Parts
|
||||
NOTE: Keep capacitor V\ :sub:`max`\ in mind!
|
||||
|
||||
Alternatives for BDR6133:
|
||||
--------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* `PT5126A-S-TP <https://lcsc.com/product-detail/Motor-Driver-ICs_PTC-Princeton-Tech-PT5126A-S-TP_C162093.html>`_
|
||||
* `PT2476 <https://lcsc.com/product-detail/Motor-Driver-ICs_PTC-Princeton-Tech-PT2476_C481903.html>`_
|
||||
|
||||
Alternative for HT7533S:
|
||||
------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* `GS7533-33TR3 <https://www.lcsc.com/product-detail/Linear-Voltage-Regulators-LDO_Gainsil-GS7533-33TR3_C7427372.html>`_
|
||||
|
||||
|
||||
.. _wiring_rev_0_3:
|
||||
Wiring the Decoder
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_0_3/Wiring_diagram.svg
|
||||
:width: 700
|
||||
:alt: Wiring Diagram
|
||||
|
||||
Wiring Diagram
|
||||
|
||||
The illustration above provides an example of a wiring configuration.
|
||||
It supports the connection of up to 4 transistor-switched outputs and 6 GPIOs for lighter loads or custom applications.
|
||||
When switching inductive loads, always include a free-wheeling diode to protect the circuit.
|
||||
@@ -0,0 +1,156 @@
|
||||
Overview
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/Block_Diagram_Hardware.svg
|
||||
:alt: Block Diagram
|
||||
|
||||
Harware block diagram
|
||||
|
||||
The above block diagram gives a general overview regarding the operation of components. For better illustration it has been divided into four functional blocks. Furthermore, these functional blocks can be subdivided and will be explained below.
|
||||
|
||||
- **Input Stage**
|
||||
- DCC Signal Level Shift
|
||||
- Bridge Rectifier & Voltage Regulator
|
||||
- **Motor Driver**
|
||||
- Motor Driver
|
||||
- Back EMF measurement (ADC)
|
||||
- **General Purpose**
|
||||
- GPIO
|
||||
- Auxiliary output
|
||||
- **Microcontroller**
|
||||
- Flash memory
|
||||
- Crystal oscillator
|
||||
- USB Connector
|
||||
|
||||
Electrical Characteristics
|
||||
====================
|
||||
.. table:: Electrical Characteristics & Absolute Maximum Ratings
|
||||
:widths: auto
|
||||
|
||||
======================================================== ============================= ========= ========= =====
|
||||
Parameter Symbol Minimum Maximum Unit
|
||||
======================================================== ============================= ========= ========= =====
|
||||
Absolute max. DCC input voltage difference V\ :sub:`DCC`\ +24 V
|
||||
Absolute max. GPIO voltage\ :sup:`(0)`\ V\ :sub:`PIN`\ -0.5 3.3+0.5 V
|
||||
Input voltage high\ :sup:`(0)`\ V\ :sub:`IH`\ 2.145 3.6 V
|
||||
Input voltage low\ :sup:`(0)`\ V\ :sub:`IL`\ 0 1.155 V
|
||||
Total GPIO Current\ :sup:`(0)`\ I\ :sub:`IOVDD`\ 50 mA
|
||||
Absolute max. motor output current\ :sup:`(1)`\ I\ :sub:`MOTOR`\ 2.8 A
|
||||
Absolute max. auxiliary output current \ :sup:`(2)(3)`\ I\ :sub:`AUX`\ 1.4 A
|
||||
======================================================== ============================= ========= ========= =====
|
||||
|
||||
|
||||
(0): According to: `RP2040 Datasheet <https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf>`_ (assuming V\ :sub:`DD`\ = 3.3V)
|
||||
|
||||
(1): According to: `BDR6133 Datasheet <https://www.lcsc.com/datasheet/lcsc_datasheet_2409291808_Bardeen-Micro--BDR6133_C2687793.pdf>`_
|
||||
|
||||
(2): According to: `Si1308EDL Datasheet <https://www.vishay.com/docs/63399/si1308edl.pdf>`_
|
||||
|
||||
(3): T\ :sub:`Case`\ = 25°C, keep power dissipation, thermal resistance the corresponding temperature rise ΔT and switching losses in PWM mode in mind!
|
||||
|
||||
Input Stage
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/Input_Stage.svg
|
||||
:alt: Input Stage
|
||||
|
||||
Input stage
|
||||
|
||||
D2 Rectifies the DCC square-wave into VDC, the amplitude is not critical as long as it's within the 25V limit. The rectified voltage VDC is then provided to the 3.3V voltage regulator and to the motor driver. The shottky diode D1 and the bridge rectifier D2 ensure a logical "or" linkage of the VBUS supply voltages and the DCC input voltage
|
||||
|
||||
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V\ :sub:`GS`\ > V\ :sub:`GS,th`\), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V\ :sub:`GS`\ doesn't exceed ±12V.
|
||||
Motor Driver
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/Motor_Driver.svg
|
||||
:alt: Motor Driver
|
||||
|
||||
Motor driver
|
||||
|
||||
The Motor Driver is a special H-Bridge IC that is made for DC motors. To control the motor, it is necessary to measure the back-EMF voltage, which is directly related to the motor's speed. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B. The two resistors work together as a voltage divider.
|
||||
|
||||
Auxiliary Outputs
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/Aux_Outputs.svg
|
||||
:alt: Auxiliary Outputs
|
||||
|
||||
Auxiliary Outputs
|
||||
|
||||
Switching of loads can be done using four N-Channel MOSFETs (Q2 to Q5). The amount of current is somewhat dependend on either static R\ :sub:`DS(on)`\ losses and/or switching losses using PWM. They are switching on the low-side, which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
|
||||
|
||||
GPIO
|
||||
====================
|
||||
|
||||
To switch lighter loads, six GPIO soldering pads are connected to GPIO0 to GPIO5 pins. Although not yet set up in the software, they could be used as inputs as well (e.g. reed switch). GPIO0 and GPIO1 can also be used to facilitate stdio logging via UART, which can easily be set up in CMakeLists.txt.
|
||||
|
||||
Microcontroller
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/Microcontroller.svg
|
||||
:alt: Microcontroller
|
||||
|
||||
Microcontroller, flash memory, crystal oscillator, USB connector, ...
|
||||
|
||||
The Microcontroller needs a crystal oscillator for its clock. External flash memory holds the configuration variables and the program itself. The USB connector can be used to flash the software onto the decoder and also for logging via stdio (can be enabled via CMakeLists.txt). D3 is used as a status LED. R11 & C13 are used to filter ADC_AVDD (ADC Reference Voltage).
|
||||
|
||||
Complete Schematic
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/RP2040-Decoder.svg
|
||||
:alt: Complete Schematic
|
||||
|
||||
Complete Schematic
|
||||
|
||||
BOM & Alternative Parts
|
||||
====================
|
||||
.. table:: BOM
|
||||
:widths: auto
|
||||
|
||||
===================================================== ============================= ==================================== ============================= ===================== =========================
|
||||
Ref Quantity Value Component Type Component Name Footprint
|
||||
===================================================== ============================= ==================================== ============================= ===================== =========================
|
||||
C1, C2, C5, C6, C14 5 10u Ceramic Capacitor / 0603_1608Metric
|
||||
C3, C4, C7, C8, C9, C10, C11, C12, C13, C15 10 100n Ceramic Capacitor / 0603_1608Metric
|
||||
C16, C17 2 33p Ceramic Capacitor / 0603_1608Metric
|
||||
D1 1 V\ :sub:`RMS`\=40V, I\ :sub:`F`\=2A Bridge Rectifier KMB24F MBS (TO-269AA)
|
||||
Q1, Q2, Q3, Q4, Q5 5 V\ :sub:`DS`\=60V, I\ :sub:`D`\=0.4A N-Channel MOSFET T2N7002BK SOT-23
|
||||
R1, R2, R5, R6 4 6k8 Resistor / 0603_1608Metric
|
||||
R3 1 200 Resistor / 0603_1608Metric
|
||||
R7, R8, R9 3 1k Resistor / 0603_1608Metric
|
||||
U1 1 V\ :sub:`OUT`\=3.3V Low Dropout Voltage Regulator HT7533S SOT-23
|
||||
U2 1 I=2.8A H-Bridge Driver BDR6133 SOIC-8
|
||||
U3 1 64Mb Flash Memory W25Q64JVSSIQ SOIC-8
|
||||
U4 1 / Microcontroller RP2040 QFN-56-1EP_7x7mm_P0.4mm
|
||||
Y1 1 f=12MHz Crystal Oscillator X322512MSB4SI Crystal_SMD_3225-4Pin_3.2x2.5mm
|
||||
===================================================== ============================= ==================================== ============================= ===================== =========================
|
||||
|
||||
|
||||
|
||||
NOTE: Keep capacitor V\ :sub:`max`\ in mind!
|
||||
|
||||
Alternatives for BDR6133:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* `PT5126A-S-TP <https://lcsc.com/product-detail/Motor-Driver-ICs_PTC-Princeton-Tech-PT5126A-S-TP_C162093.html>`_
|
||||
* `PT2476 <https://lcsc.com/product-detail/Motor-Driver-ICs_PTC-Princeton-Tech-PT2476_C481903.html>`_
|
||||
|
||||
Alternative for HT7533S:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* `GS7533-33TR3 <https://www.lcsc.com/product-detail/Linear-Voltage-Regulators-LDO_Gainsil-GS7533-33TR3_C7427372.html>`_
|
||||
|
||||
|
||||
.. _wiring_rev_1_0:
|
||||
Wiring the Decoder
|
||||
====================
|
||||
|
||||
.. figure:: ../../../../svg/hw/rev_1_0/Wiring_diagram.svg
|
||||
:width: 700
|
||||
:alt: Wiring Diagram
|
||||
|
||||
Wiring Diagram
|
||||
|
||||
The illustration above provides an example of a wiring configuration.
|
||||
It supports the connection of up to 4 transistor-switched outputs and 6 GPIOs for lighter loads or custom applications.
|
||||
When switching inductive loads, always include a free-wheeling diode to protect the circuit.
|
||||
@@ -11,7 +11,8 @@ RP2040-Decoder Documentation
|
||||
:caption: Contents:
|
||||
|
||||
other/getting_started
|
||||
hardware/hw
|
||||
software/sw
|
||||
other/CV_list
|
||||
other/troubleshooting
|
||||
hardware/index
|
||||
software/index
|
||||
other/index
|
||||
other/troubleshooting
|
||||
other/debugging
|
||||
@@ -1,75 +0,0 @@
|
||||
# Getting started
|
||||
In order to make use of this project, you will need the following:
|
||||
- The RP2040-Decoder board itself
|
||||
- Raspberry Pi Pico or another multi-drop SWD debug interfaces might work as well
|
||||
- Micro-USB cable
|
||||
|
||||
## 1. Where to get the board?
|
||||
You can of course choose any preferred PCB manufacturer, the PCB is designed to be compliant with JLCPCB.com 2 layer board capabilities (hole diameter/clearence/etc.). Regarding assembly, you can of course assemble the board yourself but I would not recommend it (especially the RP2040 QFN Package is not easy to solder). Alternatively you can order the board fully or partly assembled. All parts are normally available at LCSC.com who supply parts to JLCPCB.com.
|
||||
|
||||
## 2. Production files?
|
||||
In order to generate export the production files (Gerber/BOM/Pick and Place) you need [KiCad](https://www.kicad.org/download/) 6 which is open source.
|
||||
[How to do this?](https://jlcpcb.com/help/article/362-how-to-generate-gerber-and-drill-files-in-kicad-7)
|
||||
|
||||
## 3. Building and flashing
|
||||
|
||||
To build the software and run it on the Controller we need to interface the RP2040 using Serial Wire Debug. This can be done using a Raspberry Pi Pico board.
|
||||
|
||||
### Windows
|
||||
|
||||
|
||||
1. Connect Raspberry Pi Pico via USB while holding the reset button. Your Pi Pico should now be visible in Windows explorer as a mass storage device.
|
||||
2. Download the latest prebuilt "picoprobe.uf2" release binary from [here](https://github.com/raspberrypi/picoprobe/releases) or download it from the [Raspberry Pi Website](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#debugging-using-another-raspberry-pi-pico).
|
||||
3. Copy "picoprobe.uf2" to your Pi Pico. The Pi Pico onboard LED should now light up.
|
||||
4. Connect GND to GND, GPIO2 to SWCLK, GPIO3 to SWDIO, VBUS to +V, as shown in the picture below .
|
||||
<img src="https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/Debug_Connections.svg" width="700"/>
|
||||
|
||||
5. Download and install [Pico setup for Windows](https://github.com/raspberrypi/pico-setup-windows)
|
||||
6. Download and install [MSYS2](https://www.msys2.org/)
|
||||
7. Open a MSYS2 MINGW64 shell window
|
||||
8. Update all pacman packages
|
||||
```sh
|
||||
pacman -Syu
|
||||
```
|
||||
9. Install mingw-w64-x86_64-toolchain (choose to install all)
|
||||
```sh
|
||||
pacman -S mingw-w64-x86_64-toolchain
|
||||
```
|
||||
10. Add "C:\msys64\mingw64\bin" to your users PATH environment variable. If you have choosen to not use the default directory for MSYS2 add the one you have choosen. [How to do this?](https://www.computerhope.com/issues/ch000549.htm)
|
||||
11. Open the Pico - Developer Powershell
|
||||
12. Navigate to a folder you like and clone the project repository
|
||||
```sh
|
||||
git clone https://github.com/gab-k/RP2040-Decoder
|
||||
```
|
||||
13. Enter cloned repository, create and enter build directory
|
||||
```sh
|
||||
cd RP2040-Decoder
|
||||
mkdir build
|
||||
cd build
|
||||
```
|
||||
14. Run CMake and the mingw32-make to build
|
||||
```sh
|
||||
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
mingw32
|
||||
```
|
||||
15. Flash the decoders software using openocd
|
||||
```sh
|
||||
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c"program rp2040-decoder.elf verify reset exit"
|
||||
```
|
||||
|
||||
### Other OS
|
||||
|
||||
The first four steps are identical to the steps described above for windows users. Regarding building and flashing, please refer to [Getting started - Pico](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf). Chapter 3 & 5 and Appendix A are the most relevant but you might also refer to chapter 9.1 if you are using macOS.
|
||||
|
||||
|
||||
## 4. Wiring and initial startup
|
||||
<img src="https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/Wiring_diagram.svg" width="700"/>
|
||||
|
||||
The illustration above shows an example wiring configuration, you can connect up to 4 outputs(up to 400mA) and 6 GPIOs for lighter loads or custom applications. A Free-wheeling diode should be used when switching inductive loads!
|
||||
|
||||
Another important note is that when the decoder is put into operation for the first time, it automatically performs a motor calibration, which is required for feedforward control. The calibration takes about one to two minutes.
|
||||
|
||||
## 5. If it's not working as expected
|
||||
|
||||
1. Follow the [Troubleshooting instructions](https://github.com/gab-k/RP2040-Decoder/wiki/Troubleshooting)
|
||||
2. If you still have trouble create a new [discussion](https://github.com/gab-k/RP2040-Decoder/discussions) or [issue](https://github.com/gab-k/RP2040-Decoder/issues) and describe your question/issue.
|
||||
@@ -0,0 +1,66 @@
|
||||
Getting started
|
||||
===============
|
||||
|
||||
1. Where to get the board?
|
||||
--------------------------
|
||||
|
||||
You can choose any PCB manufacturer you like.The PCB is designed to fit with JLCPCB.com's capabilities and constraints.You can assemble the board yourself, but it's best not to do so if you're not familiar with soldering small components. Alternatively, you can order the board fully or partly assembled.Soldering the back of the PCB by hand is not too difficult. All parts are normally available at LCSC.com, who supply parts to JLCPCB.com.
|
||||
|
||||
2. Production files?
|
||||
---------------------
|
||||
|
||||
In order to export the production files (Gerber/BOM/Pick and Place), you need `KiCad <https://www.kicad.org/download/>`_ which is open source.
|
||||
In case you are ordering from JLCPCB it is recommended to use the `Fabrication-Toolkit KiCad plugin by bennymeg <https://github.com/bennymeg/Fabrication-Toolkit>`_
|
||||
|
||||
.. _building_the_software:
|
||||
3. Building the software
|
||||
------------------------
|
||||
|
||||
If you got a RP2040-Decoder with USB the easiest way to get the RP2040-Decoder up and running is to just use the precompiled .uf2 file and ignore the rest of this section.
|
||||
|
||||
However sometimes you might want to build by yourself, be it for debugging or to make your own modifications to the source code.
|
||||
The easiest way to do this is to just use `Visual Studio Code <https://code.visualstudio.com/>`_ and the Raspberry Pi Pico extension.
|
||||
The `official documentation <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension>`_ of the Pi Pico does a great job of explaining this in detail.
|
||||
|
||||
4. Flashing the software
|
||||
------------------------
|
||||
|
||||
For RP2040-Decoders with USB there is two ways of flashing the software:
|
||||
|
||||
1. Flasing via USB using the .uf2 file by copying it with your preferred file explorer.
|
||||
2. Using Serial Wire Debug (SWD)
|
||||
|
||||
2.1. Using another RP2040/RP2350-based board with `debugprobe software <https://github.com/raspberrypi/debugprobe>`_ on it. (Could be the RP2040-Decoder itself)
|
||||
|
||||
2.2. Using any other supported SWD debug interface
|
||||
|
||||
For RP2040-Decoders without USB the only way of flashing the software is via SWD
|
||||
|
||||
4.1. Flashing the software via .uf2 file
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
When first plugged in the RP2040 boots into Mass Storage Device mode. To flash the software, you need to drag the '.uf2' file onto the disk using any file explorer.
|
||||
This will write the file to the Flash and restart the RP2040.
|
||||
In case you want to repeat the flasing process, temporarily connect the solder bridge called JP1 on the back side of the board and power cycle the device.
|
||||
This procedure is also described in the `Raspberry Pi Pico Datasheet Chapter 4.1 <https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf#_programming_the_flash>`_
|
||||
|
||||
4.2. Flashing the software via SWD
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Flashing via SWD is a little more complicated but also comes with great advantages in terms of debugging.
|
||||
The book on `Getting started with Raspberry Pi Pico-series <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf>`_ does a great job of explaining how debugging works.
|
||||
As already suggested in :ref:`3. <building_the_software>` it is recommended to use the `Visual Studio Code Extension <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension>`_.
|
||||
Most relevant in the book are `Chapter 4.3. Debug <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#_debug>`_ and `Appendix A: Debugprobe <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#debugprobe_section>`_
|
||||
|
||||
5. Wiring
|
||||
---------
|
||||
|
||||
| Please refer to the hardware section for your board:
|
||||
| :ref:`Wiring Rev 1.0 <wiring_rev_1_0>`
|
||||
| :ref:`Wiring Rev 0.3 <wiring_rev_0_3>`
|
||||
|
||||
6. Resolving issues
|
||||
----------------------------------
|
||||
|
||||
If the decoder is not working as expected:
|
||||
|
||||
1. Follow the `Troubleshooting instructions <https://github.com/gab-k/RP2040-Decoder/wiki/Troubleshooting>`_
|
||||
2. If you still have trouble, create a new `discussion <https://github.com/gab-k/RP2040-Decoder/discussions>`_ or `issue <https://github.com/gab-k/RP2040-Decoder/issues>`_ and describe your question/issue.
|
||||
@@ -0,0 +1,9 @@
|
||||
Other
|
||||
======================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
CV_list
|
||||
troubleshooting
|
||||
File renamed without changes.
Reference in new issue
Block a user