UART 3 Stop bits is undefined
UART 3 Stop bits is undefined
In https://www.espressif.com/sites/default ... ual_en.pdf
UART_STOP_BIT_NUM This register is used to set the length of the stop bit; 1: 1 bit, 2: 1.5 bits. (R/W)
Defines stop bits for the URAT to be 1,1.5, and 2
this also aligns with the arduino drivers
typedef enum {
UART_STOP_BITS_1 = 0x1, /*!< stop bit: 1bit*/
UART_STOP_BITS_1_5 = 0x2, /*!< stop bit: 1.5bits*/
UART_STOP_BITS_2 = 0x3, /*!< stop bit: 2bits*/
UART_STOP_BITS_MAX = 0x4,
} uart_stop_bits_t;
However, 3 stop bits should be supported
13.3.5 UART Data Frame
Figure 13-3 shows the basic data frame structure. A data frame starts with a START condition and ends with a
STOP condition. The START condition requires 1 bit and the STOP condition can be realized using 1/1.5/2/3-bit
widths (as set by UART_STOP_BIT_NUM, UART_DL1_EN, and UAR_DL0_EN). The START is low level, while the
STOP is high level.
What are the register settings for 3 uart stop bits?
Thank you!
UART_STOP_BIT_NUM This register is used to set the length of the stop bit; 1: 1 bit, 2: 1.5 bits. (R/W)
Defines stop bits for the URAT to be 1,1.5, and 2
this also aligns with the arduino drivers
typedef enum {
UART_STOP_BITS_1 = 0x1, /*!< stop bit: 1bit*/
UART_STOP_BITS_1_5 = 0x2, /*!< stop bit: 1.5bits*/
UART_STOP_BITS_2 = 0x3, /*!< stop bit: 2bits*/
UART_STOP_BITS_MAX = 0x4,
} uart_stop_bits_t;
However, 3 stop bits should be supported
13.3.5 UART Data Frame
Figure 13-3 shows the basic data frame structure. A data frame starts with a START condition and ends with a
STOP condition. The START condition requires 1 bit and the STOP condition can be realized using 1/1.5/2/3-bit
widths (as set by UART_STOP_BIT_NUM, UART_DL1_EN, and UAR_DL0_EN). The START is low level, while the
STOP is high level.
What are the register settings for 3 uart stop bits?
Thank you!
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: UART 3 Stop bits is undefined
Looks like, as the text implies, you can use UART_DL1_EN and UAR_DL0_EN to add extra bits to the stop bit amount defined there. It's not super-well documented as devices rarely need 2 stop bits, let alone 3.
EDIT: This is wrong, look at the reply of my colleague below instead.
EDIT: This is wrong, look at the reply of my colleague below instead.
-
- Posts: 17
- Joined: Wed Jan 06, 2021 8:21 am
Re: UART 3 Stop bits is undefined
Hi there, I'm sorry for the trouble caused by the unclear register descriptions.
UART_STOP_BIT_NUM, which is used to set the length of stop bits, has 4 valid values. 0: 1 bits; 1: 2 bits; 2: 1.5 bits; 3: 3 bits.
UART_DL1_EN and UART_DL0_EN are used to set the turnaround delay as required by the RS485 protocol. It has nothing to do with the length of stop bits. This function is documented in Section 26.4.2 Turnaround Delay https://www.espressif.com/sites/default ... n#uart.pdf
I will update the descriptions in TRM in the next release.
UART_STOP_BIT_NUM, which is used to set the length of stop bits, has 4 valid values. 0: 1 bits; 1: 2 bits; 2: 1.5 bits; 3: 3 bits.
UART_DL1_EN and UART_DL0_EN are used to set the turnaround delay as required by the RS485 protocol. It has nothing to do with the length of stop bits. This function is documented in Section 26.4.2 Turnaround Delay https://www.espressif.com/sites/default ... n#uart.pdf
I will update the descriptions in TRM in the next release.
Re: UART 3 Stop bits is undefined
Thank you, but this doesn't seem to align with the code.
From your post
https://github.com/espressif/arduino-es ... rt_types.h (line 56)
Which translates to 0: undefined, 1: 1 bits; 2: 1.5 bits; 3: 2 bit. There is agreement that 2 means 1.5 stop bits, but the values for 0,1, and 3 are not in agreement.
Additionally, the current documentation on page 520
https://www.espressif.com/sites/default ... ual_en.pdf
says:
Is it possible 0 is used to represent 3 stop bits?
I am new the forum. Where should this be cross posted to hopefully getdata structure updated to include 3 stop bits and updated to handle it.
Thank you!
From your post
From the code I seeUART_STOP_BIT_NUM, which is used to set the length of stop bits, has 4 valid values. 0: 1 bits; 1: 2 bits; 2: 1.5 bits; 3: 3 bits.
https://github.com/espressif/arduino-es ... rt_types.h (line 56)
Code: Select all
typedef enum {
UART_STOP_BITS_1 = 0x1, /*!< stop bit: 1bit*/
UART_STOP_BITS_1_5 = 0x2, /*!< stop bit: 1.5bits*/
UART_STOP_BITS_2 = 0x3, /*!< stop bit: 2bits*/
UART_STOP_BITS_MAX = 0x4,
} uart_stop_bits_t;
Additionally, the current documentation on page 520
https://www.espressif.com/sites/default ... ual_en.pdf
says:
This also agrees with the code.UART_STOP_BIT_NUM This register is used to set the length of stop bit. 1: 1 bit. 2: 1.5 bits. 3: 2 bits. (R/W)
Is it possible 0 is used to represent 3 stop bits?
I am new the forum. Where should this be cross posted to hopefully get
Code: Select all
uart_stop_bit_t
Code: Select all
esp_err_t uart_set_stop_bits(uart_port_t uart_num, uart_stop_bits_t stop_bits)
Thank you!
Re: UART 3 Stop bits is undefined
Hi @ESP_wangning, do you have any thoughts or suggestions on the best next step to figure this out?
Thank you!
Thank you!
-
- Posts: 17
- Joined: Wed Jan 06, 2021 8:21 am
Re: UART 3 Stop bits is undefined
Sorry that I just noticed your reply!
It seems that there is some inconsistency between hardware and software. I'm checking and will keep you updated.
It seems that there is some inconsistency between hardware and software. I'm checking and will keep you updated.
-
- Posts: 17
- Joined: Wed Jan 06, 2021 8:21 am
Re: UART 3 Stop bits is undefined
Sorry that my previous explanation is wrong.
The length of stop bits can be 1, 1.5 or 2, configured by UART_STOP_BIT_NUM.
0: Invalid. No effect
1: 1 bits
2: 1.5 bits
3: 2 bits
In RS485 mode, you may add a turnaround delay of a bit before the start bit or after the stop bit, configured by UART_DL0_EN or UART_DL1_EN respectively. If you add one turnaround delay, this is actually what we mean by "3 stop bits".
You can add two turnaround delays before the start bit and after the stop bit at the same time, or in other words the "stop bits" can be 4 bits long at most.
We will make the descriptions clearer in the next TRM release.
The length of stop bits can be 1, 1.5 or 2, configured by UART_STOP_BIT_NUM.
0: Invalid. No effect
1: 1 bits
2: 1.5 bits
3: 2 bits
In RS485 mode, you may add a turnaround delay of a bit before the start bit or after the stop bit, configured by UART_DL0_EN or UART_DL1_EN respectively. If you add one turnaround delay, this is actually what we mean by "3 stop bits".
You can add two turnaround delays before the start bit and after the stop bit at the same time, or in other words the "stop bits" can be 4 bits long at most.
We will make the descriptions clearer in the next TRM release.
-
- Posts: 94
- Joined: Tue Sep 07, 2021 12:07 pm
Re: UART 3 Stop bits is undefined
Explanation of why 2 stop bits were needed for a mechanical TTY https://retrocomputing.stackexchange.com/a/631
Extra stop bit(s) might be needed to slow down a datastream, but it would be pretty unusual for hardware less than about 30 years old.
Extra stop bit(s) might be needed to slow down a datastream, but it would be pretty unusual for hardware less than about 30 years old.
Craige
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: UART 3 Stop bits is undefined
If you need this, possibly you can use the RMT peripheral to implement a semi-software UART?
Re: UART 3 Stop bits is undefined
Thank you! Sorry I missed your reply. I will look into the RMT. I am trying to use this to connect into a DMX data stream of a lighting console. The MTBF I think can be handled as an extra stop bit.
https://www.theatreartlife.com/staying- ... mystified/
https://www.theatreartlife.com/staying- ... mystified/
Who is online
Users browsing this forum: No registered users and 42 guests