SPI Communication Problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SPI Communication Problem

跳至解决方案
2,144 次查看
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 解答
1,885 次查看
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 回复数
1,885 次查看
zac42880
Contributor I

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

0 项奖励
1,886 次查看
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

1,885 次查看
lijiantaowy
Contributor III

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

1,885 次查看
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.