LPSPI - Tx/Rx bytes different at different Baud Rates

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

LPSPI - Tx/Rx bytes different at different Baud Rates

1,584件の閲覧回数
ManishKK
Contributor III

I am using S32K344 on MR-CANHUB eval board from NxP. On that I am using S32K as the master to communicate with SPI Aardvark adapter as a slave on LPSPI4.

I have observed the following:

  1. at 8Mhz, I see 5 bytes go out and 5 bytes come in, whereas
  2. at 4Mhz, 6 bytes go out and 6 bytes come in.

The application is using a SyncTransmit API to transmit 10 bytes. I dont understand why all the 10 bytes are not Tx'ed by the S32K as master.

Attaching the example for reference.

0 件の賞賛
返信
7 返答(返信)

1,569件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @ManishKK,

Can you scope the signal and check the parameters specified in the S32K3xx DS (Table 44. LPSPI).

It was specified using GPIO-STANDARD_PLUS pins (MSCR_DSE = 1) that have better slew rate (7.3 5.0V (4.5V - 5.5V) GPIO Output AC Specification).

Since there is an issue with the Master, can you try with SAMPLE = 0, so that the Master can sample SCK internally?

 

Thank you,

 

Best regadrs,

Daniel

0 件の賞賛
返信

1,489件の閲覧回数
ManishKK
Contributor III

With MR-CANHUB NxP S32K344 board, I captured the screenshot of CLK and CS at 8 Mhz with an IMU board as the slave. 

The CLK is unable to stay high.

0 件の賞賛
返信

1,485件の閲覧回数
ManishKK
Contributor III

Similarly, see screenshots of CS, CLK at 8 Mhz v/s 1 Mhz.

0 件の賞賛
返信

1,483件の閲覧回数
ManishKK
Contributor III

Another one at 4Mhz.

0 件の賞賛
返信

1,457件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @ManishKK,

As I mentioned in my first reply, the LPSPI specification in the DS was taken using GPIO-STANDARD_PLUS pins (MSCR_DSE = 1).

Because these pins have much better slew rate at a given capacitive load. Please refer to the DS, Table 26. GPIO Output AC Specification.

You use GPIO-STANDARD pin that can't drive the bus at this baudrate and the load (based on the waveforms you provided).

 

Best regards,

Daniel

 

 

0 件の賞賛
返信

1,563件の閲覧回数
ManishKK
Contributor III

Daniel, Hi.

My LPSPI config looks like this:

 

/* SPI controller SpiPhyUnit_0 configuration. */
const Lpspi_Ip_ConfigType Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_0_Instance_4 =
{
4U, /* Instance */
/* CR */
(uint32)0,
/* CFGR1 */
(uint32)(LPSPI_CFGR1_PINCFG(0U) | LPSPI_CFGR1_PCSPOL(0U) | LPSPI_CFGR1_MASTER(1U) | LPSPI_CFGR1_SAMPLE(0U)),
#if (LPSPI_IP_SLAVE_SUPPORT == STD_ON)
(boolean)FALSE,
#endif
#if (LPSPI_IP_DMA_USED == STD_ON)
(boolean)TRUE,
(uint8)0, /* txDmaChannel */
(uint8)0, /* rxDmaChannel */
#if (LPSPI_IP_ENABLE_DMAFASTTRANSFER_SUPPORT == STD_ON)
(uint8)4U, /* u8NumOfDmaFastTransfer */
Lpspi_Ip_CmdDmaFast_SpiPhyUnit_0,
U, /* Number of TCD Scatter Gather for Tx */
U, /* Number of TCD Scatter Gather for Rx */
Lpspi_Ip_ListTxDmaFastSGId_SpiPhyUnit_0,
Lpspi_Ip_ListRxDmaFastSGId_SpiPhyUnit_0,
#endif
#endif
LPSPI_IP_POLLING, /* Transfer mode */
(uint8)0U /* State structure element from the array */
#if (LPSPI_IP_DMA_USED == STD_ON)
,(boolean)FALSE /* If channels in HWunit are the same framesize. */
,(uint8)0U
#endif
};

As you can see, LPSPI_CFGR1_SAMPLE(0U)? Is this the parameter you are referring to by SAMPLE = 0?If it some other parameter, can you give me a full name (consistent with the one specified in Table 44)?

Thanks!

0 件の賞賛
返信

1,548件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Yes, this is the parameter.

Can you share the waveforms canptured by an analog oscilloscope?

What status does the Lpspi_Ip_SyncTransmit() function return?

I see you call the function before the scheduler is started, so we can exclude any FreeRTOS issues.

 

Thank you,

 

0 件の賞賛
返信