Configuring LPC54113 Flexcomm Ports for SPI

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

Configuring LPC54113 Flexcomm Ports for SPI

1,478件の閲覧回数
jqln
Contributor I

Using the LPC54113 Microcontroller, I am attempting to configure Flexcomm 0 as an SPI Master. using the spi_sm_dma.c example provided in the instillation of MCUXpresso. Thus far I have modified the defines and pin muxing (as seen below) to change the SPI master from Flexcomm 5 to Flexcomm 0. The result of this change is a nonfunctional chip select and a clock signal that only outputs 8 cycles. Can anyone advise me on any other modifications that need to be made to get this configuration to work?

/*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/
//#define SPI0_FLEXCOMM 5 /* SPI0 (master) is FLEXCOMM 5 */
//#define LPC_SPIMASTERPORT LPC_SPI0 /* Master SPI port */
//#define SPIMASTERIRQHANDLER SPI0_IRQHandler /* Master IRQ handler */
//#define LPC_SPIMASTERIRQNUM SPI0_IRQn /* Master IRQ number */
//#define SPI_MASTER_SSEL 2 /* Master select line */

#define SPI0_FLEXCOMM 0 /* SPI0 (master) is FLEXCOMM 0 */
#define LPC_SPIMASTERPORT LPC_SPI0 /* Master SPI port */
#define SPIMASTERIRQHANDLER SPI0_IRQHandler /* Master IRQ handler */
#define LPC_SPIMASTERIRQNUM SPI0_IRQn /* Master IRQ number */
#define SPI_MASTER_SSEL 0 /* Master select line */

#define SPI1_FLEXCOMM 3 /* SPI1 (slave) is FLEXCOMM 3 */
#define LPC_SPISLAVEPORT LPC_SPI1 /* Slave SPI port */
#define SPISLAVEIRQHANDLER SPI1_IRQHandler /* Slave IRQ handler */
#define LPC_SPISLAVEIRQNUM SPI1_IRQn /* Slave IRQ number */
#define SPI_SLAVE_SSEL 0 /* Slave select line */

//#define LPCMASTERCLOCKRATE 4000000 /* SPI clock rate */
#define LPCMASTERCLOCKRATE 1400000
#define BUFFER_CT 32 /* Buffer RX / TX count */
#define SPI_IO_CT 32 /* I/O SPI transfer count */
#define PR_LINE 4 /* display 4 lines */
#define PR_ITEM 8 /* display 8 items / line */

/* Initializes pin muxing for SPI1 interface */
static void Init_SPI_PinMux(void)
{
/* Slave - Connect the SPI1 signals to port pins - Flexcomm 3 */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI1_SCK */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 12, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI1_MOSI */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI1_MISO */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 14, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI1_SSEL0 */

/* Master - Connect the SPI0 signals to port pins - Flexcomm 5 */
//Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 1, (IOCON_FUNC4 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_SSEL2 */
//Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 19, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_SCK */
//Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 20, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_MOSI */
//Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_MISO */

// Flexcomm 0
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 2, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_SSEL0 */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_SCK */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_MOSI */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 1, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGITAL_EN)); /* SPI0_MISO */

}

0 件の賞賛
返信
1 返信

1,465件の閲覧回数
Miguel04
NXP TechSupport
NXP TechSupport

Hi @jqln 

I recommend you to use MCUXpresso Config Tools, this will configure the pins you want and then you can check the code created by the tool to verify what you are missing. Here you will find the Config Tools documentation.

Let me know if you have another question.

Best Regards, Miguel.

0 件の賞賛
返信