SPI Communication Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI Communication Problem

Jump to solution
2,623 Views
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

Tags (3)
1 Solution
2,364 Views
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

View solution in original post

4 Replies
2,364 Views
zac42880
Contributor I

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

0 Kudos
Reply
2,365 Views
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,364 Views
lijiantaowy
Contributor III

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

2,364 Views
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.