MCU Tester, a Swiss Army Knife for PSoC (TSoC version)

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

IMG_4297.JPG

 

As some of you have already known, I have made this program for CY8CKIT-044, CY8CKIT-059, and CY8CKIT-062-BLE,

but as a yet another TSoC fan, I could not help doing this.

For those who don't know what TSoC is, it is a board with CY8C4146LQI-S433 and came with the "Transistor Gijutsu Magazine" in Japan.

 

ご存じの方もおいでのように、既にこのプログラムの CY8CKIT-044版、CY8CKIT-059版、CY8CKIT-062-BLE版を公開してきましたが、

やはりトラ技の TSoC 版を作らないわけにもいかないだろう(笑)と作ってみました。

ご存じではない方の為に、TSoC とは TQ出版 トランジスタ技術の 2019年5月号に付録としてついてきた

CY8C4146LQI-S433 搭載の PSoC 基板です。

 

Although I was expecting that the porting should be done with re-targeting the device and re-assigning pins,

but as CY8C4146LQI-S433 does not have UDB, I needed to use SCB version of SPI.

(And their APIs were slightly different, as usual 8-( )

 

デバイスを変えて、ピンのアサインだけし直せば、移植完了かなと期待していたのですが、

CY8C4146LQI-S433 には UDB が搭載されていないので、SPI には SCB  タイプを使用する必要がありました。

(で、例によって API もちょっとずつ違うし・・・)

000-SPI.JPG

And the pin assignment(s)

000-TSoC_MCU_Tester_Pins.JPG

 

But with this board the real work was after building the project.

Since the only user interface the board implemented was a LED on P0[3].

So I needed add

(1) A switch at P0[2]

(2) USB-Serial P1[0], P1[1] (KitProg provided them)

(3) I2C pull-up resistors and an I2C sensor (I used LM75B from the URL below)

丸文

(4) a POT to test ADC at P2[0]

(5) a LED to test PWM at P0[7]

(6) SPI, only pins were assigned

The result connection was like below

Note: The connection schematic was updated on 6-Jun-2022.

 

しかし、今回の仕事はむしろプロジェクトがビルドできてからでした。

TSoC が提供してくれているユーザーインターフェースが P0[3] の LED のみという思い切った構成の為

以下の外付け部品を用意しました。

(1) P0[2] にスイッチ

(2) P1[0], P1[1] に USB-Serial (KitProg の P12[7], P12[6]を使用)

(3) I2C 用に外付けのプルアップ抵抗と、I2C センサ (今回は下記 URL から LM75Bを使用しました)

丸文

(4) P2[0] に ADC 用の POT を接続

(5) P0[7] に PWM 実験用 LED を接続

(6) SPI にはピン設定だけで済ませてしまいました。

結果としては下記のような接続図になりました。

※回路図は 6-Jun-2022 に修正版になっています。

001-Connection_Schematic.JPG

For a detailed command description, please refer to the CY8CKIT-044 version

 

コマンドの詳細は CY8CKIT-044 版をご覧ください。

 

MCU Tester, a Swiss Army Knife for PSoC (CY8CKIT-044 version)

 

So only a brief usage in this discussion.

 

このスレでは簡単な使用方法だけ説明します。

 

When the project is programmed and started, the top-level command menu will be displayed.

 

プログラムをダウンロードして起動すると、トップレベルのコマンドメニューが表示されます。

 

001-startup.JPG

 

=== Memory ===

Entering "mem" at the prompt will change mode to "memory test" mode.

The prompt is now "mem> "

Command "dump 0x00" shows the memory contents of the first 256 bytes from 0x00.

Note: Although I wrote a command "write" use it at your own risk.

Entering "return" at the prompt return you to the top-level command.

 

プロンプトで “mem” と入力するとメモリーテストモードに入ります。

プロンプトが "mem> " に変わりました。

”dump 0x00" と入力すると 0x00 から 256 バイトのメモリの内容を表示します。

注意:とりあえず “write” コマンドも作ってはみましたが、使い方にはご注意ください。

プロンプトで "return" と入力するとトップレベルのコマンドに戻ります。

002-mem.JPG

 

=== GPIO ===

 

Entering "gpio" at the top-level prompt let you enter "gpio test" mode.

Entering "write 0" will turn the on board LED OFF.

Entering "write 1" will turn the on board LED ON

Entering "read" will read the current value of GPIO pins.

"loop 20" sets the repeat number to 20

"interval 500" sets the interval between each loop 500ms

"run" will start the test loop.

Note: In this test I pushed and released the external switch a few times.

 

トップレベルのプロンプトに "gpio" と入力すると、“gpio test” モードに入ります。

“write 0” と入力すると、基板上の LED が消えます。

"write 1" と入力すると、基板上の LED が点灯します。

”read" と入力すると、GPIO の値を読みます。

"loop 20" と入力すると、繰り返し回数を 20回に設定します。

"interval 500" と入力すると、各ロープ間の待ち時間を 500ms に設定します。

"run" と入力すると、設定した loop 回、interval ms の間をあけて試行を行います。

下記の例では、実行中に外付けのスイッチ (IN) を何度か押したり、離したりしました。

 

003-gpio.JPG

 

=== ADC ===

The following is the screen shot of "adc test" mode.

"measure" triggers a single shot ADC reading.

"loop" and "interval" works just like "gpio test" mode.

In this example, I turned the POT from max to min and back.

 

下記は "adc test" モード実行時の画面コピーです。

"measure" を入力すると、一回だけ ADC 測定を行います。

”loop" と "interval" は前述の "gpio test" モードと同様に機能します。

下の例では、実行中に POT を最大から最小へ、そして少し戻すということをしました。

004-adc.JPG

 

=== i2c ===

Entering "scan" command will let the I2C module scan the bus for the devices.

This command is handy when you have a device with unknown address.

Note: But some device requires to be addressed before they starts functioning,

for such device(s), this does not work.

 

In my test, LM75B had the adress 0x48.

So I set the slave address by entering "slave 0x48".

Then I can read/write from/to the device.

 

"scan" と入力すると、I2C バス上に存在するデバイスをスキャンします。

これはアドレスが分からない I2C デバイスのアドレスを知るときなどに便利です。

※直接そのアドレスにコマンドを送らないと、起きないデバイスもあり、

 そういったデバイスの場合にはスキャンに引っかからない場合もあります。

 

今回のテストでは LM75B のアドレスは 0x48 でした。

"slave 0x48" と入力するとスレーブアドレスが 0x48 に設定されて

移行の read/write コマンドはそのスレーブを対象に行われます。

005-i2c.JPG

 

=== PWM ===

For the PWM test, we can set the "period" and "compare" or set both at once with "config"

Entering "period 1000" and "compare 500" makes the external LED toggles blinks a few time per sec.

Entering "config 10000 5000"  makes the blinking 10 times slower.

Entering "config 100 90" makes the LED very bright.

Entering "config 100 30" dims it and "Config 100 0" will turn LED off.

 

PWM のテストでは周期を "period" で、デューティを "compare" で個々に設定するか

"config" でまとめて設定することが可能です。

”period 1000" と "compare 500" と入力すると外付けの LED が秒間数回点滅します。

"config 10000 5000" と入力すると点滅が 10倍遅くなります。

”config 100 90" と入力すると LED は明るく光ります。

"config 100 30" と入力すると LED は大分暗くなります。

"config 100 0" と入力すると LED は消灯します。

006-pwm.JPG

 

=== SPI ===

As I did not have appropriate SPI device, I just used MISO and MOSI for testing.

At first I enter "write 32" (Note this 32 is decimal)

Then SPI module sent out 32 and received a byte.

At this point, I was not connecting anything to the MISO, the value read was at the mercy of the board.

This time it returned 0.

Then I connected MISO to the VDD and entered "write 32",

it returned 0xFF (255) as the value read.

Next I connected MISO to the GND and no wonder the return value was 0

Finally, I connected MISO to the MOSI and I entered "write 32"

the read value was also "0x30 (32)".

To show that the SPI is working, I entered "write 33" and the returned value was also "0x21 (33)"

 

SPI のテスト用には適当なデバイスが見当たらなかったので、直接 MISO と MOSI を使用しました。

最初に MISO と MOSI を浮かせたままで "write 32" (この 32 は十進です)と入力しました。

この場合の読み込み値は基板や周囲の状況に依存するのですが、今回は 0 が返ってきていました。

次に、MISO を VDD に接続して、"write 32" と入力したところ

読み込み値は 0xFF (255) でした。

また、MISO を GND に接続して、"write 32" と入力したところ

読み込み値は 0x00 (0) でした。

最後に MISO と MOSI をジャンパで接続して "write 32" と入力したところ

読み込み値は 0x20 (32) でした。

念のために "write 33" と入力したところ

読み込み値は 0x21 (33) で、これも期待通りの値でした。

007-spi.JPG

 

Now let me call it a day!

 

それでは今回はこの辺で!

 

moto

P.S. On 6-Jun-2022, it was found that in the top-level connection schematic,

SWD_CLK and SWD_DATA were connected to the wrong pins.

So connection diagram was updated.

This was a documentation level error and should not have effected the project

nor its behavior. But if a user connected TSoC and KitProg following the connection 

diagram, the symptom would have been that in the Select Debug Target,

KitProg will be detected, but PSoC 4100S won't be.

The good news is that for this two years no complaint about this was posted in this discussion.

The bad news is ... I wonder if there is/are people using this project on this planet?

 

2022年6月6日、トップレベルの接続図上で SWD_CLK と SWD_DATA が

逆のピンに接続されていることがわかりましたので、修正しました。

これはドキュメントレベルの間違いでしたので、プロジェクトの内容や

実動作には影響がなかったと思われますが、接続図にしたがって TSoC と KitProg を

接続してしまった場合、KitProg は認識されるが、PSoC 4100S は認識されないという

状態になっていた恐れがあります。

良い知らせとしては過去2年間、この問題についての苦情がこのスレに投稿されることはありませんでした。

悪い知らせとしては、そもそもこのプロジェクト使った人がこの惑星上に存在していなかったかもという・・・

2 Replies
Takashi_M
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 750 replies posted

Dear Moto-san,

thank you very much for sharing your CE.

regards.

0 Likes
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

Hi,

 

I added schematic page enable/disable support.

Except tty, each schematic page can be enabled/disabled before compiling the project.

 

tty 以外の回路図ページを個別にenable / disable 出来るようになりました。

テストしたいコンポーネント以外のページを disable することで、必要なコンポーネントだけのテストが可能になりました。

 

Please refer to the description in the following sample.

使用方法は下記のサンプルページをご参照ください。

 

PSoC Creator Schematic Page Enable/Disable Sample

 

moto

0 Likes