SPI Communication Problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SPI Communication Problem

ソリューションへジャンプ
2,624件の閲覧回数
lijiantaowy
Contributor III

When I use the MPC57XX MBD toolbox to configure SPI and communicate with power chip, the data structure required by the power chip is 16-bit, as shown in the figure below, but only the 8-bit data transmission can be configured in the toolbox. Is there any way to solve it?

pastedImage_2.png

pastedImage_3.png

タグ(3)
1 解決策
2,365件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello lijiantaowy@163.com,

For the SPI master transfer, in order to send more than one byte at once, you need to provide as input an array of uint8_t data type, as bigger as your frame should be.

For example if you want to send 16 bits, you need to declare the send variable as 1-d uint_t vector array of size 2.

pastedImage_1.png

Hope this helps,

Marius

元の投稿で解決策を見る

4 返答(返信)
2,365件の閲覧回数
zac42880
Contributor I

That frames should be 16 clock cycles that why spi communication should be long as that

0 件の賞賛
返信
2,366件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello lijiantaowy@163.com,

For the SPI master transfer, in order to send more than one byte at once, you need to provide as input an array of uint8_t data type, as bigger as your frame should be.

For example if you want to send 16 bits, you need to declare the send variable as 1-d uint_t vector array of size 2.

pastedImage_1.png

Hope this helps,

Marius

2,365件の閲覧回数
lijiantaowy
Contributor III

Thanks a lot, according to what you said, I have solved this problem.

2,365件の閲覧回数
constantinrazva
NXP Employee
NXP Employee

Hello lijiantaowy@163.com‌,

Just wanted to add that if you want to send more than 16b, you should enable continuous transfer. The only thing you should pay attention to is that the size of the transfer buffer must be a multiple of the frame size. Let's take an example: you want to send 32b on MPC5744p. The framesize on this chip is from 4b to 16b maximum (hardware support). You could select 8b frame size, enable continuous transfer and enter as input to the block a vector of 4 elements of type uint8.

Hope this helps,

Razvan.