Problem with Chip Select S32K

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problem with Chip Select S32K

跳至解决方案
3,289 次查看
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 项奖励
回复
1 解答
3,229 次查看
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 项奖励
回复
8 回复数
3,214 次查看
RishikeshB
Contributor II

Thanks Robin issue got fixed

0 项奖励
回复
3,280 次查看
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 项奖励
回复
3,272 次查看
RishikeshB
Contributor II

On board where will i find TP17

标记 (1)
0 项奖励
回复
3,256 次查看
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 项奖励
回复
3,252 次查看
RishikeshB
Contributor II

yes external 12v 

0 项奖励
回复
3,247 次查看
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 项奖励
回复
3,234 次查看
RishikeshB
Contributor II

and also where we can check data?

0 项奖励
回复
3,230 次查看
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 项奖励
回复