CLK level error after S32K148 SPI initialization

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

CLK level error after S32K148 SPI initialization

Jump to solution
2,138 Views
Embedded_novice
Contributor III

HI.

When I call SPI_Init in the S32K148 microcontroller, the level of the CLK signal will change from a high level to a low level. However, in the software, I have configured CLK as a GPIO push-pull output with an initial high level output. At the same time, I have made software pull-up configuration and hardware pull-up as well. Why is it that the CLK level will only return to its original state after attempting to send any data on the SPI? Could you provide me with some ideas for troubleshooting?6fd994bdc6fe2788c73ef5857447af6a.png

0 Kudos
Reply
1 Solution
1,727 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice 

You are using an older software version. We recommend updating to the latest one so you can avoid known issues and get all the newest fixes and improvements.

View solution in original post

0 Kudos
Reply
7 Replies
2,092 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice 

From what you have described, it sounds like you want to manually control the CLK pin rather than letting the SPI module manage it. Is that correct?

Could you share your current configuration so we can check if there are any incorrect or missing settings? Also, have you tried the Spi_Transfer_S32K148 to see if the behavior changes?

 

BR, VaneB

0 Kudos
Reply
2,081 Views
Embedded_novice
Contributor III

HI. @VaneB 

I don't want to manually control the CLK pin. I still hope that the CLK pin is automatically controlled by the SPI component. However, my question is that I have set the CLK pin to a high level in the idle state, and I have also configured the SPI0_CLK pin in the PORT to be a high level initially. Theoretically, the CLK pin should remain at a high level from the completion of SPI initialization until the first communication arrives. But the current phenomenon is that the CLK pin is in a low level state from the completion of SPI initialization until the first communication arrives. Here is my configuration. Please check if there is any error.

0 Kudos
Reply
2,026 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice 

Sorry for the misunderstanding, and thank you for the clarification.

It is not strictly necessary to configure the CLK pin as high in the Port driver, since it is managed by the SPI driver.

I performed a test on my side using the S32K148EVB and the Spi_Transfer_S32K148 example. I modified the configuration so that the CLK pin is driven high by the Port driver and also set SpiShiftClockIdleLevel to HIGH. With these changes, I did not observe the behavior you described. Could you please try running the same example with these modifications and let me know if the behavior changes on your setup?

0 Kudos
Reply
1,882 Views
Embedded_novice
Contributor III
I've tried, but the problem still persists. Will this be related to the version of MCAL?
0 Kudos
Reply
1,827 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice 

Which software version are you using? On my side, I am using RTD version 3.0.0.

0 Kudos
Reply
1,794 Views
Embedded_novice
Contributor III
My MCAL version is S32K14X_MCAL4_2_RTM_HF1_1_0_2.
0 Kudos
Reply
1,728 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice 

You are using an older software version. We recommend updating to the latest one so you can avoid known issues and get all the newest fixes and improvements.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2294044%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2294044%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHI.%3C%2FP%3E%3CP%3EWhen%20I%20call%20SPI_Init%20in%20the%20S32K148%20microcontroller%2C%20the%20level%20of%20the%20CLK%20signal%20will%20change%20from%20a%20high%20level%20to%20a%20low%20level.%20However%2C%20in%20the%20software%2C%20I%20have%20configured%20CLK%20as%20a%20GPIO%20push-pull%20output%20with%20an%20initial%20high%20level%20output.%20At%20the%20same%20time%2C%20I%20have%20made%20software%20pull-up%20configuration%20and%20hardware%20pull-up%20as%20well.%20Why%20is%20it%20that%20the%20CLK%20level%20will%20only%20return%20to%20its%20original%20state%20after%20attempting%20to%20send%20any%20data%20on%20the%20SPI%3F%20Could%20you%20provide%20me%20with%20some%20ideas%20for%20troubleshooting%3F%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F372920iE1A825E8F3E6E0C4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20alt%3D%226fd994bdc6fe2788c73ef5857447af6a.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2294626%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2294626%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHI.%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F201913%22%20target%3D%22_blank%22%3E%40VaneB%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20want%20to%20manually%20control%20the%20CLK%20pin.%20I%20still%20hope%20that%20the%20CLK%20pin%20is%20automatically%20controlled%20by%20the%20SPI%20component.%20However%2C%20my%20question%20is%20that%20I%20have%20set%20the%20CLK%20pin%20to%20a%20high%20level%20in%20the%20idle%20state%2C%20and%20I%20have%20also%20configured%20the%20SPI0_CLK%20pin%20in%20the%20PORT%20to%20be%20a%20high%20level%20initially.%20Theoretically%2C%20the%20CLK%20pin%20should%20remain%20at%20a%20high%20level%20from%20the%20completion%20of%20SPI%20initialization%20until%20the%20first%20communication%20arrives.%20But%20the%20current%20phenomenon%20is%20that%20the%20CLK%20pin%20is%20in%20a%20low%20level%20state%20from%20the%20completion%20of%20SPI%20initialization%20until%20the%20first%20communication%20arrives.%20Here%20is%20my%20configuration.%20Please%20check%20if%20there%20is%20any%20error.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2294508%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2294508%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213197%22%20target%3D%22_blank%22%3E%40Embedded_novice%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFrom%20what%20you%20have%20described%2C%20it%20sounds%20like%20you%20want%20to%20manually%20control%20the%20CLK%20pin%20rather%20than%20letting%20the%20SPI%20module%20manage%20it.%20Is%20that%20correct%3F%3C%2FP%3E%0A%3CP%3ECould%20you%20share%20your%20current%20configuration%20so%20we%20can%20check%20if%20there%20are%20any%20incorrect%20or%20missing%20settings%3F%20Also%2C%20have%20you%20tried%20the%20Spi_Transfer_S32K148%20to%20see%20if%20the%20behavior%20changes%3F%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%2C%20VaneB%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2295193%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2295193%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213197%22%20target%3D%22_blank%22%3E%40Embedded_novice%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESorry%20for%20the%20misunderstanding%2C%20and%20thank%20you%20for%20the%20clarification.%3C%2FP%3E%0A%3CP%3EIt%20is%20not%20strictly%20necessary%20to%20configure%20the%20CLK%20pin%20as%20high%20in%20the%20Port%20driver%2C%20since%20it%20is%20managed%20by%20the%20SPI%20driver.%3C%2FP%3E%0A%3CP%3EI%20performed%20a%20test%20on%20my%20side%20using%20the%20S32K148EVB%20and%20the%20Spi_Transfer_S32K148%20example.%20I%20modified%20the%20configuration%20so%20that%20the%20CLK%20pin%20is%20driven%20high%20by%20the%20Port%20driver%20and%20also%20set%20SpiShiftClockIdleLevel%20to%20HIGH.%20With%20these%20changes%2C%20I%20did%20not%20observe%20the%20behavior%20you%20described.%20Could%20you%20please%20try%20running%20the%20same%20example%20with%20these%20modifications%20and%20let%20me%20know%20if%20the%20behavior%20changes%20on%20your%20setup%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2296099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2296099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213197%22%20target%3D%22_blank%22%3E%40Embedded_novice%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhich%20software%20version%20are%20you%20using%3F%20On%20my%20side%2C%20I%20am%20using%20RTD%20version%203.0.0.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2295606%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2295606%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EI've%20tried%2C%20but%20the%20problem%20still%20persists.%20Will%20this%20be%20related%20to%20the%20version%20of%20MCAL%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2296215%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2296215%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMy%20MCAL%20version%20is%20S32K14X_MCAL4_2_RTM_HF1_1_0_2.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2296801%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CLK%20level%20error%20after%20S32K148%20SPI%20initialization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2296801%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213197%22%20target%3D%22_blank%22%3E%40Embedded_novice%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20are%20using%20an%20older%20software%20version.%20We%20recommend%20updating%20to%20the%20latest%20one%20so%20you%20can%20avoid%20known%20issues%20and%20get%20all%20the%20newest%20fixes%20and%20improvements.%3C%2FP%3E%3C%2FLINGO-BODY%3E