SyntaxHigh

Sunday, October 27, 2013

Saleae Logic Analyzer $8.50

Summary

  • Cheap one-chip Logic Analyzer for DIY electric works.
  • 8CH, 24Mbit/sec sampling rate.
  • Free software.
I've just got the analyzer today and found it useful enough for my purpose. The sampling rate is good for megahertz  signal analysis.

The software is free and I think it's well made for shifting, zooming in/out and measuring the timing or duration of the signals.

More powerful 100MHz analyzer costs $40, and I should have bought this one for some more advanced analysis.

Looking at signals of TLC5940 library for Arduino

The figure shows the timing fo XLAT and BLANK. The XLAT signal is inside the BLANK signal as the datasheet says it so.


The code looks like this. "non inverting, phase/frequency correct pwm" is mode of generating PWM in ATMega328p's function.

    /* Timer 1 - BLANK / XLAT */

    TCCR1A = _BV(COM1B1);  // non inverting, output on OC1B, BLANK

    TCCR1B = _BV(WGM13);   // Phase/freq correct PWM, ICR1 top

    OCR1A = 1;             // duty factor on OC1A, XLAT is inside BLANK

    OCR1B = 2;             // duty factor on BLANK (larger than OCR1A (XLAT))

    ICR1 = TLC_PWM_PERIOD; // see tlc_config.h



1行目と2行目がキーになっている.ちょっとまだよくわからないが,WGM13 を 1 に設定するとICR1に達するまでカウントアップ,以降はカウントダウン,ゼロになったらカウントアップ,を繰り返すらしい. そして,コンパレータと比較して値が一致した時に反転する.つまり,カウントがゼロのタイミングを中心として対称な波形ができる.だから上のような波形になっている.





SPI が 8MHz だと 16MHz のサンプルレートでは取りきれないので,4MHz に落として見ることにした.そもそもそんなに早くする必要ないし.

こういうタイミングもある.


最後の GSCLK(4096 個目)  が終わる前にBLANKが上がってしまっている.Duty が 1 の時のみ一瞬出力がOFFになるけど,GSCLK は PWM 信号のパルスなので,BLANK が下がればまたリセットされる.さして問題ではない.これは,タイマーが綺麗に割り切れていないからだろう.

仕事が忙しくてこれ以上今は調べられない.フリッカーが起こっている時の信号についてはまた後日.


No comments:

Post a Comment