Rotary Encoder NeoPixel can't make it work.

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
aliher
 
Posts: 5
Joined: Sun Jun 04, 2023 3:05 pm

Rotary Encoder NeoPixel can't make it work.

Post by aliher »

Hey!

I have a rotary encoder that is based on seesaw that is attached to raspberry pi using i2c. I have a software written in go so I can't use python module directly, but looking on its code I got the register offsets for it and read and wrote registers to work with encoder and its button without any problems as well as reading other i2c adafruit modules.

Unfortunately it doesn't work with NeoPixel on the encoder board. I write pin number 6 to neopixel_base, neopixel_pin just fine, but if i set neopixel_buf_len, then after the next i2c read on the bus, encoder board will drive both clock and data lines to 0 and block any further comms on the bus. I tested that with oscilloscope and tried unplugging the board, which immediately let the bus work again. To reset from that state, I need to turn board power off and let it reset.

Any hints on how I can make it work? Do I miss anything important?

Regards

Does that belong to "Other Products from Adafruit" forum? Not sure how to move now.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by Franklin97355 »

Probably belongs in General project help. You said the rotary encoder worked in other projects (I think) so it might be your code. Can you post your code? I'm not fluent in Go but others might be. Also, a set of pictures won't hurt.

User avatar
aliher
 
Posts: 5
Joined: Sun Jun 04, 2023 3:05 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by aliher »

I pushed the repo to github and this commented out bit causes seesaw to block i2c bus for some reason.
https://github.com/aliher1911/blinds/bl ... go#L74-L77

The whole structure is main creates a Rotary: https://github.com/aliher1911/blinds/bl ... go#L36-L61 it would then advance stepper and poll sensors in a loop. So when rotary initializes it would set up pin on seesaw for button and setup pixel buffer and pin. Something is wrong with initialization. I don't even try to write rgb sequence for pixel, just initializing buffer size will break it (i.e. commented out part of code).

I never had neopixel work before, I only have rotary sensor on the same board working (which is exposed via different set of registers) and also a button which is just attached to gpio pin. Setting up direction and pullup for the pin works fine and then button state is readable.

I took pins from the example provided for the breakouts and matched them with schematic so it is probably good.

Maybe I should try to write to single pixel without setting the buf length at all and see what happens with it.

User avatar
aliher
 
Posts: 5
Joined: Sun Jun 04, 2023 3:05 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by aliher »

I got an Arduino board and managed to test that neopixel work fine on the board.

However I'm no closer to why my own code doesn't work. Are there any docs on seesaw registers beside library source itself? Would be nice to just check the register map like you can do on other sensors' manufacturers docs.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by adafruit2 »


User avatar
aliher
 
Posts: 5
Joined: Sun Jun 04, 2023 3:05 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by aliher »

Neat! Thank you!
I just found those as well. It would be nice to have those pages referenced in docs part from the boards using seesaw. And I also had a misconception that I must use micropython with examples as docs said, but was put away by the fact that I need to boot into it instead of just installing on the normal pi. But I eventually discovered that there's a proper python version as well.

User avatar
aliher
 
Posts: 5
Joined: Sun Jun 04, 2023 3:05 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by aliher »

For posterity if anyone else hits this. The problem is endianness of buffer size register. It works as little endian i.e. 3 byte long buffer for RGB pixel would be 0x0e, 3, 0, 3.

I can't see byte order specified anywhere in the docs.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Rotary Encoder NeoPixel can't make it work.

Post by adafruit2 »

Please be positive and constructive with your questions and comments. The docs now indicate LE

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”