No XLAT pulses on Arduino Nano

105 views
Skip to first unread message

ethan...@gmail.com

unread,
Apr 4, 2014, 1:14:05 PM4/4/14
to tlc5940...@googlegroups.com
Logic Analyzer input: http://i.imgur.com/IcRktTB.png

Does anyone know why?

Ethan

Alex Leone

unread,
Apr 4, 2014, 6:15:37 PM4/4/14
to ethan...@gmail.com, tlc5940...@googlegroups.com
Are you still using the code you sent earlier?  (just Tlc.init(), then Tlc.setAll(0) and Tlc.update())?  I ask because I would expect SIN to be always 0 and SCLK to go up and down a bunch at the beginning of each BLANK pulse.

As for XLAT, you should a pulse inside each BLANK.

Thanks for the logic analyzer output, it really helps.

 - Alex



--
You received this message because you are subscribed to the Google Groups "tlc5940arduino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlc5940arduin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ethan Spitz

unread,
Apr 4, 2014, 6:17:17 PM4/4/14
to Alex Leone, tlc5940...@googlegroups.com
This logic analyzer output is for the example code "BasicUse"

It doesn't seem to be behaving as expected :(

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015

Alex Leone

unread,
Apr 4, 2014, 6:25:36 PM4/4/14
to ethan...@gmail.com, tlc5940...@googlegroups.com
Indeed.  Can you double check that XLAT is connected to digital pin 9?

Can you try manually toggling XLAT in setup(), like so.  You should see 3 XLAT pulses imediately after startup (very short, 62.5ns or so).

void setup() {
    Tlc.init();
    /* pulse XLAT twice */
    PORTB |= _BV(PB1);
    PORTB &= ~_BV(PB1);
    PORTB |= _BV(PB1);
    PORTB &= ~_BV(PB1);
    /* see if the tlc library XLAT_PORT is correct, pulse XLAT a third time */
    XLAT_PORT |= _BV(XLAT_PIN);
    XLAT_PORT &= ~_BV(XLAT_PIN);
}

Thanks!

 - Alex

Ethan Spitz

unread,
Apr 4, 2014, 6:28:37 PM4/4/14
to Alex Leone, tlc5940arduino
I'm getting a slew of errors when I try to compile that:

BasicUse:59: error: expected unqualified-id before 'volatile'
BasicUse:59: error: expected `)' before 'volatile'
BasicUse:59: error: expected `)' before 'volatile'
BasicUse:60: error: expected unqualified-id before 'volatile'
BasicUse:60: error: expected `)' before 'volatile'
BasicUse:60: error: expected `)' before 'volatile'
BasicUse:61: error: expected unqualified-id before 'volatile'
BasicUse:61: error: expected `)' before 'volatile'
BasicUse:61: error: expected `)' before 'volatile'
BasicUse:62: error: expected unqualified-id before 'volatile'
BasicUse:62: error: expected `)' before 'volatile'
BasicUse:62: error: expected `)' before 'volatile'
BasicUse:64: error: expected unqualified-id before 'volatile'
BasicUse:64: error: expected `)' before 'volatile'
BasicUse:64: error: expected `)' before 'volatile'
BasicUse:65: error: expected unqualified-id before 'volatile'
BasicUse:65: error: expected `)' before 'volatile'
BasicUse:65: error: expected `)' before 'volatile'


Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Ethan Spitz

unread,
Apr 4, 2014, 6:29:26 PM4/4/14
to Alex Leone, tlc5940arduino
I lied, give me a sec I'll post the logic analyzer output

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Ethan Spitz

unread,
Apr 4, 2014, 6:35:48 PM4/4/14
to Alex Leone, tlc5940arduino
I Increased the sampling rate to 12 MHZ in order to see anything on XLAT


The first one is a zoomed out view of a few seconds of sampling. The second one is the very beginning (see time scale)

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


ethan...@gmail.com

unread,
Apr 4, 2014, 6:38:27 PM4/4/14
to tlc5940...@googlegroups.com, Alex Leone, ethan...@gmail.com
It seems there are only two pulses on XLAT in the very beginning

ethan...@gmail.com

unread,
Apr 4, 2014, 6:51:14 PM4/4/14
to tlc5940...@googlegroups.com, Alex Leone, ethan...@gmail.com
First pulse is 55us after start up, so perhaps none of the pusles are showing up?

Alex Leone

unread,
Apr 4, 2014, 7:01:15 PM4/4/14
to ethan...@gmail.com, tlc5940...@googlegroups.com
It looks like it's working correctly.  The XLAT pulses are in the right place right after the inital clear in Tlc.init().

In the zoomed-out view, it looks like XLAT is pulsing regularly?

Just a shot in the dark, but which version of the Arduino IDE are you using?  I haven't tested the library recently and there could be some timer usage that's overriding the way the library uses the hardware timers.

I know that 0023 should work. http://arduino.cc/en/Main/OldSoftwareReleases

Ethan Spitz

unread,
Apr 4, 2014, 7:02:36 PM4/4/14
to Alex Leone, tlc5940arduino
I'm using the latest, let me give 0023 a shot and i'll get back to you.

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Ethan Spitz

unread,
Apr 4, 2014, 7:10:13 PM4/4/14
to Alex Leone, tlc5940arduino
BasicUse program still isn't doing anything :/


Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Alex Leone

unread,
Apr 4, 2014, 7:11:46 PM4/4/14
to Ethan Spitz, tlc5940arduino
Can you zoom in on one of the XLAT pulses?  I want to see how often BLANK is pulsing.

Thanks,

 - Alex

Ethan Spitz

unread,
Apr 4, 2014, 7:14:39 PM4/4/14
to Alex Leone, tlc5940arduino
Here is really zoomed in and slightly less zoomed in


Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Alex Leone

unread,
Apr 4, 2014, 7:26:33 PM4/4/14
to Ethan Spitz, tlc5940arduino
Cool, that's what it should look like, with XLAT inside BLANK.

It looks like data was shifted in on SIN and SCLK for that pwm period (between BLANKS), so the XLAT is happening in the right spot after data is sent to the chip.  XLAT is pulsed during blank so that the new outputs happen in the next pwm period, as opposed to changing in the middle of the pwm period.

Can you try hooking up one of the tlc outputs to the logic analyzer?  Then try running something that will switch the output every period, like so.  If you watch tlc OUT0, it should switch from 0 to 1, then 1 to 0, on every blank pulse.

void setup() {
    Tlc.init();
}

void loop() {
    Tlc.setAll(4095);
    Tlc.update();
    while (tlc_needXLAT) {
        /* wait for end of period */
    }
    Tlc.setAll(0);
    Tlc.update();
    while (tlc_needXLAT) {
        /* wait for end of period */

Ethan Spitz

unread,
Apr 4, 2014, 7:32:45 PM4/4/14
to Alex Leone, tlc5940arduino
http://imgur.com/OR7E7k3

It does that. So how come all the outputs are inconsistent?

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Ethan Spitz

unread,
Apr 4, 2014, 7:34:31 PM4/4/14
to Alex Leone, tlc5940arduino

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Alex Leone

unread,
Apr 4, 2014, 7:38:34 PM4/4/14
to Ethan Spitz, tlc5940arduino
Strange, OUT0 should stay high or low for the entire period (1ms).  Eg, low for 1ms, then high for 1ms, then low for 1ms.

I wonder if the 1K pullup resistors and the gate pin on the mosfets aren't interacting nicely or something?

Ethan Spitz

unread,
Apr 4, 2014, 7:44:03 PM4/4/14
to Alex Leone, tlc5940arduino
If anything, it would make sense that it would be high more than you expect since there is the pull up. The gate shouldn't really effect the signal, other than the slight capacitance.

Here is the setup btw. First picture is when it's just idling on, second is on reset.


Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Alex Leone

unread,
Apr 4, 2014, 7:50:47 PM4/4/14
to Ethan Spitz, tlc5940arduino
Cool.  Are all the light bars daisy-chained, or is each one driven by it's own TLC and Arduino?

Another random thing to try would be to decrease the pwm period.  In tlc_config.h, change

#define TLC_PWM_PERIOD    8192
#define TLC_GSCLK_PERIOD    3 to something slower like (this would be 4ms periods instead of 1ms):
#define TLC_PWM_PERIOD    32768
#define TLC_GSCLK_PERIOD    15

Ethan Spitz

unread,
Apr 4, 2014, 7:52:49 PM4/4/14
to Alex Leone, tlc5940arduino
Each Strip is on it's own MOSFET each on one channel of the TLC. Let me try that and see if that does anything.

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Ethan Spitz

unread,
Apr 4, 2014, 7:57:25 PM4/4/14
to Alex Leone, tlc5940arduino
Doesn't seem to have fixed anything: http://imgur.com/8jUzlD4

Ethan Spitz
Electrical Engineering and Computer and Systems Engineering
Contributing Editor, The Rensselaer Polytechnic
Lab Manager, The RPI Embedded Hardware Club
Rensselaer Polytechnic Institute, Class of 2015


Reply all
Reply to author
Forward
0 new messages