S32K144 spi continue sending problem

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

S32K144 spi continue sending problem

766 Views
fengc
Contributor I

Hello NXP TechSupport

I tried to use the SPI_MasterTransfer function of SPI PAL to send two signals,  the first signal was sent out, but the second signal was not sent out.

sending code:

su1_SPIwriteDate[0] = ((WriteAddr << 1U) & 0xFEU); su1_SPIwriteDate[1] = 1;//*pBuffer; su2_spiReadState = 1; su2_spiReadState = SPI_MasterTransfer(&spi1Instance, su1_SPIwriteDate, su2_SPIReadDate, 2);

init code:

SPI_MasterInit(&spi1Instance, &spi1_MasterConfig0);

config info(generated code (sdk3.0)):

spi_master_t spi1_MasterConfig0 =
{
.baudRate = 500000,
.ssPolarity = SPI_ACTIVE_HIGH,
.frameSize = 8,
.clockPhase = READ_ON_ODD_EDGE,
.clockPolarity = SPI_ACTIVE_HIGH,
.bitOrder = SPI_TRANSFER_MSB_FIRST,
.transferType = SPI_USING_INTERRUPTS,
.rxDMAChannel = 255U,
.txDMAChannel = 255U,
.callback = NULL,
.callbackParam = NULL,
.ssPin = 0,
.extension = NULL
};

spi_pal config.JPGspi waveform.JPG

Please help me see where the problem is

Thank you

0 Kudos
3 Replies

715 Views
tommyshelbyop
Contributor I

Hard to say.

Could you please attach a test project so that I can replicate the issue on my side?

 

Thank you,

0 Kudos

759 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I can see that two 8bit frames are clocked out as expected, so I would check memory at su1_SPIwriteDate if it contains expected data.

Regards,

Lukas

 

0 Kudos

744 Views
fengc
Contributor I

Hi,  lukaszadrapa

I checked su1_SPIwriteDate,
su1_SPIwriteDate [0]=0x14,
su1_SPIwriteDate [1]=0x1,
su1_SPIwriteDate [1] is deliberately fixed to 1, there should be no other place to modify it.

Otherwise, I tried to send single byte data twice like the following:

su2_spiReadState = SPI_MasterTransfer(&spi1Instance, (uint8 *)&su1_SPIwriteDate, (uint8 *)&su2_SPIReadDate, 1);

for(tu2_delay = 0; tu2_delay< 1000; tu2_delay++)
{
}

su2_spiReadState = SPI_MasterTransfer(&spi1Instance, &su1_SPIwriteDate[1], su2_SPIReadDate, 1);
for(tu2_delay = 0; tu2_delay< 1000; tu2_delay++)
{

}

As a result, the su1_SPIwriteDate[1] sent for the second time was sent correctly, but the first signal su1_SPIwriteDate[0]  was not sent.

0 Kudos