Problem With SPI on S32K148

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem With SPI on S32K148

1,167件の閲覧回数
RishikeshB
Contributor II

Hello NXP,

I am using below code but not able to see the waveforms on oscilloscope  correctly 

can you please check with the code and if any changes are required please let me know

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 PORTB */
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(3); /* 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)
{
uint8_t counter = 0;

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

}

}

0 件の賞賛
返信
1 返信

1,143件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi RishikeshB,

This question seems same as Problem with Chip Select S32K. I will answer the question there.


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 件の賞賛
返信