Baud rates for DSPI in MPC5777M

cancel
Showing results for 
Search instead for 
Did you mean: 

Baud rates for DSPI in MPC5777M

1,099 Views
yalamandadosaky
Contributor V

Hi martinkovar , I am going to develop SPI driver for MPC5777M , I have seen your example for this. But I want to use different baud rates like 1MBPS,2MBPS, 4 ,8 ,10 , 20  and 40 MBPS.I am able to configure  2MBPS ,4 MBPS, 8MBPS, 10MBPS and communication is happening fine. But for 20 and 40 are not working (MSTR -> SLAVE data is transferring correctly but SLAVE ack received at MSTR is different value.)

The below are my configuration settings for different baud rates. I am using 80MHZ clock freq.

/*
     * FMSZ (Frame size) = 0xF
     * PBR (Baud Rate Prescaler) = 0x2 - Baud Rate Prescaler value is 5
     * CSSCK(PCS to SCK Delay Scaler) = 1 Delay Scaler value is 4
     * BR (Baud Rate Scaler) = 4 - Baud Rate Scaler value is 16
     * DBR (Double Baud Rate) = 0
     *
     * SCK baud rate = (fsys/PBR) * [(1+DBR)/BR]
     * SCK baud rate = (80MHz/5) * [(1+0)/16] = 1MHz
     */

      DSPI_3.MODE.CTAR[0].R = 0x78021004;-->1MBPS
     *DSPI_3.MODE.CTAR[0].R = 0x78011004;-->2MBPS
     *DSPI_3.MODE.CTAR[0].R = 0x78011003;-->4MBPS
     *DSPI_3.MODE.CTAR[0].R = 0x78011001;-->8MBPS
     *DSPI_3.MODE.CTAR[0].R = 0x78021000;-->10MBPS

 Can you please help me how to configure CTAR for 20 and 40 mbps baudrates.

I have one more doubt that what is the  Maximum baudrate can we configure ?

5 Replies

523 Views
yalamandadosaky
Contributor V

Hi martinkovar‌ , Any update ?

0 Kudos

523 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

if you use 80MHz clock and you want to set 20 and 40 Mbps baud rate, please use following settings:

20Mbps:

PBR = 0x0 - Baud Rate Prescaler value is 2

DBR = 0x1

BR = 0x1 - Baud rate scaler value is 4

SCK baud rate = (fsys/PBR) * [(1+DBR)/BR]

SCK baud rate = (80MHz/2) * [(1+1)/4] = 20Mb/s

40Mbps:

PBR = 0x0 - Baud Rate Prescaler value is 2

DBR = 0x1

BR = 0x0 - Baud rate scaler value is 2

SCK baud rate = (fsys/PBR) * [(1+DBR)/BR]

SCK baud rate = (80MHz/2) * [(1+1)/2] = 40Mb/s

I did not test, but it should work. Please check and let me know. If you use 80MHz clock, maximal baud rate is 40Mbps.

Regards,

Martin

523 Views
rp9493
Contributor II

Hi martinkovar, further info to you,  as we sent 0x5 master to slave we got the data 0x5,

and when we sent 0x12( 0x0001 0010) from slave to master as Ack , it is able to receive 0x9 (0x1001).

from the above we came to know that we are missing one bit ( 0x0001001?) = 0x9.

we are unable to find why it is happening , Can you please help us how to fix the above issue or any idea where could be the problem ?

0 Kudos

523 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi Rahul,

It looks that for such higher rates the Master samples SIN pin too early as delays of pads, traces becomes significant.

Can you post the scope screen of real SPI signals you have?

You can try to test Modified transfer format (MTFE=1) which allows to sample later in the SCK period.

BR, Petr

523 Views
rp9493
Contributor II

Not working in both cases  we got data from master to slave but we lost the data from slave to master.

0 Kudos