Manual use of MISO/MOSI pins while in SPI mode

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

Manual use of MISO/MOSI pins while in SPI mode

Jump to solution
2,575 Views
filo96
Contributor III

Hello,

I'm using a LPCXpresso55s28 board and this is the first time I use an NXP board.

I'm using this board to communicate with an ADC converter via SPI protocol. The communication is working well and I can read/write registers of this external ADC.

In order to communicate, I'm using FLEXCOMM7 accessible from the P17 connector.

However, one of the functionalities of this board requires to identify if the MISO pin changes status and another functionality requires a change in the MOSI pins status.

I noticed I can't route an SPI pin together with a PIO pin, so I think that I can't manually handle GPIO_PinWrite() and GPIO_PinRead() on MOSI and MISO pins.

Is it correct? Is there a workaround to solve this?

 

Thank you.

Labels (2)
0 Kudos
Reply
1 Solution
2,511 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I think it is okay to use FC7 as SPI master to communicate with external ADC.

This is the FC7 pin assignment:

PIO0_20   FC7_MOSI

PIO0_21   FC7_SCK

PIO0_19   FC7_MISO

 PIO1_20  FC7_SSEL1

All of them are connected to P17.

Regarding the logic reading of the SPI signal pin, I suppose that you can read the GPIO input register directly even if the pin are assigned as SPI instead of GPIO pins.

Hope it can help you

BR

Xiangjun Rong

 

 

View solution in original post

0 Kudos
Reply
4 Replies
2,517 Views
filo96
Contributor III

Firstly, I want to thank you for your answer.

I'd like to clarify that FLEXCOMM7 is as follows:

  • MOSI - PIO0_20
  • SCK - PIO0_21
  • MISO - PIO0_19
  • SSEL1 - PIO1_20 (I use this pin manually, not connected to the SPI driver).

And it's accessible from the connector P17 too.

I configured these pins by using the Pins configurator of MCUXpresso IDE.

 

My doubt regards the possibility to read/write the status of MISO/MOSI respectively, in order to exploit some of the extra features of my external ADC, as well as the SPI communication.

 

EDIT: I'm using an AD7124-8 AD converter.

0 Kudos
Reply
2,512 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I think it is okay to use FC7 as SPI master to communicate with external ADC.

This is the FC7 pin assignment:

PIO0_20   FC7_MOSI

PIO0_21   FC7_SCK

PIO0_19   FC7_MISO

 PIO1_20  FC7_SSEL1

All of them are connected to P17.

Regarding the logic reading of the SPI signal pin, I suppose that you can read the GPIO input register directly even if the pin are assigned as SPI instead of GPIO pins.

Hope it can help you

BR

Xiangjun Rong

 

 

0 Kudos
Reply
2,483 Views
filo96
Contributor III

I made some tests using FC7.

  1. DMA controller disabled on SPI + FC7_MISO used with GPIO_PinRead(GPIO,0,19) seems reading a square wave, despite is part of the SPI peripheral.
  2. DMA controller enabled on SPI + FC7_MISO used with GPIO_PinRead(GPIO,0,19) works too
  3. A manual write of FC7_MOSI doesn't work

So I can confirm what you said.

I used GPIO_PinRead() because it seems to read the GPIO input register, so I used this high level function.

 
0 Kudos
Reply
2,564 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

HI,

Based on LPC5528-EVK board, you want to use the FLEXCOMM7 as SPI module.

xiangjun_rong_0-1680827422801.png

 

This is the pin assignment:

PIO1_2   FC7_SCK

PIO1_3  FC7_MISO

PIO0_26   FC7_MOSI

PIO1_1   FC7_SSEL1

 

In the pin_mux.c in SDK project, I suppose you can add the api function so that  you can configure the pin as FC7 SPI pin.

 

For the PIO1_1, when the func is 5, the pin will function as HS_SPI_SSEL1

xiangjun_rong_1-1680828584341.png

So you can use the code to assign the FUNC as 5

#define IOCON_PIO_FUNC5 5

CLOCK_EnableClock(kCLOCK_Iocon);

const uint32_t port1_pin1_config = (/* Pin is configured as HS_SPI_SSEL1 */
IOCON_PIO_FUNC5 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);

IOCON_PinMuxSet(IOCON, 1U, 1U, port1_pin1_config);

 

Pls follow up the above line to configure the other pins such as PIO1_2, PIO1_3 and PIO0_26

BTW, you can not use GPIO_PinWrite()/GPIO_PinRead(), they are used to write or read a pin logic only when you have configure the pin as GPIO function.

Hope it can help you

BR

XiangJun Rong

 

 

 

 

0 Kudos
Reply