Inverse UART output? (for WS2812 )
Inverse UART output? (for WS2812 )
Postby Lars R. » Tue Nov 04, 2014 9:27 pm
**********
********** EDIT: NOTE for those who try this: After the start-bit, the UART sends LSB first. **********
**********
Hi,
is it possible to inverse the output of the UART. Output 1 instead of 0 and 0 instead of 1.
Background of Question: Using the UART for controlling WS2812 after the following scheme:
(1)xx xxx xx(0).
UART with 7 data bits.
3 Bits of WS2812.
According to viewtopic.php?f=7&t=24 , UART seems to be fast enough.
thx and regards
Lars
********** EDIT: NOTE for those who try this: After the start-bit, the UART sends LSB first. **********
**********
Hi,
is it possible to inverse the output of the UART. Output 1 instead of 0 and 0 instead of 1.
Background of Question: Using the UART for controlling WS2812 after the following scheme:
(1)xx xxx xx(0).
UART with 7 data bits.
3 Bits of WS2812.
According to viewtopic.php?f=7&t=24 , UART seems to be fast enough.
thx and regards
Lars
Last edited by Lars R. on Thu Nov 06, 2014 5:22 am, edited 1 time in total.
Re: Inverse UART output? (for WS2812 )
Postby costaud » Wed Nov 05, 2014 1:44 am
At least you can build an inverse circuit by a transistor.
We will check the control register later.
This feature should add to the next generation !!
post it in the url below.
http://bbs.espressif.com/viewtopic.php?f=7&t=12
We will check the control register later.
This feature should add to the next generation !!
post it in the url below.
http://bbs.espressif.com/viewtopic.php?f=7&t=12
Re: Inverse UART output? (for WS2812 )
Postby costaud » Thu Nov 06, 2014 2:10 am
SET BIT22 OF UART_CONF0 REG, SO THAT THE TXD OUTPUT INVERSE
SET_PERI_REG_MASK(UART_CONF0(UART0) , BIT22);
0x20 UART_CONF0
uart_dtr_inv [24]
uart_rts_inv [23]
uart_txd_inv [22]
uart_dsr_inv [21]
uart_cts_inv [20]
uart_rxd_inv [19]
SET_PERI_REG_MASK(UART_CONF0(UART0) , BIT22);
0x20 UART_CONF0
uart_dtr_inv [24]
uart_rts_inv [23]
uart_txd_inv [22]
uart_dsr_inv [21]
uart_cts_inv [20]
uart_rxd_inv [19]
-
- Posts: 3
- Joined: Sat Oct 25, 2014 2:06 pm
Re: Inverse UART output? (for WS2812 )
Postby nicoverduin » Thu Nov 06, 2014 5:25 pm
As I am playing around a lot with the WS2812b.... Could UART actually be used as the pulse widths determine the "0" and "1"?
Re: Inverse UART output? (for WS2812 )
Postby Lars R. » Thu Nov 06, 2014 6:22 pm
nicoverduin wrote:As I am playoing around alot with the WS2812b.... Could UART actually be used as the pulse widths determine the "0" and "1"?
I don't now. But the idea in more detail is the following:
WB: Number of WS2812 Bits per UART Char
USYMB: UART Symbols per UART Char inclunging start-bit and stop-bit
WS: time of WS2812 short pulse
WL: time of WS2812 long pulse
UBAUD: Baudrate of UART
Sending USYMB Symbols within the time of WB*(WS+WL)
-> UBaud= 1/ ( WB*(WS+WL)/Usymb)
Example 1
WB=3 (3*8=24) -> 8 UART char per WS2812-LED
USYMB=9 -> 7 data bits
WS=0.4us
WL=0.8us
=> UBAUD= 2.5Mbps
Send the 3 WS2812 bits "011":
1. Ratio (1:2): 100 110 110
2. Inverse: 011 001 001 (costaud wrote about HOWTO inverse the UART output)
3. Consider start and stop bit (0)11 001 00(1) (it's inversed now)
4. Reverse data : (0) 00 100 11 (1) (After start-bit, UART sends LSB of data first)
5. Data word to UART: x00 100 11 (UART is set to 7 Bit, but interface is byte)
Example 2
WB=3 (3*8=24) -> 8 UART char per WS2812-LED
USYMB=9 -> 7 data bits
WS=0.5us
WL=1.0us
=> UBAUD= 2.0Mbps
Examble 3
WB=2 (2*12)=24 -> 12 UART char per WS2812-LED
USYMB=8 -> 6 data bits
WS=0.3125us
WL=0.9375us
Ratio (1:3)
=> UBAUD= 3.2Mbps
Edit: Replaced "wrong name" by costaud. sorry.
Last edited by Lars R. on Thu Nov 06, 2014 10:12 pm, edited 1 time in total.
-
- Posts: 3
- Joined: Sat Oct 25, 2014 2:06 pm
Re: Inverse UART output? (for WS2812 )
Postby nicoverduin » Thu Nov 06, 2014 9:14 pm
I think I understand what you mean
But why not redesign the library FastLED from Paul Stoffregen. I have worked with it before and am quite happy with it.

Who is online
Users browsing this forum: No registered users and 217 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
-
- All times are UTC+08:00
- Top
- Delete all board cookies
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.