Inverse UART output? (for WS2812 )

Lars R.
Posts: 13
Joined: Thu Oct 30, 2014 8:05 pm

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
Last edited by Lars R. on Thu Nov 06, 2014 5:22 am, edited 1 time in total.

costaud
Posts: 138
Joined: Fri Oct 24, 2014 7:40 pm

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

costaud
Posts: 138
Joined: Fri Oct 24, 2014 7:40 pm

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]

nicoverduin
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"?

Lars R.
Posts: 13
Joined: Thu Oct 30, 2014 8:05 pm

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.

nicoverduin
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 :mrgreen: 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