Problem with Chip Select S32K

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

Problem with Chip Select S32K

Jump to solution
2,109 Views
RishikeshB
Contributor II

Hello NXP,

I am working on SPI 

PFA of my waveform that i got for chip select  

blue one is clock and the yellow one is the chip select

i am not getting the correct waveform I am using the below code please check once and reply soon

waiting for your reply

 

#include "S32K148.h"
#include "device_registers.h"
#include "LPSPI.h"
#include "clocks_and_modes.h"

uint16_t tx_16bits = 0xFD00;
uint16_t LPSPI1_16bits_read;

void WDOG_disable (void)
{
WDOG->CNT=0xD928C520; /* Unlock watchdog */
WDOG->TOVAL=0x0000FFFF; /* Maximum timeout value */
WDOG->CS = 0x00002100; /* Disable watchdog */
}

void PORT_init (void)
{
/*!
* Pins definitions
* ===================================================
*
* Pin number | Function
* ----------------- |------------------
* PTA26 | LPSPI1_PCS0
* PTA27 | LPSPI1_SOUT
* PTA28 | LPSPI1_SCK
* PTA29 | LPSPI1_SIN
*/
PCC->PCCn[PCC_PORTA_INDEX ]|=PCC_PCCn_CGC_MASK; /* Enable clock for PORTA */
PORTA->PCR[26]|=PORT_PCR_MUX(3); /* Port B14: MUX = ALT3, LPSPI1_PCS0 */
PORTA->PCR[27]|=PORT_PCR_MUX(3); /* Port B15: MUX = ALT3, LPSPI1_SOUT */
PORTA->PCR[28]|=PORT_PCR_MUX(3); /* Port B16: MUX = ALT3, LPSPI1_SCK */
PORTA->PCR[29]|=PORT_PCR_MUX(5); /* Port B17: MUX = ALT3, LPSPI1_SIN */
}

int main(void)
{
/*!
* Initialization:
* =======================
*/
WDOG_disable(); /* Disable WDOG */
SOSC_init_8MHz(); /* Initialize system oscillator for 8 MHz xtal */
SPLL_init_160MHz(); /* Initialize SPLL to 160 MHz with 8 MHz SOSC */
NormalRUNmode_80MHz(); /* Init clocks: 80 MHz sysclk & core, 40 MHz bus, 20 MHz flash */
LPSPI1_init_master(); /* Initialize LPSPI 1 as master */
PORT_init(); /* Configure ports */

while(1)
{
uint32_t counter = 0;

LPSPI1_transmit_16bits(tx_16bits); /* Transmit half word (16 bits) on LPSPI1 */
LPSPI1_16bits_read = LPSPI1_receive_16bits(); /* Receive half word on LSPI1 */
counter++;
}

}

 

0 Kudos
1 Solution
2,049 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

PORTA26  LPSPI1_PCS0  TP17
PORTA27  LPSPI1_SOUT  J4 pin6
PORTA28  LPSPI1_SCK    J4 pin9
PORTA29  LPSPI1_SIN     J4 pin12

View solution in original post

0 Kudos
8 Replies
2,034 Views
RishikeshB
Contributor II

Thanks Robin issue got fixed

0 Kudos
2,100 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi RishikeshB,

Where did you measure the LPSPI1_PCS0 signal? The R283 on S32K148EVB is DNP, so you may need to measure the signal at TP17.

PTA26 LPSPI1_PCS0 S32K148EVB.pngPTA26 LPSPI1_PCS0 TP17 S32K148EVB.png

Seems that you are test the S32K148_Project_LPSPI bare metal example. Did you consider to test LPSPI SDK examples?


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,092 Views
RishikeshB
Contributor II

On board where will i find TP17

Tags (1)
0 Kudos
2,076 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Did you power the board by external 12V?  ("2.8 SPI" of AN5413 S32K1xx Series Cookbook mentioned that)

0 Kudos
2,072 Views
RishikeshB
Contributor II

yes external 12v 

0 Kudos
2,067 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Below signals are measured on S32K148EVB-SCH-29644-RB. J8 1-2 (P5V0_V1SBC P5V0). J7 2-3 (VDD P5V0)

TP17 S32K148EVB.jpgLPSPI1_SCK LPSPI1_PCS0.jpg

0 Kudos
2,054 Views
RishikeshB
Contributor II

and also where we can check data?

0 Kudos
2,050 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

PORTA26  LPSPI1_PCS0  TP17
PORTA27  LPSPI1_SOUT  J4 pin6
PORTA28  LPSPI1_SCK    J4 pin9
PORTA29  LPSPI1_SIN     J4 pin12

0 Kudos