A Simple Oscilloscope (CY8CKIT-044) using SerialPlotter

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

A while ago, one of my colleagues was missing an oscilloscope during he is working from home.

Since the required bandwidth was a few KHz, I tried to create one for him, but I could not make it work well.

(Mainly I could not control the display of SerialPlotter)

 

Then yesterday, I made a mistake by asking if the students who will take my course starting from tomorrow have access to oscilloscope(s).

Since they also are going to work (study?) from home, naturally the answer was NO. orz

 

The remaining time was 1 day and a half.

Yes, it was a time for another hack! o(^_^)V

 

少し前にテレワークしている同僚がオシロ欲しいよ~とこぼしていました。

彼のアプリで必要なバンド幅は数KHz 程度だったので、プログラム書けないかなと試してみたのですが、

なかなか思うように行きませんでした。(主に SerialPlotter の表示を固定するのが上手くいかず・・・)

 

そんな中、明日から始まる大学の講習について、誤って昨日、学生さんオシロ使える状態ですよね?と質問してしまったところ

彼らもテレワークなので、当然ながら回答は NO でした。orz

 

残された時間は後一日半、さぁ、ハッキングの時間だぜぃ! と思いました。o(^_^)V

 

IMG_4471.JPG

 

So the theme of the day is a simple oscilloscope using a CY8CKIT-044 and SrialPlotter as the display.

Fortunately all the students have a CY8CKIT-044 and USB-Serial Converter.

 

という訳で、今回のお題は、CY8CKIT-044 と SerialPlotter を使用して簡易オシロをでっち上げること!

幸い受講生の皆さんには CY8CKIT-044 と USB-Serial コンバータは配布済みでした。

 

This program uses the UART of KitProg as DATA_OUT for SerialPlot.

And I added another UART for user interface.

 

このプログラムでは KitProg 側の UART を SerialPlot 用の DATA_OUT として使用します。

その為、ユーザーインタフェース用に UART を追加しました。

 

schematic / 回路図

001-schematic.JPG

 

pins / ピンアサイン

002-pins.JPG

 

command list / ヘルプメニュー

 

When program starts, a splash title and prompt appears on the UART terminal.

Type "help" for command menu.

 

プログラムを起動すると、簡単なタイトルとプロンプトが表示されます。

“help” と入力するとコマンド一覧が表示されます。

 

003a-help-message.JPG

 

trig : trigger setting

trig <ch> <mode> <level> <pos>

 

<ch> the channel to set trigger

<mode>  one of "rise", "fall", "level", "none"

<level> the value checked against the trigger. Currently this is the raw count value of ADC

            so the value would be 0 ~ 2047 or so.

<pos> where in the screen placed the trigger point

 

trig: トリガー設定

trig <チャネル> <モード> <閾値> <位置>

 

<チャネル> トリガーを設定するチャネル

<モード> "rise" (立上がり) "fall" (立下り) "level" (値) "none" (トリガ無し)

<閾値> トリガを判定の値。現在は ADC の raw カウントをそのまま使用しています、

   その為 0+2047 が有効な値になります。

<位置> SerialPlotter の画面上左からどのくらいの位置にトリガを配置するかを設定します。

 

len: Specify the number of data in one screen

len <value>

<value> must be 1 ~ 1024、this value must match with the Plot Width of SerialPlotter

 

len: 一画面のデータ数

len <数>

<数> 一画面に表示されるデータ数を指定します。この値は SerialPlotter の Plot Width と合わせてください。

 

ch: set the number of channels

ch <number>

<number> of channels 1 or 2

 

ch: チャネル数の設定

ch: <チャネル数>

<チャネル数> チャネルの数、現ヴァージョンでは 1 ~ 2

 

offset: set DC offset of a channel

offset <bias>

<bias> the value to shift the channel vertically in the SerialPlotter

 

offset: チャネルの縦位置調整

offset <バイアス>

<バイアス> SerialPlotter の画面上で縦に移動させる値

 

sample: set the interval of sampling

sample <sample_interval>

<sample_interval> 1(/sampling freq)  default is 10 us/cycle = 100000.00 Hz = 100kHz

 

sample: サンプリング間隔の設定

sampe <サンプル間隔>

<sample間隔> 1/(サンプリング周波数) デフォルトでは 10us/cycle で 100kHz サンプリングになっています。

 

run: Run the program / 測定動作の開始または再開

stop: Stop the program / 測定動作の停止

sw2 can be used instead of run/stop / sw2 を押すことでも run/stop と同様の動作をさせることができます。

 

Note: While running, UART input is not working well, so I recommend to use sw2 instead.

注意:測定動作中は UART からの受信が不安定になりますので、代わりに sw2 を使用してください。

 

status: show current status / 現在のステータスの表示

020-status.JPG

 

single: Single Shot Mode / シングルショットモード

Measure only 1 screen full data including the trigger point and stop measurements.

トリガを含む一画面分の測定を行い停止する。

 

repeat: Repeat Mode / 連続モード

Repeat measurements.

測定を複数画面にわたり繰り返す。

 

interval: set interval between each screen measurement / 測定単位(画面)間の待ち時間

interva <time>

<time> : interval between screens in ms. / 画面間の待ち時間 (ms)

 

pwm: config test pwm signal output / テスト用 pwm 信号の設定

pwm <period> <compare>

<period> : period in us / 周期 (us)

<compare>: duty width / デューティ幅の設定

 

index: enable/disable an additional sweep signal to check the phase of screen.

index { 0 | 1 }

0: hide index signal, only ch number of signals will be generated

1: show index signal, 0 to num_data sweep signal will be generated

    this is a utitilty function to check if the signal and SerialPlotter screen is in sync

 

index: 画面の位相確認用のスウィープ信号の発生

index { 0 | 1 }

0: スウィープ信号を発生しません。

1: スウィープ信号を発生します、表示チャネルは指定したチャネル数+1になります。

 

 

SerialPlotter screen with PWM test signal and signal from a FuncGen program of FRDM-KL25Z

Note: Trigger Pos is 512 and at the Rising Edge of channel 1 (which is the output of test PWM)

 

FRDM-KL25Z 上で動作しているファンクジェンとテスト用PWMの出力を観測した SerialPlotter の画面。

トリガは PWM 出力の上りエッジにかけて、左から 512 ポイントの位置に表示されるように

設定されています。

003-serial-plot.JPG

 

SerialPlotter screen with DE10-Lite FPGA board running simple counter program.

The clock input is a push switch (KEY1)

 

ED10-Lite FPGA 基板にて簡単なカウンタプログラムを動作させて場合の SerialPlotter 画面。

カウンタのクロック入力はプッシュスイッチ (KEY1) になっています。

IMG_4472.JPG

 

Upper signal is raw input from the push switch.

Lower signal is  "debounced" signal of the push switch

 

上の信号がプッシュスイッチからの生の信号

下の信号がデバウンスを通した後の信号

011-debounce-2.JPG

 

moto

P.S. As written in the introduction, this is a one day hack. So please do not expect perfect flawless stuff.

追伸:冒頭にありますように、一日のやっつけ仕事です、間違っても完全・完璧などは期待しないでください。

2 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Motoo,

For those students who have no USB-UART converter, they can use built-in converter inside PSoC5, pins 12.6 and 12.7 on the PSoC5 header. Just connect two wires.

/odissey1

MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear /odissey1-san,

Thank you for the suggestion!

The good news is this time all the students have the USB-Serial Converter as it wlll be required in some project for the FPGA board.

But meantime, I'm afraid that I have already used P12[6] and P12[7] for the UART named "DATA_OUT",

as an oscilloscope the data_out is more important than the CLI, which could be fixed for a particular measurement.

Anyway, I will double check the schematic later 😉

Best Regards,

25-Aug-2020

Motoo Tanaka

0 Likes