SPI Master example for LPC54618

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

SPI Master example for LPC54618

2,824件の閲覧回数
shaheenshamshad
Contributor III

I am using OM13094 kit with MCUXpresso IDE and SDK version 2.3.1.

I am trying to use SPI Master example and  J11 connector of the Kit.

SPI_j11.PNG

 I have used lpcxpresso54618_driver_examples_spi_spi_interrupt example and changed the SPI-SSEL pin in pin_mux.c file as:

const uint32_t port4_pin6_config = (/* Pin is configured as FC9_CTS_SDA_SSEL0 */
IOCON_PIO_FUNC2 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Input filter disabled */
IOCON_PIO_INPFILT_OFF |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT3 PIN30 (coords: K13) is configured as FC9_CTS_SDA_SSEL0 */
IOCON_PinMuxSet(IOCON, 4U, 6U, port4_pin6_config);

My Slave Controller (not NXP MCU) is configured as :

SPI_Params_init(&spiParams);
spiParams.frameFormat = SPI_POL1_PHA1;
spiParams.mode = SPI_SLAVE;
spiParams.transferCallbackFxn = transferCompleteFxn;
spiParams.transferMode = SPI_MODE_CALLBACK;
slaveSpi = SPI_open(Board_SPI_SLAVE, &spiParams);

So modified the SPI example for master controller (OM13094) as;

SPI_MasterGetDefaultConfig(&masterConfig);
sourceClock = EXAMPLE_SPI_MASTER_CLK_FREQ;
masterConfig.polarity = kSPI_ClockPolarityActiveLow;
masterConfig.phase = kSPI_ClockPhaseSecondEdge;
masterConfig.baudRate_Bps = 1000000U;
masterConfig.sselNum = (spi_ssel_t)EXAMPLE_SPI_SSEL;
masterConfig.sselPol = (spi_spol_t)EXAMPLE_SPI_SPOL;
SPI_MasterInit(EXAMPLE_SPI_MASTER, &masterConfig, sourceClock);

I am getting response as;

slave rcvd.PNG

Kindly help.

If you have other example code kindly share.

Regards,

SS

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

2,190件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi s s,

    Do you also change the EXAMPLE_SPI_SSEL to 1?

   Please note:

pastedImage_1.png

P4_6 is the SSEL1, so you need to modify code:

#define EXAMPLE_SPI_SSEL 0

to

#define EXAMPLE_SPI_SSEL 1

Then try it again.

Besides, I think you also can check the SPI bus wave, whether the SPI bus data have the problems.

If you don't modify the SSEL to PIO4_6, just use the original code P3_30, do you also have the problems?

The original code without modification we have tested, it has no problem.

So, I highly suggest you use the newest SDK, and try it again, please download it from this link:

https://mcuxpresso.nxp.com/en/welcome 

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,190件の閲覧回数
shaheenshamshad
Contributor III

Hi Kerry,

I have changed JS27 and install JP6.

Image of the connection below:IMG_20181009_130005.jpg

using example lpcxpresso54618_driver_examples_spi_spi_interrupt from  SDK version 2.4.1 but data from destination buffer is : The 63 data is wrong, the data received is 255.

regards,

SS

0 件の賞賛
返信

2,190件の閲覧回数
shaheenshamshad
Contributor III

Followed this thread LPC54618 SPI Interrupt example code not work and now the problem is solved.

0 件の賞賛
返信

2,190件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SS,

   So sorry for my later reply, a little overloaded.

   Yes, it's also relate to the board version which I have tested in the previous time.

   If you have the further question, just let me know.

 


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,190件の閲覧回数
shaheenshamshad
Contributor III

Hi Kerry,

Yes, I have changed SSEL to 1.

Ok, I am trying with P3_30 for which I have to change JS27 and will update you here soon.

Regards,

SS

0 件の賞賛
返信