S32K344 SPI Clock line signal hops before data transmission

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

S32K344 SPI Clock line signal hops before data transmission

5,146 Views
ZDDL
Contributor III

I wanted to use SPI, but found that there was a signal hops on the clock line before the actual data transfer.

How to eliminate this hop?

I will use the mode without CS line, this hop will affect the actual data transmission.

SPI6.png

0 Kudos
Reply
8 Replies

5,003 Views
robthedude
Contributor I

Thank you for the information about the errata -- I had downloaded errata for the SK32311 yesterday, and this particular one is not noted there.  Can you share a link to the specifics about this errata?

I enabled ERR_IPV_LPSPIV2_E050456 in my code, but the behavior did not change -- still a clock glitch.

However, I then also enabled ERR_IPV_LPSPIV2_E050456_2ND_SOLUTION and the clock glitch is gone.  That's excellent.  (I'm still debugging communication issues with my peripheral, but the protocol no longer looks like it's got a glaring error in it.)

0 Kudos
Reply

4,974 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @robthedude 

Can you share a link to the specifics about this errata? Yes, refer to Mask Set Errata for Mask 0P55A/1P55A - Errata

0 Kudos
Reply

4,963 Views
robthedude
Contributor I

Thank you.  That document indicates it is for the S32K314, but doesn't mention the S32K311.  Can I assume it applies there as well (especially since the workaround seems to apply).

0 Kudos
Reply

4,959 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @robthedude 

Yes, the errata applies all K3XX devices. An as you saw, the RTD team implemented the software workaround on the LPSPI driver.

0 Kudos
Reply

5,027 Views
robthedude
Contributor I

I have determined where this clock glitch is coming from, but I do not yet know how to resolve it.

The glitch happens inside each call to Lpspi_Ip_AsyncTransmit when it calls Lpspi_TransmitTxInit.

Inside Lpspi_TransmitTxInit, the code updates the CCR register (technically only when FirstCmd==TRUE, but for the non-DMA case, I never see where FirstCmd gets set to anything other than TRUE).  To update the CCR register, it disables the SPI hardware:

     Base->CR &= ~LPSPI_CR_MEN_MASK;

This line makes the SCK signal go low (which I think is wrong -- the SPI SCK is active low, so disabling SPI shouldn't make it look active!).

A few lines later, we write to the TCR:

     Base->TCR = TransferCommand;

This line makes the SCK go high again, but only momentarily, because this is the command that starts the I/O.

I've tried a couple things, like not enabling/disabling if the CCR/CCR1 registers aren't changing (which was a little tricky, since the CCR1 is really derived from the low 16-bits of CCR), but doing so did not work -- the I/O never starts if we don't go through a disable/enable sequence. I also tried configuring the SCK pin as pull-up (hoping that would keep it high when the SPI was disabled), but it did not change the behavior.

I definitely need a way to get rid of this clock glitch. My peripheral device does not use the CS signal -- it assumes it's always the chosen SPI peripheral -- and uses the CLK signal to control I/O. With a glitching clock signal, there's not a way to synchronize with just 3 signals.

0 Kudos
Reply

5,014 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @robthedude 

There is an Errata (ERR050456) that affects Transmit and Receive FIFOs. In the Lpspi_TransmitTxInit function is necessary to reset the entire module using LPSPI_CR[RST] or by resetting the receive and transmit FIFOs separately.

VaneB_0-1725384087307.png

Both options are already implemented in the Lpspi_ErrataHandle() function.

A simple workaround is remove macro ERR_IPV_LPSPIV2_0001 from the compiling process.

0 Kudos
Reply

5,040 Views
robthedude
Contributor I

I am seeing this exact same issue on S32K311 (using the S32K31XEVB).  There's a "glitch" on the clock before the actual SPI transaction happens, and I believe that glitch is what is confusing my peripheral (the S32K311 is running in controller mode).

0 Kudos
Reply

5,111 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @ZDDL 

Are you using a custom board or an EVB? Have you already tried any of the available SPI examples? If so, did you observe the same behavior? Could you share your configurations?

 

BR, VaneB

0 Kudos
Reply