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
};
Please help me see where the problem is
Thank you
Hard to say.
Could you please attach a test project so that I can replicate the issue on my side?
Thank you,
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
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.