WS2812Serial non blocking question

snowsh

Well-known member
main hardware:
T4.1
arduino nano v3
WS2812 - lots of them.....
ADUM1201ARZ-RL7 logic level shifter

Im using https://github.com/PaulStoffregen/WS2812Serial library, works great.

I am using TX8 (pin 35) to send WS2812 D signal.

Question: Can I use t4.1 pin RX8 (pin 34) as an interrupt only pin? Apart from the WS2812, I am also going to use an arduino nano to scan my input buttons and pots. The idea is to relieve the hardware Mux scan from the T4.1 which is also doing allot of other work. The nano will just scan the mux and present its data over i2c. I want to hook the nano up to a pin on the t4.1 as an interrupt to let the teensy know that a button event has occoured and it needs to read the i2c data from the nano....

I am using a ADUM1201ARZ-RL7 2 channel i/o logic level converter, one is for the WS2812 serial out from teensy to convert it up to 5v. I will use the other channel to convert 5v from the nano to 3v3.

I am wondering if anyone knows if the WS2812Serial library may use the RX line of the "serial port" too....

3v3-to-5v-level-shift.JPG
 
Last edited:
Pin 35 may have TX8 function - but as used - it isn't doing UART Serial and would have no reason to associate Pin 34 to that use.

Even if TX8 was in use for UART - the RX8 pin could be repurposed after the Serial.begin() and that Serial8 port would only have transmit function.
 
Pin 35 may have TX8 function - but as used - it isn't doing UART Serial and would have no reason to associate Pin 34 to that use.

Even if TX8 was in use for UART - the RX8 pin could be repurposed after the Serial.begin() and that Serial8 port would only have transmit function.

@defragster - yes the irq pin it needs to be read as an input. How about this based on your suggestion:

Code:
#define SUB_PROCESSOR_IRQ 34    // RX8                                       // interrupt requrst pin to begin i2c data request from the subprocessor
#define WS2812_PIN 35  // TX8

void setupSubProcessor()  // called in setup() after serial.begin
{
  pinMode(subProcessor.ledPin, OUTPUT);                                                                   // important
  pinMode(SUB_PROCESSOR_IRQ, INPUT);                                                                   // important

  attachInterrupt(digitalPinToInterrupt(SUB_PROCESSOR_IRQ), subProcessorIRQ, RISING);                     // set an interrupt
}

void setup()
{
    serial.begin(57600);

    // etc

    setupSubProcessor();
}

Im not running a serial.begin(); for UART 8 ( unless serial.begin(57600) starts all 8 UART??) , for the WS2812 use of UART 8, im only declaring the use of ws2812 in header:

Code:
WS2812Serial leds(numled, displayMemory, drawingMemory, WS2812_PIN, WS2812_GRB);

Does all this look ok? Im about to order a PCB so checking all bases....
 
Last edited:
Im not running a serial.begin(); for UART 8 ( unless serial.begin(57600) starts all 8 UART??) , for the WS2812 use of UART 8, im only declaring the use of ws2812 in header:
If you are using UART8 you should be using Serial8.begin(baudRate);
Just look the the code for the serial ports - it set's everything up ready for transmission.
 
@BriComp - no I dont want to use the UART. The question is about how WS2812 functions - whether or not it engages UART as it has to run on one of the hardware serial ports..... I want to know if the associated recieve pin is affected in any way by the WS2812 library.... if the RX pin is not used by WS2812 then its happy days - it leaves me the perfect pin to use for my IRQ line.
 
Yes, it uses the serial port, but only its TX pin. The RX pin remains unused by WS2812Serial.

brilliant, thanks Paul!

To continue this line of thought, I am using the redundant RX pin for my IRQ. Are there any tricks I could use to maybe send a serial ID value to interrupt line so the main processor knows where the interrupt has come from? At present its only the nano running my hardware mux that is doing this, but I plan to add more devices using I2C and the interrupt pin. If its just a pulse I will just scan all known devices for a response, but an ID passed in the initial interrupt would be much better....
 
Last edited:
Back
Top