Community Translation - PSoC 3/5LP SPI-DMA 16-bit Operation – KBA223730

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

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

Hi,

I'd like to translate KBA223730 into Japanese

moto

Original KBA: KBA223730

PSoC 3/5LP SPI-DMA 16-bit Operation – KBA223730

Translated by: MoTa_728816

==============================

タイトル: PSoC 3/5LP SPI-DMA の 16-bit オペレーション - KBA223730

ヴァージョン: **

質問:

PSoC® 3/5LP で 16-bit データの送受信を DMA で行うのにはどのようにしたら良いですか?

回答:

手始めに PSoC Creator の サンプルコード SPI Master with DMA と SPI Slave with DMA を使用してください。

PSoC Creator で、メニューから File > Code Example を選択します。図 1 のように Filer by のキーワードに “DMA” を指定することで関連するサンプルコードを検索することも可能です。PSoC 5LP と同様に PSoC 3 でも同じサンプルコードが用意されています。

001-pastedImage_1.png

図 1.  PSoC Creator SPI-DMA サンプルコード

サンプルコードではデータビットは 8-bits になっています。以下の手順に従って、SPI を 16-bit 転送モードに変更してください。

1. SPI のデータ長を 8 から 16 に変更する。図 2 参照

002-pastedImage_16.png

図 2. SPI Master のデータ長の設定

2. DMA のバースト長を1 バイトから 2 バイトに変更します。 main.c の 37 行目へ移動してください。既にある行を下記のように修正してください。

#define DMA_TX_BYTES_PER_BURST     (2u)

同様にして、すべての DMA チャネルのバースト長を変更してください。

3. 下記の定義を SPI TX と SPI RX にそれぞれ適用してください。

   

       main.c line 145

CyDmaTdSetAddress(txTD, LO16((uint32)txBuffer), LO16((uint32) SPIM_BSPIM_sR16_Dp_u0__16BIT_F0_REG));

    

      main.c line 179

CyDmaTdSetAddress(rxTD, LO16((uint32) SPIM_BSPIM_sR16_Dp_u0__16BIT_F1_REG), LO16((uint32)rxBuffer));

SPIM コンポーネントで提供されているポインタ定義は 16-bit オペレーションと互換性がありません。そのため、正常なオペレーションを行わせるためにはこれらのレジスタ定義を使用する必要があります。 SPIS_Example プロジェクトについても、このコードスニペットで SPIM コンポーネントに使用したものと同様に適切なポインタを使用してください。

==============================

7-May-2020

moto

0 Likes
1 Reply
JennaJo
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello, Tanaka-san

We receive your translation, it will be published to KBA to Community.

After upload, You will receive the points as the word of KBA.

Due to the current delay of processed work, Please bear with me for the delayed the response.

It could be delayed, but it will be processed soon.

Thanks for your contribution to CDC!

Will keep you update the status.

Thanks,

Jenna Jo

Jenna Jo
0 Likes