s32k314 spi clock and mode

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

s32k314 spi clock and mode

324 Views
rlaxortn
Contributor IV

hello. 

i am using s32ds RTD4.0.0 and s32k314. 

and i am developing spi communication. 

 

i test work well spi mode1,2 (cpol 0, cpha 1 / cpol0, cpha 0).

this modes work well.

but i should use spi mode 3 and it does not work well. data has crack. 

so i check clock. 

 

spi clock.

1.png

so before clock start, that has weird clock. 

why s32k314 make that? every modes are same. 

Fortunately, Modes 1 and 2 are read because their clock idle state is 0. However, Modes 3 and 4 are read when their clock idle state is 1, so a problem occurs due to the clock in that photo.

 

1. How can I get rid of that noise before the clock starts?

 

2. I am using PS0 for SPI communication. However, to receive data from the SPI-enabled IC chip, I need to set the CS (Critical State) to low via GPIO to receive 4 bytes to determine the data length, and then maintain the CS to receive data up to that length. Currently, I am receiving data by controlling the CS via GPIO as shown in the picture (for example only). Please let me know if there is a way to achieve this functionality by assigning it to PS0.

2.png

Note: SPI communication modes 1 and 2 work well, but modes 3 and 4 do not function properly. (Interesting data is inserted due to the clock.)

 

thank to help.

Tags (2)
0 Kudos
Reply
1 Reply

264 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rlaxortn

1.Regarding your first question, the clock is pulled low at the beginning, which is similar to a known issue description.

image.png

You can try modifying it as follows:

image.png

2.Regarding your second question, I don't understand why you didn't send the entire length of 4 + 19 = 23 bits at once, instead of sending 4 and 19 bytes separately.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2345522%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Es32k314%20spi%20clock%20and%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2345522%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ehello.%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20am%20using%20s32ds%20RTD4.0.0%20and%20s32k314.%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20i%20am%20developing%20spi%20communication.%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Ei%20test%20work%20well%20spi%20mode1%2C2%20(cpol%200%2C%20cpha%201%20%2F%20cpol0%2C%20cpha%200).%3C%2FP%3E%3CP%3Ethis%20modes%20work%20well.%3C%2FP%3E%3CP%3Ebut%20i%20should%20use%20spi%20mode%203%20and%20it%20does%20not%20work%20well.%20data%20has%20crack.%26nbsp%3B%3C%2FP%3E%3CP%3Eso%20i%20check%20clock.%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Espi%20clock.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%221.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%221.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%221.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F381328i903EB94FCB76BBA7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%221.png%22%20alt%3D%221.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Eso%20before%20clock%20start%2C%20that%20has%20weird%20clock.%26nbsp%3B%3C%2FP%3E%3CP%3Ewhy%20s32k314%20make%20that%3F%20every%20modes%20are%20same.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFortunately%2C%20Modes%201%20and%202%20are%20read%20because%20their%20clock%20idle%20state%20is%200.%20However%2C%20Modes%203%20and%204%20are%20read%20when%20their%20clock%20idle%20state%20is%201%2C%20so%20a%20problem%20occurs%20due%20to%20the%20clock%20in%20that%20photo.%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3E1.%20How%20can%20I%20get%20rid%20of%20that%20noise%20before%20the%20clock%20starts%3F%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3E2.%26nbsp%3BI%20am%20using%20PS0%20for%20SPI%20communication.%20However%2C%20to%20receive%20data%20from%20the%20SPI-enabled%20IC%20chip%2C%20I%20need%20to%20set%20the%20CS%20(Critical%20State)%20to%20low%20via%20GPIO%20to%20receive%204%20bytes%20to%20determine%20the%20data%20length%2C%20and%20then%20maintain%20the%20CS%20to%20receive%20data%20up%20to%20that%20length.%20Currently%2C%20I%20am%20receiving%20data%20by%20controlling%20the%20CS%20via%20GPIO%20as%20shown%20in%20the%20picture%20(for%20example%20only).%20Please%20let%20me%20know%20if%20there%20is%20a%20way%20to%20achieve%20this%20functionality%20by%20assigning%20it%20to%20PS0.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222.png%22%20style%3D%22width%3A%20851px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222.png%22%20style%3D%22width%3A%20851px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222.png%22%20style%3D%22width%3A%20851px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F381327i496F8758EFBAE5D1%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222.png%22%20alt%3D%222.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ENote%3A%20SPI%20communication%20modes%201%20and%202%20work%20well%2C%20but%20modes%203%20and%204%20do%20not%20function%20properly.%20(Interesting%20data%20is%20inserted%20due%20to%20the%20clock.)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Ethank%20to%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2346103%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32k314%20spi%20clock%20and%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2346103%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%40%3CSPAN%3Erlaxortn%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E1.Regarding%20your%20first%20question%2C%20the%20clock%20is%20pulled%20low%20at%20the%20beginning%2C%20which%20is%20similar%20to%20a%20known%20issue%20description.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20494px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20494px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F381412i994E51DEF7BEEE3D%2Fimage-dimensions%2F494x397%3Fv%3Dv2%22%20width%3D%22494%22%20height%3D%22397%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20try%20modifying%20it%20as%20follows%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20487px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20487px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F381411i11CA05C5605A59EB%2Fimage-dimensions%2F487x284%3Fv%3Dv2%22%20width%3D%22487%22%20height%3D%22284%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E2.Regarding%20your%20second%20question%2C%20I%20don't%20understand%20why%20you%20didn't%20send%20the%20entire%20length%20of%204%20%2B%2019%20%3D%2023%20bits%20at%20once%2C%20instead%20of%20sending%204%20and%2019%20bytes%20separately.%3C%2FP%3E%3C%2FLINGO-BODY%3E