Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: T4.1 + WS2812B Can I use Serial 8?

  1. #1

    T4.1 + WS2812B Can I use Serial 8?

    Hello, Trying to hook up a simple 8 led strip to a T4.1.
    I noticed the WS2812B lib only goes up to T4.0 thus eliminating Serial 8.

    Does anyone know a way around this ? I only have one serial left to utilize.
    or maybe I should use another library?

    thanks

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,201
    Looks like it has not been updated for T4.1

    I will do a quick and dirty and update, that you can try and then issue PR.

    Should not be very difficult.

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,201
    I have a fork/branch that you might try out: https://github.com/KurtE/WS2812Serial/tree/teensy41

    The main change was to change the code that looked at the pin numbers in the begin method:
    Code:
    #elif defined(__IMXRT1062__)
    	  case 1: // Serial1
    #if defined(ARDUINO_TEENSY41)
    	  case 53:
    #endif
    		uart = &IMXRT_LPUART6; 
    		CCM_CCGR3 |= CCM_CCGR3_LPUART6(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART6_TX; 
    		break;
    	  case 8: // Serial2
    		uart = &IMXRT_LPUART4; 
    		CCM_CCGR1 |= CCM_CCGR1_LPUART4(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART4_TX; 
    		break;
    	  case 14: // Serial3
    		uart = &IMXRT_LPUART2; 
    		CCM_CCGR0 |= CCM_CCGR0_LPUART2(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART2_TX; 
    		break;
    	  case 17: // Serial4
    		uart = &IMXRT_LPUART3; 
    		CCM_CCGR0 |= CCM_CCGR0_LPUART3(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART3_TX; 
    		break;
    	  case 20: // Serial5
    #if defined(ARDUINO_TEENSY40)
    	  case 39: // Serial5 alt
    #elif defined(ARDUINO_TEENSY41)
    	  case 47:
    #endif
    		uart = &IMXRT_LPUART8; 
    		CCM_CCGR6 |= CCM_CCGR6_LPUART8(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART8_TX; 
    		break;
    	  case 24: // Serial6
    		uart = &IMXRT_LPUART1; 
    		CCM_CCGR5 |= CCM_CCGR5_LPUART1(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART1_TX; 
    		break;
    	  case 29: // Serial7
    		uart = &IMXRT_LPUART7; 
    		CCM_CCGR5 |= CCM_CCGR5_LPUART7(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART7_TX; 
    		break;
    #if defined(ARDUINO_TEENSY41)
    	  case 35:
    		uart = &IMXRT_LPUART5; 
    		CCM_CCGR3 |= CCM_CCGR3_LPUART5(CCM_CCGR_ON);
    		hwtrigger = DMAMUX_SOURCE_LPUART5_TX; 
    		break;
    #endif		
    #endif
    Basically the changes are the lines in the sections that have ARDUINO_TEENSY41 or ARDUINO_TEENSY40

    If you get a chance you might try a Pull Request.

    Note: I updated the examples to show T4.1 as well.

    You might give it a shot and see if it works. Will probably go ahead and issue Pull Request hoping it works.

  4. #4
    Thanks Appreciate the assistance. I will give it a go

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,463
    Turns out pin 35 is the one exception to the pin mux always using ALT2. I've committed a fix on github:

    https://github.com/PaulStoffregen/WS...4bbbe010571848

    Confirmed working with real hardware.

    Click image for larger version. 

Name:	leds.jpg 
Views:	12 
Size:	41.7 KB 
ID:	22670

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,201
    Thanks Paul,

    I should have checked it, I did have the HardwareSerial8.cpp up to verify the other stuff like which CCGRx register and which bits... :
    Code:
    static HardwareSerial::hardware_t UART5_Hardware = {
    	7, IRQ_LPUART5, &IRQHandler_Serial8, 
    	&serialEvent8, &_serialEvent8_default,
    	CCM_CCGR3, CCM_CCGR3_LPUART5(CCM_CCGR_ON),
        {{34,1, &IOMUXC_LPUART5_RX_SELECT_INPUT, 1}, {48, 2, &IOMUXC_LPUART5_RX_SELECT_INPUT, 0}},
        {{35,1, &IOMUXC_LPUART5_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}},
    I did wonder if you set the TX pin to half duplex or not... Did not think so, sod did not have to worry about IOMUXC_LPUART5_TX_SELECT_INPUT

    Glad it is working

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •