KW38 can not communication with NCJ38A by SPI interface

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

KW38 can not communication with NCJ38A by SPI interface

1,291 Views
lfl
Contributor I

Hi,

During usecases debug, I found the KW38 chip board can not communication with NCJ38A by SPI interface. Current the SPI config is using SPI0(0x4002C000u), master mode, clock freq is 500kHz, 8bits/frame, MSB first, blocking transfer data using polling. I check the sending data already in PUSHR, but the reading data is 0xFF. Can you help point it out which SPI parameter configuration is incorrect in KW38 chip board?

    .whichCtar = kDSPI_Ctar0, // 0
    .ctarConfig = {
        .baudRate = 500000,
        .bitsPerFrame = 8,
        .cpol = kDSPI_ClockPolarityActiveHigh, // 0
        .cpha = kDSPI_ClockPhaseFirstEdge,   // 0
        .direction = kDSPI_MsbFirst,
        .pcsToSckDelayInNanoSec        = 1000,
        .lastSckToPcsDelayInNanoSec    = 1000,
        .betweenTransferDelayInNanoSec = 1000,
    },
    .whichPcs = (dspi_which_pcs_t)0,
    .pcsActiveHighOrLow = kDSPI_PcsActiveLow,  // 1
    .enableContinuousSCK = (bool) 0,
    .enableRxFifoOverWrite = (bool) 0,
    .enableModifiedTimingFormat = (bool) 0,
    .samplePoint = kDSPI_SckToSin0Clock // 0
Tags (1)
0 Kudos
Reply
10 Replies

757 Views
Yunping
Contributor I

Hi Eduardo
I am use the KW38 + NCJ29D5D, and I use SPI to communication between them, but KW38 fail to write data to NCJ29D5D,
There exsist the best practice demo? 

0 Kudos
Reply

1,068 Views
Yunping
Contributor I

Did this  issue already resolved yet? I got a same issue,I used the FRDM-KW38 and use the SPI demo and I can get the successful result between the 2 boards.but when I change the SPI1 to SPI0, and GPIO 

CLOCK_EnableClock(kCLOCK_PortC);

 

/* PORTC16 (pin 45) is configured as SPI0_SCK */

PORT_SetPinMux(PORTC, 16U, kPORT_MuxAlt2);

 

/* PORTC17 (pin 46) is configured as SPI0_SOUT */

PORT_SetPinMux(PORTC, 17U, kPORT_MuxAlt2);

 

/* PORTC18 (pin 47) is configured as SPI0_SIN */

PORT_SetPinMux(PORTC, 18U, kPORT_MuxAlt2);

 

/* PORTC19 (pin 48) is configured as SPI0_PCS0 */

PORT_SetPinMux(PORTC, 19U, kPORT_MuxAlt2);

Then, Master can not communication with Board B, any demo for change SPI1 to SPI0, I cost too much time on it 

0 Kudos
Reply

1,045 Views
lfl
Contributor I

@Yunping 

I'm very sorry. I haven't solved it yet. I can not provide further assistance.

Tags (1)
0 Kudos
Reply

1,036 Views
Yunping
Contributor I

Thanks for your reply, I have resolved it, Just the slave device need 16bit and 1MHz clock, I changed the master's setting and it works well now

0 Kudos
Reply

1,271 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hello @lfl

Hope you are doing well.

Just co confirm, are you using a custom board or is it a FRDM-KW38 development board?

By any chance, is your project based on any of the SPI driver example projects (included in driver_examples > dspi) from the KW38 SDK? If that is not the case, are you using any other demo application from the SDK as base for your development?

Could you please share your SPI pins initialization/configuration? Also, maybe it would be helpful if you could provide a capture of the data exchange using a logic analyzer/oscilloscope.

Regards,
Eduardo.

0 Kudos
Reply

756 Views
Yunping
Contributor I
Hello Zamora,
I use the KW38 + NCJ29D5D,but the spi cs can not set by software, so can not communication with ncj29d5d, is there any way to control ncj29d5d?
0 Kudos
Reply

1,254 Views
lfl
Contributor I

Hello Zamora,

Thanks for your reply.

Current use the FRDM-KW38 development board and run the demo SDK of ncj38a_KW38_**** example project.

The SPI pins configuration(pin/port/pin_addr/pin_idx) is default as follows:

SPI_SI    /PORTC17 (number 46) /0x4004B000u /17U
SPI_SCK/PORTC16 (number 45) /0x4004B000u /16U
SPI_CS  /PORTA19 (number 07)  /0x40049000u /19U
SPI_SO  /PORTC18 (number 47) /0x4004B000u /18U

The sending data and reading data is ok in the loopback mode in FRDM-KW38 development board.  Whether the parameter of SPI0_CS(0 or 1), clock freq(500kHz or 24MHz), CPOL/CPHA(b00, b01, b10 or b11) is not right? Whether need any additional configurations?

 

0 Kudos
Reply

178 Views
Shure
Contributor I
Hello lfl
How can I get ncj38a_KW38_**** example project? I cannot find it from SDK 2.6.15
Thx.
Tags (1)
0 Kudos
Reply

1,234 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

I sent you a private community message.

Regards,
Eduardo.

0 Kudos
Reply

1,226 Views
lfl
Contributor I

Hi Eduardo,

OK. Thanks for your reply again.

0 Kudos
Reply