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++;
}
}
Solved! Go to Solution.
PORTA26 LPSPI1_PCS0 TP17
PORTA27 LPSPI1_SOUT J4 pin6
PORTA28 LPSPI1_SCK J4 pin9
PORTA29 LPSPI1_SIN J4 pin12
Thanks Robin issue got fixed
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.
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.
-------------------------------------------------------------------------------
Did you power the board by external 12V? ("2.8 SPI" of AN5413 S32K1xx Series Cookbook mentioned that)
yes external 12v
Below signals are measured on S32K148EVB-SCH-29644-RB. J8 1-2 (P5V0_V1SBC P5V0). J7 2-3 (VDD P5V0)
and also where we can check data?
PORTA26 LPSPI1_PCS0 TP17
PORTA27 LPSPI1_SOUT J4 pin6
PORTA28 LPSPI1_SCK J4 pin9
PORTA29 LPSPI1_SIN J4 pin12