diff --git a/sphinx/doctrees/environment.pickle b/sphinx/doctrees/environment.pickle index 7278eca..9c5f9af 100644 Binary files a/sphinx/doctrees/environment.pickle and b/sphinx/doctrees/environment.pickle differ diff --git a/sphinx/doctrees/hardware/rev_0_3/hw_description.doctree b/sphinx/doctrees/hardware/rev_0_3/hw_description.doctree index 4cd9e9f..2e7c226 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 17a6e50..6392d51 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 06fc9eb..40631da 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 deleted file mode 100644 index 177f8eb..0000000 Binary files a/sphinx/doctrees/other/CV_list.doctree and /dev/null differ diff --git a/sphinx/doctrees/other/index.doctree b/sphinx/doctrees/other/index.doctree index 2558099..16c4e9d 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 deleted file mode 100644 index 03eaaa5..0000000 Binary files a/sphinx/doctrees/other/troubleshooting.doctree and /dev/null differ diff --git a/sphinx/doctrees/software/header_files.doctree b/sphinx/doctrees/software/header_files.doctree index 0ee0c37..e37aaf3 100644 Binary files a/sphinx/doctrees/software/header_files.doctree and b/sphinx/doctrees/software/header_files.doctree differ diff --git a/sphinx/doctrees/software/index.doctree b/sphinx/doctrees/software/index.doctree index d054eaf..5ce06fe 100644 Binary files a/sphinx/doctrees/software/index.doctree and b/sphinx/doctrees/software/index.doctree differ diff --git a/sphinx/doctrees/software/sw_description.doctree b/sphinx/doctrees/software/sw_description.doctree index 98a9c9c..44d9385 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_Control.svg b/sphinx/html/_images/Block_Diagram_Control.svg deleted file mode 100644 index 11a030f..0000000 --- a/sphinx/html/_images/Block_Diagram_Control.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - -
Speed Helper
Motor Controller

PID MODE

or

STARTUP MODE
Motor Driver
ADC
Motor
Setpoint
Accel/Decel - Rate
Target Speedstep
Measurement
+

-
Error
Output
BEMF-Voltage
RPM
Voltage Divider
\ No newline at end of file diff --git a/sphinx/html/_images/Block_Diagram_Control_Loop.svg b/sphinx/html/_images/Block_Diagram_Control_Loop.svg new file mode 100644 index 0000000..4c3dd37 --- /dev/null +++ b/sphinx/html/_images/Block_Diagram_Control_Loop.svg @@ -0,0 +1,4 @@ + + + +
Speed Helper
Motor Controller

PID MODE

or

STARTUP MODE
Motor Driver
ADC
Motor
SETPOINT
ACCEL/DECEL- RATE
TARGET SPEEDSTEP
MEASUREMENT
+

-
ERROR
OUTPUT
V_EMF
RPM
Voltage Divider
PWM
V_EMF_ADC
\ No newline at end of file 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 c76e382..7602360 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 @@ -30,7 +30,7 @@ Electrical Characteristics ===================================================== ============================= ========= ========= ===== Parameter Symbol Minimum Maximum Unit ===================================================== ============================= ========= ========= ===== - Absolute max. DCC Input Voltage difference V\ :sub:`DCC`\ +24 V + Absolute max. DCC Input Voltage difference V\ :sub:`DCC`\ 0 +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 @@ -46,6 +46,8 @@ Electrical Characteristics (2): According to: `T2N7002BK Datasheet `_ +.. note:: Keep in mind that realistically these maximum ratings can't be reached in practice due to thermal limitations. For example the motor current can probably not exceed 1.5A for continuous operation. + Input Stage ============================== @@ -110,41 +112,7 @@ 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 `_ -* `PT2476 `_ - -Alternative for HT7533S: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -* `GS7533-33TR3 `_ +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 2bf67a9..02ac344 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 @@ -49,6 +49,9 @@ Electrical Characteristics (3): T\ :sub:`Case`\ = 25°C, keep power dissipation, thermal resistance the corresponding temperature rise ΔT and switching losses in PWM mode in mind! +.. note:: Keep in mind that realistically these maximum ratings can't be reached in practice due to thermal limitations. For example the motor current can probably not exceed 1.5A for continuous operation. + + Input Stage ============================== @@ -58,9 +61,10 @@ 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 +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, meaning that the decoder can be powered either by the DCC track signal or by the VBUS supply voltage which is supplied via USB connector. 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 ============================== @@ -110,41 +114,7 @@ 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 `_ -* `PT2476 `_ - -Alternative for HT7533S: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -* `GS7533-33TR3 `_ +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 3447a3d..67b8374 100644 --- a/sphinx/html/_sources/index.rst.txt +++ b/sphinx/html/_sources/index.rst.txt @@ -7,7 +7,7 @@ RP2040-Decoder Documentation ============================ .. toctree:: - :maxdepth: 2 + :maxdepth: 3 :caption: Contents: other/getting_started diff --git a/sphinx/html/_sources/other/CV_list.md.txt b/sphinx/html/_sources/other/CV_list.md.txt deleted file mode 100644 index 0e05c75..0000000 --- a/sphinx/html/_sources/other/CV_list.md.txt +++ /dev/null @@ -1,202 +0,0 @@ -# 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. Alternatively to reset all CVs to default a value of 8 can be written to CV8. Also note that index 0 in the CV array corresponds with CV_1, index 1 corresponds with CV_2 and so forth. This list only contains CVs that are in use. - -## Speed step configuration -![Speed Table](https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/speed_table.svg) -* V_min = CV_2 -* V_mid = CV_6 * 16 -* V_max = CV_5 * 16 - -The illustration above shows how the speed steps can be configured using the corresponding CVs. The red * represents V_min which is always at speed step 1, the green * shows V_mid at speed step 64 and the blue * shows V_max at speed step 126. - -## CV List - -### CV_1 - Basic address -Short DCC address - - -### CV_2 - V_min -Min motor voltage/speed - - -### CV_3 - Acceleration rate -CV_3*CV_175 = Time for one discrete speed step change in ms - - -### CV_4 - Deceleration rate -CV_4*CV_175 = Time for one discrete speed step change in ms - - -### CV_5 - V_max -Max motor voltage/speed - V_max = CV_5 * 16 - - -### CV_6 - V_mid -Mid motor voltage/speed - V_max = CV_6 * 16 - - -### CV_7 - Version No. (Read-Only) -Rev 0.3 = 1 - -Writing a value of 7 triggers am ADC offset adjustment. - -### CV_8 - Manufacturer (Read-Only) -Default = "13" = Public Domain & Do-It-Yourself Decoders - - -Writing a value of 8 resets all CV values to the default values in CV.h. -This will also happen if CV_65 == "255" == "0xFF". - - -### CV_9 - Motor PWM Frequency -f in Hz = CV_9 * 100 + 10000 - - -### CV_11 - Packet timeout -If no package is received for x seconds (x = CV_11) the decoder will automatically stop the motor (Emergency Stop). - - -### CV_12 - Permitted operating modes -Currently DCC Digital mode is the only supported mode. - - -### CV_17 & CV_18 - 14-Bit extended/long address -Address is only used if bit5 has a value of "1" in CV_29. - -![Long Address](https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/Long_address.svg) - -Bit15 and bit14 which correspond to bit7 and bit6 of CV_17 are always "1". CV_17 = "192" & CV_18 = "0" is also not a valid address. Otherwise the valid value range of CV_17 ranges from "192" to "231" and "0" to "255" for CV_18 respectively. - - - -### CV_29 - Decoder Configuration - -Bit0 is used to reverse 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. - - -### CV_31 & CV_32 - Extended CV pointer (Read-Only) -Not in use. - -### CV_47 - Feed-forward gain k_ff -k_ff defines the correction behavior with regard to the y2 variable. High values for k_ff lead to a faster change in the variable. Values for k_ff that are too high can lead to oscillations. -k_ff = CV_47/10000 - - -### CV_48 - Filter time constant (tau) in ms -The time constant tau characterizes the low-pass filter which is connected downstream in the D component of the PID controller - - -### CV_49 - PID Control sampling time t in ms -Every t seconds the pid_control() function gets called to compute the new control output - - -### CV_50 - PID Control I Factor -Integral gain factor of the PID-Controller - - -### CV_51 - PID Control D Factor -Derivative gain factor of the PID-Controller - - -### CV_52 & CV_53 - PID Integral Limits -Maximum and minimum integral part values - - -### CV_54 & CV_55 - Gain scheduling config k_p @ x0 -CV_54 - High Byte -- CV_55 - Low Byte - - -### CV_56 & CV_57 - Gain scheduling config k_p @ x1 -CV_56 - High Byte -- CV_57 - Low Byte - - -### CV_58 & CV_59 - Gain scheduling config k_p @ x2 -CV_58 - High Byte -- CV_59 - Low Byte - - -### CV_60 - Gain scheduling config x1 shift percentage -Determines position of x1 in percent -> x1 shift in % ≙ CV_60/255 - - -### CV_61 - Measurement Iterations -Total amount of BEMF-Voltage measurement iterations - - -### CV_62 - Measurement Delay -BEMF-Voltage measurement delay - - -### CV_63 & CV_64 - Measurement array cutoffs -CV_63 determines how many elements from the left side (beginning with index 0) of the array will be discarded while CV_64 determines how many elements from the right side (beginning from highest index) will be discarded. - - -### CV_65 - New flash variable -Each Byte of the factory new flash chip should have a inital state of "0xFF". This will be checked for in the beginning of core0.c (see cv_setup_check()). When CV_65 == "255" == "0xFF" the default config (CV.h) will be written to flash. Alternatively a reset to default can be done by either writing "8" to CV_8 or writing "255" to CV_65 which then triggers a reset on startup. - - -### CV_112, CV_113, CV_114, CV_115 - GPIO PWM Configuration -PWM enabled "1" - PWM disabled "0" - - -### CV_116 to CV_171 - PWM Slice configuration -![GPIO Slices](https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/GPIO_slices.svg) - - -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: fPWM = 125 MHz / [ (CVclk_div + 1) * (CVwrap + 1) ] - -The duty-cycle can be calculated as follows: D = CVLevel / CVwrap + 1 - -**Example configuration - (AUX2: PWM-Frequency fPWM = 10kHz; Duty-cycle D = 20%):** - -AUX1 => GPIO25 => Slice 4 / Channel B => Wrap: CV_144 & CV_145; Clock-divider: CV_146; Level(B): CV_149 & CV_150 - -=> fPWM = 10kHz = 125 MHz / [ (0 + 1) * (12499 + 1) ]; - -=> CV_144 = 110000, CV_145 = 11010011, CV_146 = 0; --- (Note: "12499dec" = "11000011010011bin") - -=> CVLevel = CV_149 & CV_150 = D * (CVwrap + 1) = 0.2 * 12500 = 2500 - -=> CV_149 = 1001, CV_150 = 11000100; --- (Note: "2500dec" = "100111000100bin") - -Another configuration which also achieves 10kHz and D = 20% would be CVclk_div = 10, CVwrap = 1249, CVLevel = 250. - - -A more detailed explanation regarding PWM can be found in the [RP2040-Datasheet - Chapter 4.5](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf). - -### CV_172 - ADC Offset -If CV_172 = "0xFF" = "255" there will be a measurement procedure on startup - - -### CV_173 - ADC offset measurement cycles -Determines how many ADC offset measurement iterations are done. - - -### CV_174 - Additional motor-PWM clock divider. -Additional Clock Divider - works the same as any GPIO clock divider - - -### CV_175 - speed_helper timer delay -This timer delay can be used to change the time between two speed steps. So basically an additional option to adjust the deceleration and acceleration rate. - - -### CV_176, CV_177, CV_178, CV_179 - Base PWM Level used in feed-forward control -CV_176 - High Byte forward -- CV_177 - Low Byte forward -- CV_178 - High Byte reverse -- CV_179 - Low Byte reverse - -These values are equivalent to y1(forward) and y1(reverse) mentioned [here](https://github.com/gab-k/RP2040-Decoder/wiki/Software-description#feed-forward). Writing "0" to all four CVs schedules a new calibration on startup. - - -### CV_257 to CV_512 - Function Mapping CVs -The switching status of the outputs depends both on the function instruction received and on the current direction of travel. That means you can, for example, use a function to switch two or more outputs or, as is usual with headlights, switch them depending on the direction of travel. For configuration, 32 bits (corresponding to the GPIOs) are available for each function in each direction of travel. diff --git a/sphinx/html/_sources/other/troubleshooting.md.txt b/sphinx/html/_sources/other/troubleshooting.md.txt deleted file mode 100644 index 0a53c06..0000000 --- a/sphinx/html/_sources/other/troubleshooting.md.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Troubleshooting - -To narrow down the issue when your decoder is not working as expected, you can do the following: - -Check the power supply of the decoder: -* +3V3 to GND should be 3.3V -* +V to GND should be somewhere in the range of around +10V to +20V -* If you dont measure the correct voltages, try to [measure Track Voltage](https://dccwiki.com/Measuring_Track_Voltage) - -Check your motor: -* Desolder your motor and try the motor with a analog power supply 0...+-16V to check if the motor is working or not (desolder the wires because the decoder doesn't like voltage on these pins!) - -Reset: -* Try to reset the decoder by writing a value of 8 to CV8 (beware, this will reset the complete CV memory!) \ No newline at end of file diff --git a/sphinx/html/_sources/software/header_files.rst.txt b/sphinx/html/_sources/software/header_files.rst.txt index 64b3b57..3d9201e 100644 --- a/sphinx/html/_sources/software/header_files.rst.txt +++ b/sphinx/html/_sources/software/header_files.rst.txt @@ -1,29 +1,22 @@ -Header files -================= - core0.h -------------- - .. doxygenfile:: core0.h :project: RP2040-Decoder - + core1.h -------------- - .. doxygenfile:: core1.h :project: RP2040-Decoder shared.h -------------- - .. doxygenfile:: shared.h :project: RP2040-Decoder CV.h -------------- - .. doxygenfile:: CV.h :project: RP2040-Decoder diff --git a/sphinx/html/_sources/software/index.rst.txt b/sphinx/html/_sources/software/index.rst.txt index 0e001b3..5ff8573 100644 --- a/sphinx/html/_sources/software/index.rst.txt +++ b/sphinx/html/_sources/software/index.rst.txt @@ -2,7 +2,7 @@ Software ================= .. toctree:: - :maxdepth: 2 + :maxdepth: 3 :caption: Contents: sw_description diff --git a/sphinx/html/_sources/software/sw_description.rst.txt b/sphinx/html/_sources/software/sw_description.rst.txt index ea8e113..556bfa4 100644 --- a/sphinx/html/_sources/software/sw_description.rst.txt +++ b/sphinx/html/_sources/software/sw_description.rst.txt @@ -38,29 +38,55 @@ Software files high level overview: - **RP2040-Decoder-board.h or RP2040-Decoder-board-legacy.h** - Flash Size - - Pin specification + - Pin definitions - LED pin when available - - UART_TX/UART_RX when used + - UART_TX/UART_RX pins when used for logging - DCC input pin - Motor Control PWM pins - ADC pins +- **post_build.cmake** + - Post build script for checking whether the size of the binary is within the limits of the flash size minus one sector (used for storing CVs). +- **pico_sdk_import.cmake** + + - Helps to locate and import the Pico SDK -Conveniently, The Raspberry Pi Foundation provides a well-documented `SDK `_ for the RP2040. The SDK provides abstraction to a higher level, and therefore there is no need to access any registers directly. Everything is written using the SDK, so hopefully, the code is easier to understand. +The `Raspberry Pi Pico SDK `_ is a dependency of the decoder software. The SDK provides abstraction to a higher level, so hopefully, in combination with the comments included in header and source files, the code is easy enough to understand. -Motor control ------------------------------- +Control Loop & Digital Controller +------------------------------------ -.. figure:: ../../../svg/sw/Block_Diagram_Control.svg - :alt: Block Diagram +.. figure:: ../../../svg/sw/Block_Diagram_Control_Loop.svg + :alt: Block Diagram - Control Loop :align: center - Motor control - Block diagram + Control Loop - Block diagram + +The block diagram above shows the complete 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. + +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. + + +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. + +.. figure:: ../../../svg/sw/Block_Diagram_Digital_Controller.svg + :alt: Block Diagram - Digital Controller + :align: center + + 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. + + +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. -The above block diagram in essence describes the functionality of the control loop. 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. PID Controller ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -99,7 +125,9 @@ This results in the following difference equations which are then implemented in \end{align} -Also note that instead of using the derivative of error, the derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint. +.. note:: + - Instead of using the derivative of error, the derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint. + - The previously explained base PWM is added to the actual output as well, meaning the formula above only shows the actual PID control part without feed forward. Gain Scheduling @@ -113,6 +141,9 @@ Gain Scheduling Another aspect to consider is the implementation of `gain scheduling `_. K\ :sub:`P` is a function of the current setpoint. Often it is favorable to have a higher proportional gain K\ :sub:`P` for slow speeds, achieving better control results. The illustration above shows the default setting for K\ :sub:`P`. CV_54 & CV_55 are used to set K\ :sub:`P` @ x\ :sub:`0`, CV_56 & CV_57 for K\ :sub:`P` @ x\ :sub:`1`, and CV_58 & CV_59 for K\ :sub:`P` @ x\ :sub:`2`. Additionally, CV_60 is used to shift x\ :sub:`1` from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255). + +.. _feed_forward: + Feed-forward ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/sphinx/html/_static/dark_mode_css/custom.css b/sphinx/html/_static/dark_mode_css/custom.css deleted file mode 100644 index 989c2ad..0000000 --- a/sphinx/html/_static/dark_mode_css/custom.css +++ /dev/null @@ -1,77 +0,0 @@ -.wy-side-nav-search input[type='text'] { - border-radius: 3px; -} - -input[type='color'], -input[type='date'], -input[type='datetime-local'], -input[type='datetime'], -input[type='email'], -input[type='month'], -input[type='number'], -input[type='password'], -input[type='search'], -input[type='tel'], -input[type='text'], -input[type='time'], -input[type='url'], -input[type='week'] { - box-shadow: none; -} - -.theme-switcher { - border-radius: 50%; - position: fixed; - right: 1.6em; - bottom: 1.4em; - z-index: 3; - border: none; - height: 2.2em; - width: 2.2em; - background-color: #fcfcfc; - font-size: 20px; - -webkit-box-shadow: 0px 3px 14px 4px rgba(0, 0, 0, 0.62); - box-shadow: 0px 3px 14px 4px rgba(0, 0, 0, 0.62); - color: #404040; - transition: all 0.3s ease-in-out; -} - -.wy-nav-content a, -.wy-nav-content a:visited { - color: #3091d1; -} - -body, -.wy-nav-content-wrap, -.wy-nav-content, -.section, -.highlight, -.rst-content div[class^='highlight'], -.wy-nav-content a, -.btn-neutral, -.btn, -footer, -.wy-nav-side, -.wy-menu-vertical li, -.wy-menu-vertical a, -.wy-side-nav-search .wy-dropdown, -.wy-side-nav-search a, -.wy-side-nav-search input, -html.writer-html4 .rst-content dl:not(.docutils) > dt, -html.writer-html5 - .rst-content - dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) - > dt, -.rst-content code, -.rst-content tt, -html.writer-html4 .rst-content dl:not(.docutils) dl:not(.field-list) > dt, -html.writer-html5 - .rst-content - dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) - dl:not(.field-list) - > dt, -code, -.rst-content code.xref, -.rst-content tt.xref { - transition: all 0.2s ease-in-out; -} diff --git a/sphinx/html/_static/dark_mode_css/dark.css b/sphinx/html/_static/dark_mode_css/dark.css deleted file mode 100644 index e863889..0000000 --- a/sphinx/html/_static/dark_mode_css/dark.css +++ /dev/null @@ -1,520 +0,0 @@ -:root { - --dark-text-color: #c1c1c1; - --dark-link-color: #249ee8; -} - -html[data-theme="dark"] body { - color: #bfbfbf; -} - -html[data-theme="dark"] .wy-nav-content-wrap { - background-color: #101010; -} - -html[data-theme="dark"] .wy-nav-content { - background-color: #141414; -} - -html[data-theme="dark"] .section { - color: var(--dark-text-color); -} - -html[data-theme="dark"] .highlight { - background-color: #17181c; -} - -html[data-theme="dark"] .highlight .nn { - color: var(--dark-text-color); -} - -html[data-theme="dark"] .highlight .nb { - color: #8bb8df; -} - -html[data-theme="dark"] .highlight .nv { - color: #40ffff; -} - -html[data-theme="dark"] .highlight .kn, -html[data-theme="dark"] .highlight .kc, -html[data-theme="dark"] .highlight .k { - color: #41c2ea; -} - -html[data-theme="dark"] .highlight .s1, -html[data-theme="dark"] .highlight .s2 { - color: #b3e87f; -} - -html[data-theme="dark"] .highlight .nt { - color: #ccb350; -} - -html[data-theme="dark"] .highlight .c1 { - color: #686868; -} - -html[data-theme="dark"] .highlight .hll { - background-color: #002c4d; -} - -html[data-theme="dark"] .rst-content div[class^="highlight"] { - border-color: #1a1a1a; -} - -html[data-theme="dark"] .wy-nav-content a, -html[data-theme="dark"] .wy-nav-content a:visited { - color: var(--dark-link-color); -} - -html[data-theme="dark"] .btn-neutral { - background-color: #17181c !important; -} - -html[data-theme="dark"] .btn-neutral:hover { - background-color: #101114 !important; -} - -html[data-theme="dark"] .btn-neutral:visited { - color: #c1c1c1 !important; -} - -html[data-theme="dark"] .btn { - box-shadow: none; -} - -html[data-theme="dark"] footer { - color: #bdbdbd; -} - -html[data-theme="dark"] .wy-nav-side { - background-color: #0d0d0d; -} - -html[data-theme="dark"] .wy-menu-vertical li.current { - background-color: #141414; -} - -html[data-theme="dark"] .wy-menu-vertical li.current > a, -html[data-theme="dark"] .wy-menu-vertical li.on a { - background-color: #141415; - color: var(--dark-text-color); -} - -html[data-theme="dark"] .wy-menu-vertical li.toctree-l1.current > a, -html[data-theme="dark"] .wy-menu-vertical li.current a { - border-color: #0b0c0d; -} - -html[data-theme="dark"] .wy-menu-vertical li.current a { - color: #bbb; -} - -html[data-theme="dark"] .wy-menu-vertical li.current a:hover { - background-color: #222; -} - -html[data-theme="dark"] .wy-menu-vertical a:hover, -html[data-theme="dark"] .wy-menu-vertical li.current > a:hover, -html[data-theme="dark"] .wy-menu-vertical li.on a:hover { - background-color: #1e1e1e; -} - -html[data-theme="dark"] .wy-menu-vertical li.toctree-l2.current > a, -html[data-theme="dark"] - .wy-menu-vertical - li.toctree-l2.current - li.toctree-l3 - > a { - background-color: #18181a; -} - -html[data-theme="dark"] .wy-side-nav-search { - background-color: #0b152d; -} - -html[data-theme="dark"] .wy-side-nav-search .wy-dropdown > a, -html[data-theme="dark"] .wy-side-nav-search > a { - color: #ddd; -} - -html[data-theme="dark"] .wy-side-nav-search input[type="text"] { - border-color: #111; - background-color: #141414; - color: var(--dark-text-color); -} - -html[data-theme="dark"] .theme-switcher { - background-color: #0b0c0d; - color: var(--dark-text-color); -} - -html[data-theme="dark"].writer-html4 .rst-content dl:not(.docutils) > dt, -html[data-theme="dark"].writer-html5 - .rst-content - dl[class]:not(.option-list):not(.field-list):not(.footnote):not( - .glossary - ):not(.simple) - > dt { - background-color: #0b0b0b; - color: #007dce; - border-color: #282828; -} - -html[data-theme="dark"] .rst-content code, -html[data-theme="dark"] .rst-content tt { - color: var(--dark-text-color); -} - -html[data-theme="dark"].writer-html4 - .rst-content - dl:not(.docutils) - dl:not(.field-list) - > dt, -html[data-theme="dark"].writer-html5 - .rst-content - dl[class]:not(.option-list):not(.field-list):not(.footnote):not( - .glossary - ):not(.simple) - dl:not(.field-list) - > dt { - background-color: #0f0f0f; - color: #959595; - border-color: #2b2b2b; -} - -html[data-theme="dark"] .rst-content code, -html[data-theme="dark"] .rst-content tt, -html[data-theme="dark"] code { - background-color: #2d2d2d; - border-color: #1c1c1c; -} - -html[data-theme="dark"] .rst-content code.xref, -html[data-theme="dark"] .rst-content tt.xref, -html[data-theme="dark"] a .rst-content code, -html[data-theme="dark"] a .rst-content tt { - color: #cecece; -} - -html[data-theme="dark"] .rst-content .hint, -html[data-theme="dark"] .rst-content .important, -html[data-theme="dark"] .rst-content .tip, -html[data-theme="dark"] .rst-content .wy-alert-success.admonition, -html[data-theme="dark"] .rst-content .wy-alert-success.admonition-todo, -html[data-theme="dark"] .rst-content .wy-alert-success.attention, -html[data-theme="dark"] .rst-content .wy-alert-success.caution, -html[data-theme="dark"] .rst-content .wy-alert-success.danger, -html[data-theme="dark"] .rst-content .wy-alert-success.error, -html[data-theme="dark"] .rst-content .wy-alert-success.note, -html[data-theme="dark"] .rst-content .wy-alert-success.seealso, -html[data-theme="dark"] .rst-content .wy-alert-success.warning, -html[data-theme="dark"] .wy-alert.wy-alert-success { - background-color: #00392e; -} - -html[data-theme="dark"] .rst-content .hint .admonition-title, -html[data-theme="dark"] .rst-content .hint .wy-alert-title, -html[data-theme="dark"] .rst-content .important .admonition-title, -html[data-theme="dark"] .rst-content .important .wy-alert-title, -html[data-theme="dark"] .rst-content .tip .admonition-title, -html[data-theme="dark"] .rst-content .tip .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.admonition-todo - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.admonition-todo - .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.admonition - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.admonition - .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.attention - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.attention - .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.caution - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-success.caution .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-success.danger .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-success.danger .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-success.error .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-success.error .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-success.note .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-success.note .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.seealso - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-success.seealso .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-success.warning - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-success.warning .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert.wy-alert-success - .admonition-title, -html[data-theme="dark"] - .wy-alert.wy-alert-success - .rst-content - .admonition-title, -html[data-theme="dark"] .wy-alert.wy-alert-success .wy-alert-title { - background-color: #006a56; -} - -html[data-theme="dark"] .rst-content .admonition, -html[data-theme="dark"] .rst-content .note, -html[data-theme="dark"] .rst-content .seealso, -html[data-theme="dark"] .rst-content .wy-alert-info.admonition, -html[data-theme="dark"] .rst-content .wy-alert-info.admonition-todo, -html[data-theme="dark"] .rst-content .wy-alert-info.attention, -html[data-theme="dark"] .rst-content .wy-alert-info.caution, -html[data-theme="dark"] .rst-content .wy-alert-info.danger, -html[data-theme="dark"] .rst-content .wy-alert-info.error, -html[data-theme="dark"] .rst-content .wy-alert-info.hint, -html[data-theme="dark"] .rst-content .wy-alert-info.important, -html[data-theme="dark"] .rst-content .wy-alert-info.tip, -html[data-theme="dark"] .rst-content .wy-alert-info.warning, -html[data-theme="dark"] .wy-alert.wy-alert-info { - background-color: #002c4d; -} - -html[data-theme="dark"] .rst-content .admonition .admonition-title, -html[data-theme="dark"] .rst-content .note .admonition-title, -html[data-theme="dark"] .rst-content .note .wy-alert-title, -html[data-theme="dark"] .rst-content .seealso .admonition-title, -html[data-theme="dark"] .rst-content .seealso .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-info.admonition-todo - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-info.admonition-todo - .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-info.admonition - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.admonition .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.attention .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.attention .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.caution .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.caution .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.danger .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.danger .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.error .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.error .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.hint .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.hint .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.important .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.important .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.tip .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.tip .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-info.warning .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-info.warning .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert.wy-alert-info .admonition-title, -html[data-theme="dark"] .wy-alert.wy-alert-info .rst-content .admonition-title, -html[data-theme="dark"] .wy-alert.wy-alert-info .wy-alert-title { - background-color: #004a7b; -} - -html[data-theme="dark"] .rst-content .admonition-todo, -html[data-theme="dark"] .rst-content .attention, -html[data-theme="dark"] .rst-content .caution, -html[data-theme="dark"] .rst-content .warning, -html[data-theme="dark"] .rst-content .wy-alert-warning.admonition, -html[data-theme="dark"] .rst-content .wy-alert-warning.danger, -html[data-theme="dark"] .rst-content .wy-alert-warning.error, -html[data-theme="dark"] .rst-content .wy-alert-warning.hint, -html[data-theme="dark"] .rst-content .wy-alert-warning.important, -html[data-theme="dark"] .rst-content .wy-alert-warning.note, -html[data-theme="dark"] .rst-content .wy-alert-warning.seealso, -html[data-theme="dark"] .rst-content .wy-alert-warning.tip, -html[data-theme="dark"] .wy-alert.wy-alert-warning { - background-color: #533500; -} - -html[data-theme="dark"] .rst-content .admonition-todo .admonition-title, -html[data-theme="dark"] .rst-content .admonition-todo .wy-alert-title, -html[data-theme="dark"] .rst-content .attention .admonition-title, -html[data-theme="dark"] .rst-content .attention .wy-alert-title, -html[data-theme="dark"] .rst-content .caution .admonition-title, -html[data-theme="dark"] .rst-content .caution .wy-alert-title, -html[data-theme="dark"] .rst-content .warning .admonition-title, -html[data-theme="dark"] .rst-content .warning .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-warning.admonition - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-warning.admonition - .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.danger .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.danger .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.error .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.error .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.hint .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.hint .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-warning.important - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-warning.important - .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.note .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.note .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-warning.seealso - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.seealso .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.tip .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-warning.tip .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert.wy-alert-warning - .admonition-title, -html[data-theme="dark"] - .wy-alert.wy-alert-warning - .rst-content - .admonition-title, -html[data-theme="dark"] .wy-alert.wy-alert-warning .wy-alert-title { - background-color: #803b00; -} - -html[data-theme="dark"] .rst-content .danger, -html[data-theme="dark"] .rst-content .error, -html[data-theme="dark"] .rst-content .wy-alert-danger.admonition, -html[data-theme="dark"] .rst-content .wy-alert-danger.admonition-todo, -html[data-theme="dark"] .rst-content .wy-alert-danger.attention, -html[data-theme="dark"] .rst-content .wy-alert-danger.caution, -html[data-theme="dark"] .rst-content .wy-alert-danger.hint, -html[data-theme="dark"] .rst-content .wy-alert-danger.important, -html[data-theme="dark"] .rst-content .wy-alert-danger.note, -html[data-theme="dark"] .rst-content .wy-alert-danger.seealso, -html[data-theme="dark"] .rst-content .wy-alert-danger.tip, -html[data-theme="dark"] .rst-content .wy-alert-danger.warning, -html[data-theme="dark"] .wy-alert.wy-alert-danger { - background-color: #82231a; -} - -html[data-theme="dark"] .rst-content .danger .admonition-title, -html[data-theme="dark"] .rst-content .danger .wy-alert-title, -html[data-theme="dark"] .rst-content .error .admonition-title, -html[data-theme="dark"] .rst-content .error .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-danger.admonition-todo - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-danger.admonition-todo - .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-danger.admonition - .admonition-title, -html[data-theme="dark"] - .rst-content - .wy-alert-danger.admonition - .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-danger.attention - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.attention .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.caution .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.caution .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.hint .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.hint .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert-danger.important - .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.important .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.note .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.note .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.seealso .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.seealso .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.tip .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.tip .wy-alert-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.warning .admonition-title, -html[data-theme="dark"] .rst-content .wy-alert-danger.warning .wy-alert-title, -html[data-theme="dark"] - .rst-content - .wy-alert.wy-alert-danger - .admonition-title, -html[data-theme="dark"] - .wy-alert.wy-alert-danger - .rst-content - .admonition-title, -html[data-theme="dark"] .wy-alert.wy-alert-danger .wy-alert-title { - background-color: #b9372b; -} - -html[data-theme="dark"] .wy-nav-top { - background-color: #0b152d; -} - -html[data-theme="dark"] .rst-content table.docutils thead, -html[data-theme="dark"] .rst-content table.field-list thead, -html[data-theme="dark"] .wy-table thead { - color: var(--dark-text-color); -} - -html[data-theme="dark"] - .rst-content - table.docutils:not(.field-list) - tr:nth-child(2n-1) - td, -html[data-theme="dark"] .wy-table-backed, -html[data-theme="dark"] html[data-theme="dark"] .wy-table-odd td, -html[data-theme="dark"] .wy-table-striped tr:nth-child(2n-1) td { - background-color: #181818; -} - -html[data-theme="dark"] .rst-content table.docutils td, -html[data-theme="dark"] .wy-table-bordered-all td, -html[data-theme="dark"].writer-html5 .rst-content table.docutils th, -html[data-theme="dark"] .rst-content table.docutils, -html[data-theme="dark"] .wy-table-bordered-all { - border-color: #262626; -} - -html[data-theme="dark"] .rst-content table.docutils caption, -html[data-theme="dark"] .rst-content table.field-list caption, -html[data-theme="dark"] .wy-table caption { - color: var(--dark-text-color); -} - -html[data-theme="dark"] .wy-menu-vertical li.toctree-l3.current > a, -html[data-theme="dark"] - .wy-menu-vertical - li.toctree-l3.current - li.toctree-l4 - > a { - background-color: #18181a; -} - -html[data-theme="dark"] .guilabel { - background-color: #343434; - border-color: #4d4d4d; -} diff --git a/sphinx/html/_static/dark_mode_css/general.css b/sphinx/html/_static/dark_mode_css/general.css deleted file mode 100644 index aa614f8..0000000 --- a/sphinx/html/_static/dark_mode_css/general.css +++ /dev/null @@ -1,68 +0,0 @@ -input[type='color'], -input[type='date'], -input[type='datetime-local'], -input[type='datetime'], -input[type='email'], -input[type='month'], -input[type='number'], -input[type='password'], -input[type='search'], -input[type='tel'], -input[type='text'], -input[type='time'], -input[type='url'], -input[type='week'] { - box-shadow: none; -} - -.theme-switcher { - border-radius: 50%; - position: fixed; - right: 1.6em; - bottom: 1.4em; - z-index: 3; - border: none; - height: 2.2em; - width: 2.2em; - background-color: #fcfcfc; - font-size: 20px; - -webkit-box-shadow: 0px 3px 14px 4px rgba(0, 0, 0, 0.62); - box-shadow: 0px 3px 14px 4px rgba(0, 0, 0, 0.62); - color: #404040; - transition: all 0.3s ease-in-out; -} - -body, -.wy-nav-content-wrap, -.wy-nav-content, -.section, -.highlight, -.rst-content div[class^='highlight'], -.wy-nav-content a, -.btn-neutral, -.btn, -footer, -.wy-nav-side, -.wy-menu-vertical li, -.wy-menu-vertical a, -.wy-side-nav-search .wy-dropdown, -.wy-side-nav-search a, -.wy-side-nav-search input, -html.writer-html4 .rst-content dl:not(.docutils) > dt, -html.writer-html5 - .rst-content - dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) - > dt, -.rst-content code, -.rst-content tt, -html.writer-html4 .rst-content dl:not(.docutils) dl:not(.field-list) > dt, -html.writer-html5 - .rst-content - dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) - dl:not(.field-list) - > dt, -code, -.rst-content code.xref, -.rst-content tt.xref { - transition: all 0.2s ease-in-out; -} diff --git a/sphinx/html/_static/dark_mode_js/default_dark.js b/sphinx/html/_static/dark_mode_js/default_dark.js deleted file mode 100644 index ea63e07..0000000 --- a/sphinx/html/_static/dark_mode_js/default_dark.js +++ /dev/null @@ -1,13 +0,0 @@ -const loadTheme = () => { - let theme = localStorage.getItem('theme'); - - if (theme !== null) { - if (theme === 'dark') - document.documentElement.setAttribute('data-theme', 'dark'); - } else { - localStorage.setItem('theme', 'dark'); - document.documentElement.setAttribute('data-theme', 'dark'); - } -}; - -loadTheme(); diff --git a/sphinx/html/_static/dark_mode_js/default_light.js b/sphinx/html/_static/dark_mode_js/default_light.js deleted file mode 100644 index 2b19f92..0000000 --- a/sphinx/html/_static/dark_mode_js/default_light.js +++ /dev/null @@ -1,13 +0,0 @@ -const loadTheme = () => { - let theme = localStorage.getItem('theme'); - - if (theme !== null) { - if (theme === 'dark') - document.documentElement.setAttribute('data-theme', 'dark'); - } else { - localStorage.setItem('theme', 'light'); - document.documentElement.setAttribute('data-theme', 'light'); - } -}; - -loadTheme(); diff --git a/sphinx/html/_static/dark_mode_js/theme_switcher.js b/sphinx/html/_static/dark_mode_js/theme_switcher.js deleted file mode 100644 index 8e26055..0000000 --- a/sphinx/html/_static/dark_mode_js/theme_switcher.js +++ /dev/null @@ -1,39 +0,0 @@ -const createThemeSwitcher = () => { - let btn = document.createElement('BUTTON'); - btn.className = 'theme-switcher'; - btn.id = 'themeSwitcher'; - btn.innerHTML = - ''; - document.body.appendChild(btn); - - if (localStorage.getItem('theme') === 'dark') $('#themeMoon').hide(0); - else $('#themeSun').hide(0); -}; - -$(document).ready(() => { - createThemeSwitcher(); - $('#themeSwitcher').click(switchTheme); - - $('footer').html( - $('footer').html() + - 'Dark theme provided by MrDogeBro.' - ); -}); - -const switchTheme = () => { - if (localStorage.getItem('theme') === 'dark') { - localStorage.setItem('theme', 'light'); - document.documentElement.setAttribute('data-theme', 'light'); - - $('#themeSun').fadeOut(200, () => { - $('#themeMoon').fadeIn(200); - }); - } else { - localStorage.setItem('theme', 'dark'); - document.documentElement.setAttribute('data-theme', 'dark'); - - $('#themeMoon').fadeOut(200, () => { - $('#themeSun').fadeIn(200); - }); - } -}; diff --git a/sphinx/html/genindex.html b/sphinx/html/genindex.html index 9a8c058..6729ffc 100644 --- a/sphinx/html/genindex.html +++ b/sphinx/html/genindex.html @@ -8,8 +8,6 @@ Index — RP2040-Decoder 0.3, 1.0 documentation - - @@ -17,8 +15,6 @@ - - @@ -49,7 +45,6 @@
  • Hardware
  • Software
  • Other
  • -
  • Troubleshooting
  • @@ -79,8 +74,970 @@

    Index

    + _ + | A + | B + | C + | D + | E + | F + | G + | I + | L + | M + | P + | R + | S + | T + | U + | V + | W
    +

    _

    + + +
    + +

    A

    + + + +
    + +

    B

    + + + +
    + +

    C

    + + + +
    + +

    D

    + + + +
    + +

    E

    + + + +
    + +

    F

    + + + +
    + +

    G

    + + + +
    + +

    I

    + + + +
    + +

    L

    + + +
    + +

    M

    + + + +
    + +

    P

    + + + +
    + +

    R

    + + + +
    + +

    S

    + + + +
    + +

    T

    + + + +
    + +

    U

    + + +
    + +

    V

    + + + +
    + +

    W

    + + + +
    + diff --git a/sphinx/html/hardware/index.html b/sphinx/html/hardware/index.html index 05cb2ce..0b92be3 100644 --- a/sphinx/html/hardware/index.html +++ b/sphinx/html/hardware/index.html @@ -9,8 +9,6 @@ Hardware — RP2040-Decoder 0.3, 1.0 documentation - - @@ -18,8 +16,6 @@ - - @@ -54,6 +50,7 @@
  • Overview
  • Electrical Characteristics
  • Input Stage
  • +
  • Motor Driver
  • Auxiliary Outputs
  • GPIO
  • Microcontroller
  • @@ -79,7 +76,6 @@
  • Software
  • Other
  • -
  • Troubleshooting
  • @@ -115,6 +111,7 @@
  • Overview
  • Electrical Characteristics
  • Input Stage
  • +
  • Motor Driver
  • Auxiliary Outputs
  • GPIO
  • Microcontroller
  • diff --git a/sphinx/html/hardware/rev_0_3/hw_description.html b/sphinx/html/hardware/rev_0_3/hw_description.html index 2c73350..59a1c0e 100644 --- a/sphinx/html/hardware/rev_0_3/hw_description.html +++ b/sphinx/html/hardware/rev_0_3/hw_description.html @@ -9,8 +9,6 @@ Overview — RP2040-Decoder 0.3, 1.0 documentation - - @@ -18,8 +16,6 @@ - - @@ -60,11 +56,7 @@
  • GPIO
  • Microcontroller
  • Complete Schematic
  • -
  • BOM & Alternative Parts -
  • +
  • BOM & Alternative Parts
  • Wiring the Decoder
  • @@ -72,7 +64,6 @@
  • Software
  • Other
  • -
  • Troubleshooting
  • @@ -159,7 +150,7 @@

    Absolute max. DCC Input Voltage difference

    VDCC

    - +

    0

    +24

    V

    @@ -204,6 +195,10 @@

    (0): According to: RP2040 Datasheet (assuming VDD= 3.3V)

    (1): According to: BDR6133 Datasheet

    (2): According to: T2N7002BK Datasheet

    +
    +

    Note

    +

    Keep in mind that realistically these maximum ratings can’t be reached in practice due to thermal limitations. For example the motor current can probably not exceed 1.5A for continuous operation.

    +

    Input Stage

    @@ -261,133 +256,15 @@

    BOM & Alternative Parts

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    BOM

    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

    VRMS=40V, IF=2A

    Bridge Rectifier

    KMB24F

    MBS (TO-269AA)

    Q1, Q2, Q3, Q4, Q5

    5

    VDS=60V, ID=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

    VOUT=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 Vmax in mind!

    -
    -

    Alternatives for BDR6133:

    - -
    -
    -

    Alternative for HT7533S:

    - -
    +

    please see PLACEHOLDER-AUTOGENERATED-BOM for the complete BOM.

    Wiring the Decoder

    -
    +
    Wiring Diagram
    -

    Wiring Diagram

    +

    Wiring Diagram

    The illustration above provides an example of a wiring configuration. diff --git a/sphinx/html/hardware/rev_1_0/hw_description.html b/sphinx/html/hardware/rev_1_0/hw_description.html index c0e1043..12be8d2 100644 --- a/sphinx/html/hardware/rev_1_0/hw_description.html +++ b/sphinx/html/hardware/rev_1_0/hw_description.html @@ -9,8 +9,6 @@ Overview — RP2040-Decoder 0.3, 1.0 documentation - - @@ -18,8 +16,6 @@ - - @@ -54,15 +50,12 @@

  • Overview
  • Electrical Characteristics
  • Input Stage
  • +
  • Motor Driver
  • Auxiliary Outputs
  • GPIO
  • Microcontroller
  • Complete Schematic
  • -
  • BOM & Alternative Parts -
  • +
  • BOM & Alternative Parts
  • Wiring the Decoder
  • @@ -71,7 +64,6 @@
  • Software
  • Other
  • -
  • Troubleshooting
  • @@ -205,6 +197,10 @@

    (1): According to: BDR6133 Datasheet

    (2): According to: Si1308EDL Datasheet

    (3): TCase= 25°C, keep power dissipation, thermal resistance the corresponding temperature rise ΔT and switching losses in PWM mode in mind!

    +
    +

    Note

    +

    Keep in mind that realistically these maximum ratings can’t be reached in practice due to thermal limitations. For example the motor current can probably not exceed 1.5A for continuous operation.

    +

    Input Stage

    @@ -214,10 +210,11 @@

    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 (VGS> VGS,th), GPIO21 gets pulled to GND potential. R1 and R2 ensure that VGSdoesn’t exceed ±12V. -Motor Driver -==============================

    +

    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, meaning that the decoder can be powered either by the DCC track signal or by the VBUS supply voltage which is supplied via USB connector.

    +

    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 (VGS> VGS,th), GPIO21 gets pulled to GND potential. R1 and R2 ensure that VGSdoesn’t exceed ±12V.

    +
    +
    +

    Motor Driver

    Motor Driver
    @@ -261,133 +258,15 @@ Motor Driver

    BOM & Alternative Parts

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    BOM

    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

    VRMS=40V, IF=2A

    Bridge Rectifier

    KMB24F

    MBS (TO-269AA)

    Q1, Q2, Q3, Q4, Q5

    5

    VDS=60V, ID=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

    VOUT=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 Vmax in mind!

    -
    -

    Alternatives for BDR6133:

    - -
    -
    -

    Alternative for HT7533S:

    - -
    +

    please see PLACEHOLDER-AUTOGENERATED-BOM for the complete BOM.

    Wiring the Decoder

    -
    +
    Wiring Diagram
    -

    Wiring Diagram

    +

    Wiring Diagram

    The illustration above provides an example of a wiring configuration. diff --git a/sphinx/html/index.html b/sphinx/html/index.html index bc7362e..96213b6 100644 --- a/sphinx/html/index.html +++ b/sphinx/html/index.html @@ -9,8 +9,6 @@ RP2040-Decoder Documentation — RP2040-Decoder 0.3, 1.0 documentation - - @@ -19,8 +17,6 @@ - - @@ -52,7 +48,6 @@

  • Hardware
  • Software
  • Other
  • -
  • Troubleshooting
  • @@ -88,27 +83,156 @@
  • 1. Where to get the board?
  • 2. Production files?
  • 3. Building the software
  • -
  • 4. Flashing the software
  • +
  • 4. Flashing the software +
  • 5. Wiring
  • 6. Resolving issues
  • Hardware
  • Software
  • diff --git a/sphinx/html/objects.inv b/sphinx/html/objects.inv index 92cda94..d46e8d6 100644 Binary files a/sphinx/html/objects.inv and b/sphinx/html/objects.inv differ diff --git a/sphinx/html/other/CV_list.html b/sphinx/html/other/CV_list.html deleted file mode 100644 index 22d0e9a..0000000 --- a/sphinx/html/other/CV_list.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - - Configuration Variables (CV) — RP2040-Decoder 0.3, 1.0 documentation - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -

    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. Alternatively to reset all CVs to default a value of 8 can be written to CV8. Also note that index 0 in the CV array corresponds with CV_1, index 1 corresponds with CV_2 and so forth. This list only contains CVs that are in use.

    -
    -
    -

    Speed step configuration

    -

    Speed Table

    -
      -
    • V_min = CV_2

    • -
    • V_mid = CV_6 * 16

    • -
    • V_max = CV_5 * 16

    • -
    -

    The illustration above shows how the speed steps can be configured using the corresponding CVs. The red * represents V_min which is always at speed step 1, the green * shows V_mid at speed step 64 and the blue * shows V_max at speed step 126.

    -
    -
    -

    CV List

    -
    -

    CV_1 - Basic address

    -

    Short DCC address

    -
    -
    -

    CV_2 - V_min

    -

    Min motor voltage/speed

    -
    -
    -

    CV_3 - Acceleration rate

    -

    CV_3*CV_175 = Time for one discrete speed step change in ms

    -
    -
    -

    CV_4 - Deceleration rate

    -

    CV_4*CV_175 = Time for one discrete speed step change in ms

    -
    -
    -

    CV_5 - V_max

    -

    Max motor voltage/speed - V_max = CV_5 * 16

    -
    -
    -

    CV_6 - V_mid

    -

    Mid motor voltage/speed - V_max = CV_6 * 16

    -
    -
    -

    CV_7 - Version No. (Read-Only)

    -

    Rev 0.3 = 1

    -

    Writing a value of 7 triggers am ADC offset adjustment.

    -
    -
    -

    CV_8 - Manufacturer (Read-Only)

    -

    Default = “13” = Public Domain & Do-It-Yourself Decoders

    -

    Writing a value of 8 resets all CV values to the default values in CV.h. -This will also happen if CV_65 == “255” == “0xFF”.

    -
    -
    -

    CV_9 - Motor PWM Frequency

    -

    f in Hz = CV_9 * 100 + 10000

    -
    -
    -

    CV_11 - Packet timeout

    -

    If no package is received for x seconds (x = CV_11) the decoder will automatically stop the motor (Emergency Stop).

    -
    -
    -

    CV_12 - Permitted operating modes

    -

    Currently DCC Digital mode is the only supported mode.

    -
    -
    -

    CV_17 & CV_18 - 14-Bit extended/long address

    -

    Address is only used if bit5 has a value of “1” in CV_29.

    -

    Long Address

    -

    Bit15 and bit14 which correspond to bit7 and bit6 of CV_17 are always “1”. CV_17 = “192” & CV_18 = “0” is also not a valid address. Otherwise the valid value range of CV_17 ranges from “192” to “231” and “0” to “255” for CV_18 respectively.

    -
    -
    -

    CV_29 - Decoder Configuration

    -

    Bit0 is used to reverse 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.

    -
    -
    -

    CV_31 & CV_32 - Extended CV pointer (Read-Only)

    -

    Not in use.

    -
    -
    -

    CV_47 - Feed-forward gain k_ff

    -

    k_ff defines the correction behavior with regard to the y2 variable. High values for k_ff lead to a faster change in the variable. Values for k_ff that are too high can lead to oscillations. -k_ff = CV_47/10000

    -
    -
    -

    CV_48 - Filter time constant (tau) in ms

    -

    The time constant tau characterizes the low-pass filter which is connected downstream in the D component of the PID controller

    -
    -
    -

    CV_49 - PID Control sampling time t in ms

    -

    Every t seconds the pid_control() function gets called to compute the new control output

    -
    -
    -

    CV_50 - PID Control I Factor

    -

    Integral gain factor of the PID-Controller

    -
    -
    -

    CV_51 - PID Control D Factor

    -

    Derivative gain factor of the PID-Controller

    -
    -
    -

    CV_52 & CV_53 - PID Integral Limits

    -

    Maximum and minimum integral part values

    -
    -
    -

    CV_54 & CV_55 - Gain scheduling config k_p @ x0

    -

    CV_54 - High Byte – CV_55 - Low Byte

    -
    -
    -

    CV_56 & CV_57 - Gain scheduling config k_p @ x1

    -

    CV_56 - High Byte – CV_57 - Low Byte

    -
    -
    -

    CV_58 & CV_59 - Gain scheduling config k_p @ x2

    -

    CV_58 - High Byte – CV_59 - Low Byte

    -
    -
    -

    CV_60 - Gain scheduling config x1 shift percentage

    -

    Determines position of x1 in percent -> x1 shift in % ≙ CV_60/255

    -
    -
    -

    CV_61 - Measurement Iterations

    -

    Total amount of BEMF-Voltage measurement iterations

    -
    -
    -

    CV_62 - Measurement Delay

    -

    BEMF-Voltage measurement delay

    -
    -
    -

    CV_63 & CV_64 - Measurement array cutoffs

    -

    CV_63 determines how many elements from the left side (beginning with index 0) of the array will be discarded while CV_64 determines how many elements from the right side (beginning from highest index) will be discarded.

    -
    -
    -

    CV_65 - New flash variable

    -

    Each Byte of the factory new flash chip should have a inital state of “0xFF”. This will be checked for in the beginning of core0.c (see cv_setup_check()). When CV_65 == “255” == “0xFF” the default config (CV.h) will be written to flash. Alternatively a reset to default can be done by either writing “8” to CV_8 or writing “255” to CV_65 which then triggers a reset on startup.

    -
    -
    -

    CV_112, CV_113, CV_114, CV_115 - GPIO PWM Configuration

    -

    PWM enabled “1” - PWM disabled “0”

    -
    -
    -

    CV_116 to CV_171 - PWM Slice configuration

    -

    GPIO Slices

    -

    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: fPWM = 125 MHz / [ (CVclk_div + 1) * (CVwrap + 1) ]

    -

    The duty-cycle can be calculated as follows: D = CVLevel / CVwrap + 1

    -

    Example configuration - (AUX2: PWM-Frequency fPWM = 10kHz; Duty-cycle D = 20%):

    -

    AUX1 => GPIO25 => Slice 4 / Channel B => Wrap: CV_144 & CV_145; Clock-divider: CV_146; Level(B): CV_149 & CV_150

    -

    => fPWM = 10kHz = 125 MHz / [ (0 + 1) * (12499 + 1) ];

    -

    => CV_144 = 110000, CV_145 = 11010011, CV_146 = 0; — (Note: “12499dec” = “11000011010011bin”)

    -

    => CVLevel = CV_149 & CV_150 = D * (CVwrap + 1) = 0.2 * 12500 = 2500

    -

    => CV_149 = 1001, CV_150 = 11000100; — (Note: “2500dec” = “100111000100bin”)

    -

    Another configuration which also achieves 10kHz and D = 20% would be CVclk_div = 10, CVwrap = 1249, CVLevel = 250.

    -

    A more detailed explanation regarding PWM can be found in the RP2040-Datasheet - Chapter 4.5.

    -
    -
    -

    CV_172 - ADC Offset

    -

    If CV_172 = “0xFF” = “255” there will be a measurement procedure on startup

    -
    -
    -

    CV_173 - ADC offset measurement cycles

    -

    Determines how many ADC offset measurement iterations are done.

    -
    -
    -

    CV_174 - Additional motor-PWM clock divider.

    -

    Additional Clock Divider - works the same as any GPIO clock divider

    -
    -
    -

    CV_175 - speed_helper timer delay

    -

    This timer delay can be used to change the time between two speed steps. So basically an additional option to adjust the deceleration and acceleration rate.

    -
    -
    -

    CV_176, CV_177, CV_178, CV_179 - Base PWM Level used in feed-forward control

    -

    CV_176 - High Byte forward – CV_177 - Low Byte forward – CV_178 - High Byte reverse – CV_179 - Low Byte reverse

    -

    These values are equivalent to y1(forward) and y1(reverse) mentioned here. Writing “0” to all four CVs schedules a new calibration on startup.

    -
    -
    -

    CV_257 to CV_512 - Function Mapping CVs

    -

    The switching status of the outputs depends both on the function instruction received and on the current direction of travel. That means you can, for example, use a function to switch two or more outputs or, as is usual with headlights, switch them depending on the direction of travel. For configuration, 32 bits (corresponding to the GPIOs) are available for each function in each direction of travel.

    -
    -
    -
    - - -
    -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/sphinx/html/other/getting_started.html b/sphinx/html/other/getting_started.html index f0785bf..c6ed4ad 100644 --- a/sphinx/html/other/getting_started.html +++ b/sphinx/html/other/getting_started.html @@ -9,8 +9,6 @@ Getting started — RP2040-Decoder 0.3, 1.0 documentation - - @@ -18,8 +16,6 @@ - - @@ -64,7 +60,6 @@
  • Hardware
  • Software
  • Other
  • -
  • Troubleshooting
  • diff --git a/sphinx/html/other/index.html b/sphinx/html/other/index.html index 87525ac..29b10f1 100644 --- a/sphinx/html/other/index.html +++ b/sphinx/html/other/index.html @@ -9,8 +9,6 @@ Other — RP2040-Decoder 0.3, 1.0 documentation - - @@ -18,13 +16,10 @@ - - - - + @@ -51,12 +46,9 @@
  • Getting started
  • Hardware
  • Software
  • -
  • Other @@ -86,16 +78,6 @@

    Other

    @@ -103,8 +85,7 @@