-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe should use 7N1 serial, rather than 8N1? #1
Comments
Hi! Glad that at least someone else than me read my article 😉 As I pointed in my post, I'm using someone else's work on it and they used 8N1. Yet, i agree that if one looks at the timing diagram : And, indeed, the START bit being already low, we should be able to skip the 1rst low bit and directly start with the raising edge of the 1rst neopixel bit. So, good finding. I'll do some experiments and will eventually post an update if it works out. |
So, I had a look, and I don't actually use the same timing diagram as the blog article anymore, since I already leverage the START bit. Lines 34 to 38 in e54f985
And in that, you are fully right, 7N1 is enough as the STOP bit is always a LOW bit due to the inversion logic. I just always sent an explicit 0, but redundant, at the end in 8N1 mode. Good news is that 7N1 is shorter, and therefore quicker as you gain 10% of the speed on the WS2812 wire. I'll amend the post and will close the issue. |
Nice :-) Also, something you might want to consider... Since ESP32 is very low powered compared to a real PC, I found a way of sending 6 bits at a time..... First an array of specially crafted 64 shorts - The binary pattern of each of these numbers represent 6 bits of ws2812 protocol (when the UART start and stop bits taken into account) For example, consider the first, element zero, which is 23387. Binary is: 1011011 1011011 With start and stop bits added: 110110110 110110110
Then something like:
This moves red, green, blue values into 8 bytes ready to be sent over uart. This might be a way of speeding things up for you? |
This is my actual UART sending code:
|
Indeed, that's actually a good idea! |
Hi,
I've just done a similar project myself, using an ESP32C3 mcu, and came to roughly the same solution as you....
However, I used 7N1 serial. ( which is 1 start bit, 7 data bits, 1 end bit), This is 9 bits in total, exactly the right size for 3 sets of WS2812 bits.
I just came across your blog, and I see you say 8N1 is the right size? I am confused, this would be 1 bit over?
Maybe I have overlooked something? or maybe you have 1 bit too many? But I'd like to find out If I am doing something wrong, so I can fix my code... But, I know it works... (see attached)
IMG_1179.mp4
The text was updated successfully, but these errors were encountered: