MPC5744P DSPI only use CTAR0

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

MPC5744P DSPI only use CTAR0

628件の閲覧回数
xuan
Contributor I

hello:

I have an application that needs 3 SPI slave devices to connect to 1 master device (MPC5744P), and the three slave devices have a difference on the clock and transfer attributes. So I want to use different CTARs register to link to the related slave devices, however, the SDK drivers do not seem to support this feature.

void ec_spi0_init(void)
{
DSPI(0).MCR.B.MSTR = 1; /* SPI Mode, Master or Slave */
DSPI(0).MCR.B.CONT_SCKE = 0;
DSPI(0).MCR.B.DCONF = 0; /* Configure DSPI_A in SPI, DSI or CSI configuration */
DSPI(0).MCR.B.PCSIS = 0b00000011;
DSPI(0).MCR.B.MDIS = !1; /* SPI Moudle enable */
DSPI(0).MCR.B.HALT = 1; /* Stop transfer */
DSPI(0).MODE.CTAR[0].B.DBR = DBR0; /* Duty cycle is configurable */
DSPI(0).MODE.CTAR[0].B.FMSZ = 0b0111;/* Frame size=8 */
DSPI(0).MODE.CTAR[0].B.PCSSCK = 0b01;/* PCS to SCK delay scaler, 3 */
DSPI(0).MODE.CTAR[0].B.CSSCK = 0b0100;/* PCS to SCK delay scaler, 32 */
DSPI(0).MODE.CTAR[0].B.ASC = 0b0100; /* After SCK delay scaler */
DSPI(0).MODE.CTAR[0].B.DT = 0b0100; /* Delay after transfer scaler */
DSPI(0).MODE.CTAR[0].B.CPOL = 0; /* Clock polarity, 0 means the inactive state of SCK is low, 1 means high */
DSPI(0).MODE.CTAR[0].B.CPHA = 1; /* Clock phase, 0 means data is captured on the leading edge of SCK */
DSPI(0).MODE.CTAR[0].B.LSBFE = 0; /* LSB first enable, 0: MSB first; 1: LSB first */
DSPI(0).MODE.CTAR[0].B.PBR = 0; /* Baud rate prescaler */
DSPI(0).MODE.CTAR[0].B.BR = 4; /* Baud rate scaler */

DSPI(0).MODE.CTAR[1].B.DBR = DBR0; /* Duty cycle is configurable */
DSPI(0).MODE.CTAR[1].B.FMSZ = 0b0111;/* Frame size=8 */
DSPI(0).MODE.CTAR[1].B.PCSSCK = 0b01;/* PCS to SCK delay scaler, 3 */
DSPI(0).MODE.CTAR[1].B.CSSCK = 0b0100;/* PCS to SCK delay scaler, 32 */
DSPI(0).MODE.CTAR[1].B.ASC = 0b0100; /* After SCK delay scaler */
DSPI(0).MODE.CTAR[1].B.DT = 0b0100; /* Delay after transfer scaler */
DSPI(0).MODE.CTAR[1].B.CPOL = 0; /* Clock polarity, 0 means the inactive state of SCK is low, 1 means high */
DSPI(0).MODE.CTAR[1].B.CPHA = 0; /* Clock phase, 0 means data is captured on the leading edge of SCK */
DSPI(0).MODE.CTAR[1].B.LSBFE = 0; /* LSB first enable, 0: MSB first; 1: LSB first */
DSPI(0).MODE.CTAR[1].B.PBR = 0; /* Baud rate prescaler */
DSPI(0).MODE.CTAR[1].B.BR = 3; /* Baud rate scaler */
DSPI(0).MCR.B.HALT = 0; /* Start transfer */
}

0 件の賞賛
返信
1 返信

602件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

regarding SDK drivers, a feedback was given here;
https://community.nxp.com/t5/S32-SDK/MPC5777C-DSPI-only-use-CTAR0/m-p/1096525

So as you wrote it is not supported in the SDK. Based your given code, SDK is not used, thus when filling PUSHR register with command+data you can simply select which CTAR and PCS will be used.

PetrS_0-1660563563246.png

BR, Petr

0 件の賞賛
返信