Ver código fonte

Merge branch 'docs/programming_guide_c3_update_twai' into 'master'

Update TWAI driver docs and registers for esp32c3

Closes IDF-2349

See merge request espressif/esp-idf!12935
Krzysztof Budzynski 4 anos atrás
pai
commit
d14661eaa3

+ 1 - 1
components/soc/esp32c3/include/soc/soc_caps.h

@@ -39,7 +39,7 @@
 
 /*-------------------------- TWAI CAPS ---------------------------------------*/
 #define SOC_TWAI_BRP_MIN                2
-#define SOC_TWAI_BRP_MAX                32768
+#define SOC_TWAI_BRP_MAX                16384
 #define SOC_TWAI_SUPPORTS_RX_STATUS     1
 
 /*--------------------------- SHA CAPS ---------------------------------------*/

+ 2 - 1
components/soc/esp32c3/include/soc/twai_struct.h

@@ -94,7 +94,8 @@ typedef volatile struct twai_dev_s {
     uint32_t reserved_05;                       /* Address 5 */
     union {
         struct {
-            uint32_t brp: 14;                   /* BTR0[13:0] Baud Rate Prescaler */
+            uint32_t brp: 13;                   /* BTR0[12:0] Baud Rate Prescaler */
+            uint32_t reserved1: 1;              /* Internal Reserved */
             uint32_t sjw: 2;                    /* BTR0[15:14] Synchronization Jump Width*/
             uint32_t reserved16: 16;            /* Internal Reserved */
         };

+ 1 - 1
components/soc/esp32s3/include/soc/twai_caps.h

@@ -19,7 +19,7 @@ extern "C" {
 #endif
 
 #define SOC_TWAI_BRP_MIN    2
-#define SOC_TWAI_BRP_MAX    32768
+#define SOC_TWAI_BRP_MAX    16384
 
 #define SOC_TWAI_SUPPORTS_RX_STATUS     1
 

+ 2 - 1
components/soc/esp32s3/include/soc/twai_struct.h

@@ -94,7 +94,8 @@ typedef volatile struct twai_dev_s {
     uint32_t reserved_05;                       /* Address 5 */
     union {
         struct {
-            uint32_t brp: 14;                   /* BTR0[13:0] Baud Rate Prescaler */
+            uint32_t brp: 13;                   /* BTR0[12:0] Baud Rate Prescaler */
+            uint32_t reserved1: 1;              /* Internal Reserved */
             uint32_t sjw: 2;                    /* BTR0[15:14] Synchronization Jump Width*/
             uint32_t reserved16: 16;            /* Internal Reserved */
         };

+ 7 - 1
docs/en/api-reference/peripherals/twai.rst

@@ -165,7 +165,7 @@ The operating bit rate of the TWAI driver is configured using the :cpp:type:`twa
     2. **Timing Segment 1** consists of 1 to 16 time quanta before sample point
     3. **Timing Segment 2** consists of 1 to 8 time quanta after sample point
 
-{IDF_TARGET_MAX_BRP:default="128", esp32="128", esp32s2="32768"}
+{IDF_TARGET_MAX_BRP:default="128", esp32="128", esp32s2="32768", esp32c3="16384"}
 
 The **Baudrate Prescaler** is used to determine the period of each time quantum by dividing the TWAI controller's source clock (80 MHz APB clock). On the {IDF_TARGET_NAME}, the ``brp`` can be **any even number from 2 to {IDF_TARGET_MAX_BRP}**.
 
@@ -202,6 +202,12 @@ Bit timing **macro initializers** are also available for commonly used bit rates
     :esp32s2: - ``TWAI_TIMING_CONFIG_10KBITS()``
     :esp32s2: - ``TWAI_TIMING_CONFIG_5KBITS()``
     :esp32s2: - ``TWAI_TIMING_CONFIG_1KBITS()``
+    :esp32c3: - ``TWAI_TIMING_CONFIG_20KBITS()``
+    :esp32c3: - ``TWAI_TIMING_CONFIG_16KBITS()``
+    :esp32c3: - ``TWAI_TIMING_CONFIG_12_5KBITS()``
+    :esp32c3: - ``TWAI_TIMING_CONFIG_10KBITS()``
+    :esp32c3: - ``TWAI_TIMING_CONFIG_5KBITS()``
+    :esp32c3: - ``TWAI_TIMING_CONFIG_1KBITS()``
 
 .. only:: esp32