SPI Message for 32bit Transfer (MPC5744P) MBD Toolbox

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

SPI Message for 32bit Transfer (MPC5744P) MBD Toolbox

Jump to solution
1,927 Views
abhishek_kumar1
Contributor IV

Dear All

This question is similar to: SPI Communication Problem  but the suggested solution does not work

I want to transfer 32 bit SPI message for MPC5744P. 

What I tried (as attache _32bit model)

1. Attempt one (exactly as in SPI Communication Problem)

    I set the SPI frame size as 32 bit with continuous transfer as said in data sheet.

pastedImage_7.pngpastedImage_9.png

RESULT

I got a 16 bit frame data as seen in below snap shot (the clock is 16 bit, as the input data was 1 (seen in pink)). It takes 16 clock to transmit the data where it shall take only 8.

pastedImage_11.png

2. Attempt 2

I used 8 bit frame size 

pastedImage_12.png

Result

A bit better but data seems to be corrupted (as the input is [1 1 1 1], I expect the green box behavior and not the orange box, as shown below)

pastedImage_15.png

Please let me know how to deal with this problem.

Best Regards

Abhishek

ext-rafael.barbosa@chassisbrakes.com‌, mariuslucianandrei

Tags (1)
1 Solution
1,674 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

So for the first try - you can not have frame size set to more than 16 bits; only from 4 to 16 are supported by the hardware. As for your 2nd configuration, that was ok - 8 bit frame size, continuous transfer enabled. If you pair this with a [1 1 1 1] vector (uint8 type, so that we get 32 bits in total), everything should be fine.

pastedImage_6.png

So from what you can see here, having in mind that settings for clock are:

- clock polarity: active low

- clock phase: 1st edge

We can see that the first '1' is centered on the 8th negative edge of the clock, and it does not stretch on the 9th one. This is repeated over all 4 bytes.

I must specify that I've used instance 3 (SPI3) for convenience, with the following pins.  

pastedImage_7.png

Could you confirm that with this configuration, everything works?

Kind regards,

Razvan.

View solution in original post

3 Replies
1,675 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

So for the first try - you can not have frame size set to more than 16 bits; only from 4 to 16 are supported by the hardware. As for your 2nd configuration, that was ok - 8 bit frame size, continuous transfer enabled. If you pair this with a [1 1 1 1] vector (uint8 type, so that we get 32 bits in total), everything should be fine.

pastedImage_6.png

So from what you can see here, having in mind that settings for clock are:

- clock polarity: active low

- clock phase: 1st edge

We can see that the first '1' is centered on the 8th negative edge of the clock, and it does not stretch on the 9th one. This is repeated over all 4 bytes.

I must specify that I've used instance 3 (SPI3) for convenience, with the following pins.  

pastedImage_7.png

Could you confirm that with this configuration, everything works?

Kind regards,

Razvan.

1,674 Views
abhishek_kumar1
Contributor IV

Dear constantinrazvan.chivu

It works well (I tested with SPI2 and SPI3)

Just to add: We should use continuous transfer, for more than 16 bit transfer as mentioned in the Reference Manual. 

Best Regards,

Abhishek 

0 Kudos
1,674 Views
constantinrazva
NXP Employee
NXP Employee

Hello abhishek.kumar@chassisbrakes.com‌,

Glad to hear that! And you are correct, continuous transfer should be used for more than 16 bit transfers, with the mention that the you must make sure the transfer size (total bits transmitted) is a multiple of the frame size (for example you can't send 24 bits (transfer size) with 16 bit frame size).

Kind regards,

Razvan.