Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 26

Thread: Glediator/Jinx with Teensy 3.2 and WS2812b

  1. #1

    Glediator/Jinx with Teensy 3.2 and WS2812b

    I can't get my Teensy 3.2 to work as I did with Arduino Uno using Glediator and or Jinx. Before I ran the WS2812b script for Glediator on Arduino then opened the Jinx/Glediator program and chose the correct ports and the lights works. I had to upgrade to Teensy 3.2 because I was using more than the max 512 pixels the Arduino could handle memory wise. So if some can guide me to an easy solution using the Teensy 3.2 controling an 60x16 (960 pixel) ws2812b board with Glediator/Jinx or even Vixen, that would answer my question here. Thanks a million in advance for the help from someone here.

  2. #2
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    I think that it would help to provide a bit of detail regarding what error output is, what your sketch code is, etc. otherwise its all a bit vague and terrible guess work. Is there any error output in the IDE?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,598
    Quote Originally Posted by deeveejay View Post
    ... the WS2812b script for Glediator on Arduino then opened the Jinx/Glediator program and chose the correct ports and the lights works.
    If you want help here, you have to post the code, or a link to the exact code. Just saying something doesn't work, without details, isn't enough. Perhaps someone here knows exactly which code you mean, but I do not, and probably most don't either. That's why we have the "Forum Rule" at the top of every page!

  4. #4
    Is there a script to run on Arduino to make the Teensy 3.2 work on Glediator/Jinx. The one for Arduino has a 512 pixel limitation. If you read this link it may help you understand my question. http://www.solderlab.de/index.php/software/glediator.
    Scroll down to the Stripes & Matrices made of WS2811 / WS2812-Pixels (Neo-Pixel). There you will see more of what my problem is. I ordered the teensy 3.2 to solve the 512 pixel limit. As it is supposed to carry more. The error I'm getting is a UART error when I verify and or upload to Arduino. Somewhere I'm thinking I don't have the right script for the teensy 3.2. I think that one is made for the Arduino Uno, and not Teensy 3.2.

  5. #5
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    Dear friend, please just post the code you are using (your .ino sketch), and describe what components you are using, and paste a copy of the error you are getting from the IDE window. At the moment, we are guessing what code, what setup, and what error. It really will help. :-)

  6. #6
    Here is the script I'm using.

    WS2812-Glediator-Interface
    ws2812_glediator.zip

    Download http://www.solderlab.de/index.php/do...r-interface-v1

    Details
    A small sketch for all kind of (8bit) Arduino boards to receive data from Glediator and push it to stripes / matrices of WS2811 / WS2812 pixels.

    When I run the script to the Teensy 3.2 it gives me an:
    ISR (USART_RX_vect) error. Expected constructor, destructor, or type conversion before '('token.

    Here is the actual script for the WS2812b
    Code:
    //##############################################################################
    //##############################################################################
    //                                                                             #
    // Glediator to WS2812 pixel converter                                         #
    // by R. Heller                                                                #
    // V 1.0 - 07.01.2014                                                          #            
    // wwww.SolderLab.de                                                           #
    //                                                                             #
    // Receives serial data in Glediator protocol format @ 1 MBit/s                #
    // and distributes it to a connectect chain of WS2812 pixels                   #
    //                                                                             #
    // Adjust the correct DATA PIN and the correct NUMBER OF PIXELS you are using  # 
    // in the definitions section below before uploading this sketch to your       #
    // Arduino device.                                                             #
    //                                                                             #
    // Maxiumim number of supported pixeles is 512 !!!                             #
    //                                                                             #
    // In the Glediator software set output mode to "Glediator_Protocol",          #
    // color order to "GRB" and baud rate to "1000000"                             #
    //                                                                             #
    //##############################################################################
    //##############################################################################
    
    
    //##############################################################################
    //                                                                             #
    // Definitions --> Make changes ONLY HERE                                      #
    //                                                                             #
    // To find out the correct port, ddr and pin name when you just know the       #
    // Arduino's digital pin number just google for "Arduino pin mapping".         #
    // In the present example digital Pin 6 is used which corresponds to "PORTD",  #
    // "DDRD" and "6", respectively.                                               #
    //                                                                             #
    //##############################################################################
    
    #define DATA_PORT          PORTD
    #define DATA_DDR           DDRD						
    #define DATA_PIN           6							
    #define NUMBER_OF_PIXELS   54
    
    
    //##############################################################################
    //                                                                             #
    // Variables                                                                   #
    //                                                                             #
    //##############################################################################
    
    unsigned char display_buffer[NUMBER_OF_PIXELS * 3];
    static unsigned char *ptr;
    static unsigned int pos = 0;
    
    volatile unsigned char go = 0;
    
    
    //##############################################################################
    //                                                                             #
    // Setup                                                                       #
    //                                                                             #
    //##############################################################################
    
    void setup()
    {
      // Set data pin as output
      DATA_DDR |= (1 << DATA_PIN);
      
      // Initialize UART
      UCSR0A |= (1<<U2X0);                                
      UCSR0B |= (1<<RXEN0)  | (1<<TXEN0) | (1<<RXCIE0);   
      UCSR0C |= (1<<UCSZ01) | (1<<UCSZ00)             ; 
      UBRR0H = 0;
      UBRR0L = 1; //Baud Rate 1 MBit (at F_CPU = 16MHz)
      
      ptr=display_buffer;
      
      //Enable global interrupts
      sei();
    }
    
    
    //##############################################################################
    //                                                                             #
    // Main loop                                                                   #
    //                                                                             #
    //##############################################################################
    
    void loop()
    {  	
      if (go==1) 
      {
        cli();
        ws2812_sendarray(display_buffer, NUMBER_OF_PIXELS * 3); 
        sei();
        go=0;
      }
    }
    
    
    //##############################################################################
    //                                                                             #
    // UART-Interrupt-Prozedur (called every time one byte is compeltely received) #
    //                                                                             #
    //##############################################################################
    
    ISR(USART_RX_vect) 
    {
      unsigned char b;
      b=UDR0;
      
      if (b == 1)  {pos=0; ptr=display_buffer; return;}    
      if (pos == (NUMBER_OF_PIXELS*3)) {} else {*ptr=b; ptr++; pos++;}  
      if (pos == ((NUMBER_OF_PIXELS*3)-1)) {go=1;}
    }
    
    
    //##############################################################################
    //                                                                             #
    // WS2812 output routine                                                       #
    // Extracted from a ligh weight WS2812 lib by Tim (cpldcpu@gmail.com)          #
    // Found on wwww.microcontroller.net                                           #
    // Requires F_CPU = 16MHz                                                      #
    //                                                                             #
    //##############################################################################
    
    void ws2812_sendarray(uint8_t *data,uint16_t datlen)
    {
      uint8_t curbyte,ctr,masklo;
      uint8_t maskhi = _BV(DATA_PIN);
      masklo =~ maskhi & DATA_PORT;
      maskhi |= DATA_PORT;
    
      while (datlen--) 
      {
        curbyte = *data++;
    
        asm volatile
        (
          "		ldi %0,8	\n\t"		// 0
          "loop%=:out %2, %3	\n\t"		// 1
          "lsl	%1		\n\t"		// 2
          "dec	%0		\n\t"		// 3
          "		rjmp .+0	\n\t"		// 5
          "		brcs .+2	\n\t"		// 6l / 7h
          "		out %2,%4	\n\t"		// 7l / -
          "		rjmp .+0	\n\t"		// 9
          "		nop		\n\t"		// 10
          "		out %2,%4	\n\t"		// 11
          "		breq end%=	\n\t"		// 12      nt. 13 taken
          "		rjmp .+0	\n\t"		// 14
          "		rjmp .+0	\n\t"		// 16
          "		rjmp .+0	\n\t"		// 18
          "		rjmp loop%=	\n\t"		// 20
          "end%=:			\n\t" 
          :	"=&d" (ctr)
          :	"r" (curbyte), "I" (_SFR_IO_ADDR(DATA_PORT)), "r" (maskhi), "r" (masklo)
        );
      }
    
    }
    
    
    //##############################################################################
    //                                                                             #
    // End of program                                                              #
    //                                                                             #
    //##############################################################################
    Last edited by deeveejay; 02-02-2016 at 11:54 PM.

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,785
    Does it disable the emoji'fication if you wrap your code as:Name:  code.PNG
Views: 6933
Size:  1.7 KB

  8. #8
    Thanks I just corrected it. I learned something new today. How to paste code. I will remember it for here on.

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,785
    Good to know it turns off the Emoji'fication in code - seemed like it should.

  10. #10
    If you know any code that will work with Glediator/Jinx to upload to Teensy 3.2 to make it work with the program. I will be happy.

  11. #11
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    I cant test this at the moment, by you could try something like:
    Code:
    #include "FastLED.h"
    
    #define NUM_LEDS 400
    #define DATA_PIN 11;
    
    CRGB leds[NUM_LEDS];
    
    void setup() {
    Serial.begin(9600);        
    //Serial.begin(115200); 
    delay(1000);
    FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    }
    int serialGlediator() {
      while (!Serial.available()) {}
      return Serial.read();
    }
    void loop() {
       while (serialGlediator() != 1) {} 
    
       for (int i=0; i < NUM_LEDS; i++) {
         leds[i].r = serialGlediator();
         leds[i].g = serialGlediator();
         leds[i].b = serialGlediator();
       }
         FastSPI_LED.show();
    }

  12. #12
    This is the error messages I'm getting. I know little about programming. Thanks for the help.

    Code:
    Arduino: 1.6.7 (Windows 10), TD: 1.27, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimized (overclock), US English"
    
    In file included from C:\Users\Documents\Arduino\sketch_feb03a\sketch_feb03a.ino:1:0:
    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\FastLED/FastLED.h:12:2: warning: #warning FastLED version 3001000 (Not really a warning, just telling you here.) [-Wcpp]
    #warning FastLED version 3001000  (Not really a warning, just telling you here.)
    ^
    C:\Users\Documents\Arduino\sketch_feb03a\sketch_feb03a.ino: In function 'void setup()':
    sketch_feb03a:12: error: parse error in template argument list
    FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    ^
    sketch_feb03a:4: error: statement cannot resolve address of overloaded function
    #define DATA_PIN 11;
    ^
    C:\Users\Documents\Arduino\sketch_feb03a\sketch_feb03a.ino:12:25: note: in expansion of macro 'DATA_PIN'
    FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    ^
    sketch_feb03a:12: error: expected primary-expression before ',' token
    FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    ^
    C:\Users\Documents\Arduino\sketch_feb03a\sketch_feb03a.ino:3:18: warning: left operand of comma operator has no effect [-Wunused-value]
    #define NUM_LEDS 400
    ^
    C:\Users\Documents\Arduino\sketch_feb03a\sketch_feb03a.ino:12:46: note: in expansion of macro 'NUM_LEDS'
    FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    ^
    exit status 1
    expected primary-expression before ',' token
    Last edited by deeveejay; 02-03-2016 at 05:10 PM.

  13. #13
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    Remove the semi colon after "#define DATA_PIN 11" , and that should get rid of the error regarding primary expression.

  14. #14
    That did fix the program error. It still will not run the Glediator or Jinx program for the WS2812b pixels. Any guidance on how to get it to work with those programs.

  15. #15
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    According to the setup directions, it looks like you need to run the RXTX serial java file to finalise the connectivity with Glediator. I don't use glediator, so can't help with this.

  16. #16
    I have the programs running ok. It is just the programs will not communicate with teensy and lights. Do you use any program that is similar that has a GUI to run LED lights like WS2812b.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,598
    I've never used Glediator either.

    But I'd really like to put a known-good example for it into OctoWS2811. Any chance you could help me with specific steps and info about how to get Glediator running on my Linux machine?

  18. #18
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    @deeveejay - i use pixelcontroller rather than Glediator. It outputs artnet, TPMserial, etc just as Glediator, but I found it easier to setup. It has a teensy sketch within the java dist release: http://pixelinvaders.ch/?page_id=160
    @paul - i will have a look into putting something together, prob get to it next week if thats any use.

  19. #19
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,598
    Quote Originally Posted by mortonkopf View Post
    @paul - i will have a look into putting something together, prob get to it next week if thats any use.
    Yes, anything you can do to help me quickly get Glediator running (on Linux 64 bit) would really help.

    This protocol is so very simple... pretty much all the time will probably be fiddling with unfamiliar software.

  20. #20
    I have to give that a shot. I'm going no where stumbling around with the Glediator. Thanks for the insight.

  21. #21
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    I am having a look at Gladiator, but struggling with getting ports recognised in the app. painful. Have a look at pixel controller, no additional messing with rxtx, you will need to setup the config file. It looks a bit daunting at first, but is relatively straight forward. ensure that you enter the correct port name. there is some discussion here: https://forum.pjrc.com/threads/26181...ixelcontroller
    message #32
    @Paul, just picked up that you are looking for Linux 64 bit. Sorry, but don't have that setup. using Mac.

  22. #22
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    @deeveejay, one question, did you put the two files "librxtxSerial.jnilib" and "RXTXcomm.jar" into the Java/Extensions/ folder?
    You will need to do this. If you do not have the folder, you need to create it. I just did this process and have Glediator running with Teensy3 and WS2801. After adding these files, the ports will show up in Glediator software.

    EDIT: you should find (or create) that folder in "Library" folder.
    Last edited by mortonkopf; 02-07-2016 at 01:01 PM.

  23. #23
    I have done that. The problem I seem to have is before that step. It the firmware to upload to the Teensy 3.2 in order to get it to work with the WS2812b. You have to have a firmware uploaded first then open the Glediator program. If not it will not be able to send data to the Glediator. I maybe wrong but that is the way I think it should be done to work. When I upload a firmware that is specifically designed for Arduino I get the error that I talked about in my earlier post. If a firmware can be found to work with Teensy as it works for the Arduino with the WS2812b. I will have a solution to the problem.

  24. #24
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    901
    @deeveejay, i have finally had some success, with ws2811 and fastLED, so you should be able to use this for ws2812 by using the correct led call for your leds. Gladiator was sending to the array, but was flickering slightly, you have to select Glediator Protocol as the output type:

    Code:
    #include "FastLED.h"
    
    #define NUM_LEDS 60
    #define DATA_PIN 2
    CRGB leds[NUM_LEDS];
    
    void setup() {
         delay(1000);
           FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    }
    
    void loop()
    {                                       
      while (Serial.available()>1)            
      {
        for (int Count=0; Count<NUM_LEDS;Count++)
        {
          int rgb[3];                                          
          for (int color = 0;color<3;color++)    
          {                      
            rgb[color] = Serial.read();
          }                                       
          leds[Count]= CRGB(rgb[0],rgb[1],rgb[2]);     
        }                                         
        FastLED.show();                                                       
      }                                           
    }
    it might be that an array buffer is required to store all the led array values, to be able to remove the flicker. Not sure why it is happening.

    EDIT: i have found that the code below sorts out the above problems and works for 2812:
    Code:
    #include "FastLED.h"
    #define NUM_LEDS 30
    const int dataline = 2;
    
    CRGB leds[NUM_LEDS];
    void setup() {
            Serial.begin(115200); 
         LEDS.addLeds<WS2812B, dataline>(leds, NUM_LEDS);
    }
    int serialGlediator() {
      while (!Serial.available()) {}
      return Serial.read();
    }
    void loop() {
       while (serialGlediator() != 1) {} 
    
       for (int i=0; i < NUM_LEDS; i++) {
         leds[i].r = serialGlediator();
         leds[i].g = serialGlediator();
         leds[i].b = serialGlediator();
       }
         FastSPI_LED.show();
    }
    Last edited by mortonkopf; 02-10-2016 at 11:19 AM.

  25. #25
    I will try this as soon as I get a chance. Finally a breakthrough. I hope it works. You will be the man or woman of the year if you did. lol Thanks for the help.

Tags for this Thread

Posting Permissions

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