diff --git a/sphinx/doctrees/environment.pickle b/sphinx/doctrees/environment.pickle
index 96132c9..483627a 100644
Binary files a/sphinx/doctrees/environment.pickle and b/sphinx/doctrees/environment.pickle differ
diff --git a/sphinx/doctrees/gs/getting_started.doctree b/sphinx/doctrees/gs/getting_started.doctree
new file mode 100644
index 0000000..5389d12
Binary files /dev/null and b/sphinx/doctrees/gs/getting_started.doctree differ
diff --git a/sphinx/doctrees/hardware/rev_0_3/hw_description.doctree b/sphinx/doctrees/hardware/rev_0_3/hw_description.doctree
index 2e7c226..aa8d4e0 100644
Binary files a/sphinx/doctrees/hardware/rev_0_3/hw_description.doctree and b/sphinx/doctrees/hardware/rev_0_3/hw_description.doctree differ
diff --git a/sphinx/doctrees/hardware/rev_1_0/hw_description.doctree b/sphinx/doctrees/hardware/rev_1_0/hw_description.doctree
index 6392d51..f6b1c01 100644
Binary files a/sphinx/doctrees/hardware/rev_1_0/hw_description.doctree and b/sphinx/doctrees/hardware/rev_1_0/hw_description.doctree differ
diff --git a/sphinx/doctrees/index.doctree b/sphinx/doctrees/index.doctree
index 40631da..cba0cf7 100644
Binary files a/sphinx/doctrees/index.doctree and b/sphinx/doctrees/index.doctree differ
diff --git a/sphinx/doctrees/other/CV_list.doctree b/sphinx/doctrees/other/CV_list.doctree
new file mode 100644
index 0000000..88cf2dd
Binary files /dev/null and b/sphinx/doctrees/other/CV_list.doctree differ
diff --git a/sphinx/doctrees/other/debug_logging.doctree b/sphinx/doctrees/other/debug_logging.doctree
new file mode 100644
index 0000000..b53d588
Binary files /dev/null and b/sphinx/doctrees/other/debug_logging.doctree differ
diff --git a/sphinx/doctrees/other/getting_started.doctree b/sphinx/doctrees/other/getting_started.doctree
deleted file mode 100644
index f4e9772..0000000
Binary files a/sphinx/doctrees/other/getting_started.doctree and /dev/null differ
diff --git a/sphinx/doctrees/other/index.doctree b/sphinx/doctrees/other/index.doctree
index 16c4e9d..5ec2379 100644
Binary files a/sphinx/doctrees/other/index.doctree and b/sphinx/doctrees/other/index.doctree differ
diff --git a/sphinx/doctrees/other/troubleshooting.doctree b/sphinx/doctrees/other/troubleshooting.doctree
new file mode 100644
index 0000000..20a370c
Binary files /dev/null and b/sphinx/doctrees/other/troubleshooting.doctree differ
diff --git a/sphinx/doctrees/software/sw_description.doctree b/sphinx/doctrees/software/sw_description.doctree
index 1d2d5e4..91a8858 100644
Binary files a/sphinx/doctrees/software/sw_description.doctree and b/sphinx/doctrees/software/sw_description.doctree differ
diff --git a/sphinx/html/_images/Block_Diagram_Digital_Controller.svg b/sphinx/html/_images/Block_Diagram_Digital_Controller.svg
new file mode 100644
index 0000000..5e5e20f
--- /dev/null
+++ b/sphinx/html/_images/Block_Diagram_Digital_Controller.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/sphinx/html/_images/GPIO_slices.svg b/sphinx/html/_images/GPIO_slices.svg
new file mode 100644
index 0000000..3cf07ea
--- /dev/null
+++ b/sphinx/html/_images/GPIO_slices.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/sphinx/html/_images/Long_address.svg b/sphinx/html/_images/Long_address.svg
new file mode 100644
index 0000000..69f3706
--- /dev/null
+++ b/sphinx/html/_images/Long_address.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/sphinx/html/_images/Wiring_diagram1.svg b/sphinx/html/_images/Wiring_diagram1.svg
new file mode 100644
index 0000000..a2242a4
--- /dev/null
+++ b/sphinx/html/_images/Wiring_diagram1.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/sphinx/html/_images/feed_forward.svg b/sphinx/html/_images/feed_forward.svg
deleted file mode 100644
index 0b53f41..0000000
--- a/sphinx/html/_images/feed_forward.svg
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
diff --git a/sphinx/html/_images/speed_table.svg b/sphinx/html/_images/speed_table.svg
new file mode 100644
index 0000000..d04c27b
--- /dev/null
+++ b/sphinx/html/_images/speed_table.svg
@@ -0,0 +1,143 @@
+
+
diff --git a/sphinx/html/_sources/other/getting_started.rst.txt b/sphinx/html/_sources/gs/getting_started.rst.txt
similarity index 75%
rename from sphinx/html/_sources/other/getting_started.rst.txt
rename to sphinx/html/_sources/gs/getting_started.rst.txt
index c21a635..4ef9afb 100644
--- a/sphinx/html/_sources/other/getting_started.rst.txt
+++ b/sphinx/html/_sources/gs/getting_started.rst.txt
@@ -8,8 +8,9 @@ You can choose any PCB manufacturer you like. The PCB is designed to fit with JL
2. Production files?
----------------------------------
+The latest release includes the production files for JLCPCB, which includes the Gerber files, BOM, and Pick and Place files. You can find the latest release `here `_.
-In order to export the production files (Gerber/BOM/Pick and Place), you need `KiCad `_ which is open source.
+In order to manually export the production files (Gerber/BOM/Pick and Place), you need `KiCad `_ which is open source.
In case you are ordering from JLCPCB it is recommended to use the `Fabrication-Toolkit KiCad plugin by bennymeg `_
.. _building_the_software:
@@ -17,7 +18,7 @@ In case you are ordering from JLCPCB it is recommended to use the `Fabrication-T
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.
+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 in the latest `release `_ and skip to :ref:`flashing_the_software`.
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 `_ and the Raspberry Pi Pico extension.
@@ -25,6 +26,8 @@ The `official documentation `_
+.. _flashing_the_software_swd:
+
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 `_ does a great job of explaining how debugging works.
-As already suggested in :ref:`3. ` it is recommended to use the `Visual Studio Code Extension `_.
-Most relevant in the book are `Chapter 4.3. Debug `_ and `Appendix A: Debugprobe `_
+As already suggested in :ref:`building_the_software` it is recommended to use the `Visual Studio Code Extension `_.
+The most relevant sections in the book are `Chapter 4.3. Debug `_ and `Appendix A: Debugprobe `_
+
5. Wiring
----------------------------------
diff --git a/sphinx/html/_sources/hardware/rev_0_3/hw_description.rst.txt b/sphinx/html/_sources/hardware/rev_0_3/hw_description.rst.txt
index 7602360..3fc164f 100644
--- a/sphinx/html/_sources/hardware/rev_0_3/hw_description.rst.txt
+++ b/sphinx/html/_sources/hardware/rev_0_3/hw_description.rst.txt
@@ -110,10 +110,6 @@ Complete Schematic
Complete Schematic
-BOM & Alternative Parts
-==============================
-please see **PLACEHOLDER-AUTOGENERATED-BOM** for the complete BOM.
-
.. _wiring_rev_0_3:
diff --git a/sphinx/html/_sources/hardware/rev_1_0/hw_description.rst.txt b/sphinx/html/_sources/hardware/rev_1_0/hw_description.rst.txt
index 02ac344..c92c0dd 100644
--- a/sphinx/html/_sources/hardware/rev_1_0/hw_description.rst.txt
+++ b/sphinx/html/_sources/hardware/rev_1_0/hw_description.rst.txt
@@ -112,10 +112,6 @@ Complete Schematic
Complete Schematic
-BOM & Alternative Parts
-==============================
-please see **PLACEHOLDER-AUTOGENERATED-BOM** for the complete BOM.
-
.. _wiring_rev_1_0:
diff --git a/sphinx/html/_sources/index.rst.txt b/sphinx/html/_sources/index.rst.txt
index 67b8374..151cca1 100644
--- a/sphinx/html/_sources/index.rst.txt
+++ b/sphinx/html/_sources/index.rst.txt
@@ -10,8 +10,7 @@ RP2040-Decoder Documentation
:maxdepth: 3
:caption: Contents:
- other/getting_started
+ gs/getting_started
hardware/index
software/index
- other/index
- other/troubleshooting
+ other/index
\ No newline at end of file
diff --git a/sphinx/html/_sources/other/CV_list.rst.txt b/sphinx/html/_sources/other/CV_list.rst.txt
new file mode 100644
index 0000000..b84491a
--- /dev/null
+++ b/sphinx/html/_sources/other/CV_list.rst.txt
@@ -0,0 +1,126 @@
+Configuration Variables (CV)
+============================
+
+
+.. note::
+
+ - ``CV.h`` contains default values for every CV. When your board is still "factory new" these values are automatically written into flash. ``CV_65 == 255`` indicates a factory condition and resets all CVs to default.
+
+ - Index 0 in the CV array corresponds with ``CV_1``, index 1 corresponds with ``CV_2`` and so forth.
+
+Reset all CVs
+------------------------
+
+To reset all CVs to default, a value of ``8`` can be written to ``CV8``. Alternatively write a value of ``255`` to ``CV_65`` this will also reset all CVs to default, but only after power cycling the decoder.
+
+Speed step configuration
+------------------------
+
+.. figure:: ../../../svg/sw/speed_table.svg
+ :alt: Speed Table
+ :align: center
+
+ Speed Table
+
+* :math:`v_{min} = CV_{2}`
+* :math:`v_{mid} = 16 \cdot CV_{6}`
+* :math:`v_{max} = 16 \cdot CV_{5}`
+
+The figure above shows how the speed steps can be configured using the corresponding CVs. The red * represents :math:`v_{min}` which is always at speed step 1, the green * shows :math:`v_{mid}` at speed step 63, and the blue * shows :math:`v_{max}` at speed step 126.
+
+CV List
+-------
+
+:math:`CV_{1}` - Basic address
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Short DCC address
+
+:math:`CV_{2}` - :math:`v_{min}`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Min motor voltage/speed is: :math:`v_{min} = CV_{2}`
+
+:math:`CV_{3}` - Acceleration rate
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The time for one discrete acceleration time step can be calculated as :math:`CV_{3} \cdot CV_{175}`.
+
+.. note:: Base speed steps are always 128/126 steps.
+
+:math:`CV_{4}` - Deceleration rate
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The time for one discrete deceleration time step can be calculated as :math:`CV_{4} \cdot CV_{175}`.
+
+.. note:: Base speed steps are always 128/126 steps.
+
+:math:`CV_{5}` - :math:`v_{max}`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Max motor voltage/speed is calculated as: :math:`v_{max} = 16 \cdot CV_{5}`
+
+:math:`CV_{6}` - :math:`v_{mid}`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Mid motor voltage/speed is calculated as: :math:`v_{mid} = 16 \cdot CV_{6}`
+
+:math:`CV_{7}` - Version No. (Read-Only)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Writing a value of ``7`` triggers an ADC offset adjustment.
+
+:math:`CV_{8}` - Manufacturer (Read-Only)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Default = ``13`` = Public Domain & Do-It-Yourself Decoders
+
+Even though :math:`CV_{8}` is defined as a Read-only CV, writing a value of ``8`` resets all CV values to the default values in ``CV.h``.
+
+:math:`CV_{9}` - Motor PWM Frequency
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:math:`f_{PWM_{MOTOR}} = (CV_9 \cdot 100 + 10000) \, Hz`
+
+:math:`CV_{11}` - Packet timeout
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If no package is received for :math:`x = CV_{11}` seconds the decoder will automatically stop the motor (Emergency Stop).
+
+:math:`CV_{12}` - Permitted operating modes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Currently, DCC Digital mode is the only supported mode.
+
+:math:`CV_{17}` & :math:`CV_{18}` - 14-Bit extended/long address
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Address is only used if bit5 of :math:`CV_{29}` has a value of ``1``.
+
+.. image:: ../../../svg/sw/Long_address.svg
+ :alt: Long Address
+ :align: center
+
+Bit15 and bit14 which correspond to bit7 and bit6 of :math:`CV_{17}` are always ``1``. :math:`CV_{17} = 192` & :math:`CV_{18} = 0` is also not a valid address.
+Otherwise, the valid value range of :math:`CV_{17}` ranges from ``192`` to ``231`` and ``0`` to ``255`` for :math:`CV_{18}` respectively.
+
+:math:`CV_{29}` - Decoder Configuration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Bit0 is can be used to reverse motor direction, i.e., ``0`` = normal, ``1`` = reverse.
+Bit5 switches between basic and extended addressing modes, i.e., ``0`` = basic address, ``1`` = extended address.
+The other 6 bits are currently not in use and therefore irrelevant.
+
+:math:`CV_{31}` & :math:`CV_{32}` - Extended CV pointer (Read-Only)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Not in use.
+
+
+:math:`CV_{116}` to :math:`CV_{171}` - PWM Slice configuration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. image:: ../../../svg/sw/GPIO_slices.svg
+ :alt: GPIO Slices
+ :align: center
+
+Every slice controls two independent output channels, duty cycle from 0% to 100% inclusive, and can be configured with several parameters:
+
+* Wrap (16Bit): Sets the slice time period of x cycles - effectively determining the frequency
+* Clock Divider: Additional clock divider
+* Level Channel A / Level Channel B (16Bit each): Determining how many of the x cycles the signal is at a high level - effectively determining the duty cycle
+
+To see which CVs correspond to which slice and channel, it is advisable to use ``CV.h`` as a reference.
+
+The PWM frequency is calculated as follows: :math:`f_{PWM} = \frac{125 \, \text{MHz}}{(CV_{\text{clk_div}} + 1) \cdot (CV_{\text{wrap}} + 1)}`
+
+The duty-cycle can be calculated as follows: :math:`D = \frac{CV_{\text{Level}}}{CV_{\text{wrap}} + 1}`
+
+
+A more detailed explanation regarding PWM can be found in the `RP2040-Datasheet - Chapter 4.5 `_.
+
diff --git a/sphinx/html/_sources/other/debug_logging.rst.txt b/sphinx/html/_sources/other/debug_logging.rst.txt
new file mode 100644
index 0000000..7b3f6e0
--- /dev/null
+++ b/sphinx/html/_sources/other/debug_logging.rst.txt
@@ -0,0 +1,23 @@
+Debugging and Logging
+==================================
+
+For logging and debugging you have to build the software yourself. This is explained here: :ref:`building_the_software`
+
+.. _debugging_via_swd:
+
+Debugging via SWD
+----------------------------------
+Please refer to :ref:`flashing_the_software_swd`.
+
+
+.. _logging:
+
+Logging
+----------------------------------
+
+Logging can be enabled in ``CMakeLists.txt``, and is available with two interfaces:
+
+ - Logging via UART RX/TX pins (GPIO0/GPIO1 by default)
+ - Logging via USB CDC/ACM
+
+Additionally you can make the decoder wait for input via serial port by setting LOG_WAIT to 1. For more details please see comments inside ``CMakeLists.txt``.
diff --git a/sphinx/html/_sources/other/index.rst.txt b/sphinx/html/_sources/other/index.rst.txt
index f775542..8e1aa68 100644
--- a/sphinx/html/_sources/other/index.rst.txt
+++ b/sphinx/html/_sources/other/index.rst.txt
@@ -5,5 +5,6 @@ Other
:maxdepth: 2
:caption: Contents:
- CV_list
- troubleshooting
\ No newline at end of file
+ troubleshooting
+ debug_logging
+ CV_list
\ No newline at end of file
diff --git a/sphinx/html/_sources/other/troubleshooting.rst.txt b/sphinx/html/_sources/other/troubleshooting.rst.txt
new file mode 100644
index 0000000..771778a
--- /dev/null
+++ b/sphinx/html/_sources/other/troubleshooting.rst.txt
@@ -0,0 +1,27 @@
+Troubleshooting
+================
+
+To narrow down the issue when your decoder is not working as expected, you can do the following (in no particular order):
+
+Enable logging and or debug via SWD
+------------------------------------
+Log messages can be enabled and output via either UART or USB please see :ref:`logging` for details.
+For more advanced users it might also be beneficial to :ref:`debug with SWD `
+
+Checking the power supply:
+--------------------------------------
+
+* **+3V3 to GND** should be 3.3V ± 1%
+* **VDC/+V to GND** should be somewhere in the range of at least 6V to 23V depending on your track voltage.
+
+If you don't measure the correct voltages, try to `measure your track voltage `_
+
+Check your motor:
+-----------------
+
+Desolder your motor and try the motor with an appropriate power supply and DC voltage, to check if the motor is working or not.
+
+CV Reset:
+------------
+
+Try to reset the decoder by writing a value of ``8`` to ``CV8`` (beware, this will reset the complete CV memory!)
diff --git a/sphinx/html/_sources/software/sw_description.rst.txt b/sphinx/html/_sources/software/sw_description.rst.txt
index 4892bb0..7e88fdf 100644
--- a/sphinx/html/_sources/software/sw_description.rst.txt
+++ b/sphinx/html/_sources/software/sw_description.rst.txt
@@ -65,14 +65,14 @@ Control Loop & Digital Controller
Control Loop - Block diagram
-The block diagram above shows the complete control loop. The actual digital controller block is explained below.
+The block diagram above shows the (simplified) control loop. The actual digital controller block is explained below.
-The Speed Helper block effectively sets the setpoint of the controller according to the CV configured acceleration and deceleration rates and actual target speedstep.
+The *Speed Helper* block effectively sets the setpoint of the controller according to the CV configured acceleration and deceleration rates and actual target speedstep.
-For feedback the back EMF voltage V_EMF is measured via voltage divider and ADC. V_EMF is proportional to the motor speed in RPM.
+For feedback the back EMF voltage *V_EMF* is measured via voltage divider and ADC. *V_EMF* is proportional to the motor speed.
-TODO: rewrite this: While the central component is the PID controller, there is an additional block called `Feed-forward `_ that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the ``speed_helper()`` function, which delays changing the setpoint according to the configured deceleration/acceleration rates.
+While the central component is the PID controller, there is an additional block called `Feed-forward `_ that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the ``speed_helper()`` function, which delays changing the setpoint according to the configured deceleration/acceleration rates.
.. figure:: ../../../svg/sw/Block_Diagram_Digital_Controller.svg
:alt: Block Diagram - Digital Controller
@@ -80,12 +80,27 @@ TODO: rewrite this: While the central component is the PID controller, there is
Digital Controller - Block diagram
-The controller is divided into two parts, depending on whether the motor is stationary or in motion. The startup controller handles overcoming friction of the motor, and finding base PWM level for overcoming friction. The base PWM level is saved and added to the output of the PID controller which handles motor control when the motor is in motion.
+The controller is divided into two parts, depending on whether the motor is stationary or in motion.
+At all times either the startup controller or the PID controller is active.
+
+The startup controller handles overcoming friction of the motor, and finding a base PWM level for overcoming friction.
+The base PWM level is equivalent to a certain PWM duty cycle.
+The base level gets saved and added to the output of the PID controller which handles motor control when the motor is in motion.
+This means the actual output of the PID controller is the sum of the PID output and the base PWM level. This is referred to as the :ref:`feed forward ` block.
+The benefit of doing this is that the PID controller does not have to work in the non linear friction region of the motor, improving control performance.
Startup Controller
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Used on startup, meaning when the motor is not moving. The startup controller sets a PWM duty cycle level of :math:`\frac{2}{3} \cdot \text{base_pwm}` and then ramps up the duty cycle/PWM level until the motor starts moving. This is done in order to overcome the friction of the drive train and motor. :math:`\text{base_pwm}` is the average value of the 16 previous startup PWM levels. When no previous startup PWM levels are saved the startup controller begins ramping up from 0. The actual value at which the motor started moving is used as a reference for the :ref:`feed forward ` block.
+
+Used on startup, meaning when the motor is not moving. First the startup controller retrieves the last `BASE_PWM_ARR_LEN` base PWM levels.
+The base pwm levels are not retained on a power cycle. That means when there is no previous base PWM level saved, the startup controller will start ramping up from 0.
+When there is less than `BASE_PWM_ARR_LEN` base PWM levels saved, the startup controller will ramp up from the average of the saved base PWM levels.
+
+After the startup controller retrieved the average of the last base pwm levels :math:`\bar{b}` it sets a PWM duty cycle level of :math:`\frac{2}{3} \cdot \bar{b}` and then ramps up the duty cycle/PWM level until the motor starts moving.
+When no previous startup PWM levels are saved the startup controller begins ramping up from 0.
+The actual value at which the motor started moving is multiplied by `K_FF` and used as a reference for the :ref:`feed forward ` block.
+
PID Controller
@@ -131,7 +146,7 @@ This results in the following difference equations which are then implemented in
Gain Scheduling
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^^^^^^^
.. figure:: ../../../svg/sw/adaptive_kp.svg
:alt: Gain Scheduling figure
@@ -145,19 +160,12 @@ Another aspect to consider is the implementation of `gain scheduling `_ is used.
+In essence this means that the output of the PID controller is not only the sum of the proportional, integral, and derivative parts, but also the base PWM level.
+The base PWM level is set by the startup controller and is the PWM level at which the motor starts moving.
-.. figure:: ../../../svg/sw/feed_forward.svg
- :alt: Feed forward figure
- :align: center
-
- Feed-forward
-
-
-TODO: Update this part:
-
-To achieve better control, `Feed-forward `_ is used. On startup, the decoder will check for a configuration regarding Feed-forward control. When no configuration is found, the decoder automatically runs a calibration to establish a base PWM level (y\ :sub:`1`) for both directions. The base PWM level (y\ :sub:`1`) will vary depending on load, motor, and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y\ :sub:`2` is corrected automatically when i\ :sub:`n` reaches 0.5i\ :sub:`min` or 0.5i\ :sub:`max`. CV_47 can be used to set how sensitive this correction is.
Back-EMF voltage measurement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/sphinx/html/genindex.html b/sphinx/html/genindex.html
index 6729ffc..65d56df 100644
--- a/sphinx/html/genindex.html
+++ b/sphinx/html/genindex.html
@@ -41,7 +41,7 @@
In order to export the production files (Gerber/BOM/Pick and Place), you need KiCad which is open source.
+
The latest release includes the production files for JLCPCB, which includes the Gerber files, BOM, and Pick and Place files. You can find the latest release here.
+
In order to manually export the production files (Gerber/BOM/Pick and Place), you need KiCad which is open source.
In case you are ordering from JLCPCB it is recommended to use the Fabrication-Toolkit KiCad plugin by bennymeg
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.
+
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 in the latest release and skip to 4. Flashing the software.
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 and the Raspberry Pi Pico extension.
The official documentation of the Pi Pico does a great job of explaining this in detail.
Note: If you are building for Hardware Rev 0.3 or below change the board defintion in your CMakeLists.txt file to: “RP2040-Decoder-board-legacy.h”
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.
+In case you want to repeat the flashing process, hold the button SW1 while re-plugging the decoder into your computer. The decoder should now show as a Mass Storage Device again.
This procedure is also described in the Raspberry Pi Pico Datasheet Chapter 4.1
Another aspect to consider is the implementation of gain scheduling. KP is a function of the current setpoint. Often it is favorable to have a higher proportional gain KP for slow speeds, achieving better control results. The illustration above shows the default setting for KP. CV_54 & CV_55 are used to set KP @ x0, CV_56 & CV_57 for KP @ x1, and CV_58 & CV_59 for KP @ x2. Additionally, CV_60 is used to shift x1 from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).
To achieve better control, Feed-forward is used. On startup, the decoder will check for a configuration regarding Feed-forward control. When no configuration is found, the decoder automatically runs a calibration to establish a base PWM level (y1) for both directions. The base PWM level (y1) will vary depending on load, motor, and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y2 is corrected automatically when in reaches 0.5imin or 0.5imax. CV_47 can be used to set how sensitive this correction is.
As previously mentioned, to achieve better control, Feed-forward is used.
+In essence this means that the output of the PID controller is not only the sum of the proportional, integral, and derivative parts, but also the base PWM level.
+The base PWM level is set by the startup controller and is the PWM level at which the motor starts moving.