LPC5536 - SPI MISO is pulled high by board

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

LPC5536 - SPI MISO is pulled high by board

13,573件の閲覧回数
fr0stw1ng
Contributor I

Hi, as the title states the MISO pin in multiple connector positions for the HS SPI (SPI8) 
are pulled high by board and stay there even after SPI master init is called by all example programs including: 
* spi_HS_LSPI_dma_b2b_transfer_master
* spi_polling_b2b_transfer_master

Also tested flexcom2  as SPI without merit.


General result: Misopin is always pulled high from the moment the board is powered. 
The pin stays high even after calling SPI_MasterInit() function while other related pins get pulled to their setting. IE  CLK, MOSI pulled down and SS stays HIGH untill transfer is started. 
 This results in miso always being read as 0xFF when reading a byte even when miso pin is disconnected.
Unconnected slave miso shows actual data from the slave device. 

See results in Logic analyser below. 

2bytes, miso with or without slave connected to miso pin. miso ALWAYS high.2bytes, miso with or without slave connected to miso pin. miso ALWAYS high.2 bytes, miso data read from slave while not connected to LPC55362 bytes, miso data read from slave while not connected to LPC5536SPI pins before and after SPI_masterInit()SPI pins before and after SPI_masterInit()


What am i missing here? 
tested an other board with same code without results. 

ラベル(2)
0 件の賞賛
返信
24 返答(返信)

12,792件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that the spi includes 4 signals: /CS, SCK,MOSI and MISO. When the SPI is configured as master, the SCK, /CS and MOSI(master output slave in) are output signals driven by the SPI master, but the MISO(Master input slave output) is an input pin, it should be driven by slave MISO pin so that the master can receive data from slave, because the spi is a duplex interface.

Because the MOSI in master side is an input pin, when the pin is float, it is possible that master receive 0xFF because of internal pull-up resistor. If you connect the MOSI pin with an external  pull-down resistor, you will receive 0x00.

Hope it can help you

BR

XiangJun Rong

 

0 件の賞賛
返信

12,774件の閲覧回数
fr0stw1ng
Contributor I

Hi, 

To my knowledge the MISO pin of SPI as master is indeed an input.
Can i asume that you ment MISO in the second half of your post? Since your reply currently states the MOSI is both input and output?


Currently I treated the MISO pin as input and MOSI pin as output in all of my testing. 


As seen on the attachements of my previous post, the Mosi pin displays data like its supposed too. 
Its the MISO pin that stays high no matter the situation. (always 0xFF)
Even when the miso pin is only connected to a pulldown resistor(10k) I stilll receive 0xFF.
Its almost as if the MISO pin is set as an OUTPUT some how in all SPI example codes while it should be an input.

Checked example codes with 2 different boards with same result, All but MISO functioning on multiple spi interfaces (HS SPI & Flexcom2 as SPI) 


Also played arround with the pinsettings in the pins configtool. 
I tested the miso pin while specified as following:
Direction :: input, not specified, output
Mode :: inactive, pulldown, pullup 
Invert:: disabled, enabled
Opendrain:: disabled, enabled


TLDR : Master In Slave Out stays high even while pulled down by resistor and/or changing available Pins configTool settings. 




0 件の賞賛
返信

12,770件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As the following screenshot, the PIO1_3 pin is configured as HS_SPI_MISO function, in other words, when the SPI is configured as master, the PIO1_3 is an input pin, when the SPI is configured as slave, the PIO1_3 is an output pin.

You configured the HS SPI as master, so the PIO1_3 pin function as input, you have to configure the PIO1_3 FUNC bits as 6. BTW, pls try to use 1 K ohm pull-down resistor, then check the data you have received.

Hope it can help you

BR

XiangJun Rong

xiangjun_rong_0-1659346435568.png

 

0 件の賞賛
返信

12,768件の閲覧回数
fr0stw1ng
Contributor I

Hello, 

Pin PIO1_3 was already setup as HS_SPI_MISO function with the configtool. 
See provided picture. 

Schermafbeelding 2022-08-01 152005.png

As you can see the PIO1,3 pin has been setup as input. 
In previous post i said that played arround with direction, mode, invert, opendrain  settings for the pin as well.

I currently do not understand what you ment by "you have to configure the PIO1_3 FUNC bits as 6.

As for the external resistor, placing a 1k didnt change anything. 



0 件の賞賛
返信

12,763件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

#define IOCON_PIO_FUNC5 6

//configure the PIO1_3 as HS SPI MISO pin

CLOCK_EnableClock(kCLOCK_Iocon);

const uint32_t port1_pin3_config = (
IOCON_PIO_FUNC6 |
/* 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, 3U, port1_pin3_config);

 

Pls add above code in pin_mux.c

Hope it can help you

BR

XiangJun Rong

0 件の賞賛
返信

12,746件の閲覧回数
fr0stw1ng
Contributor I

Hi, 

The i found the following in pinmux already.
pinmux.png
Regardless I tried replacing and adding both resulting in only the chipselect functioning, no more clock or MOSI and the MISO still high. 

Note that i changed the provided function in your code IOCON_PIO_FUNC6 to IOCON_PIO_FUNC(6) since the function IOCON_PIO_FUNC6  was not found by IDE. 


i've attached pin_mux.c for you.

0 件の賞賛
返信

12,736件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

 

Because the bridge chip LPC55S69 also can communicate with the HS SPI, you have to disable the U24 by close the JP57 so that the HW_VER_2 node signal is low.

Pls close the JP57 and have a try.

BTW, can you tell us where you connect the PIO1_3 pin to GND via a pull-down resistor?

BR

XiangJun Rong

xiangjun_rong_0-1659512102004.png

 

0 件の賞賛
返信

12,732件の閲覧回数
fr0stw1ng
Contributor I

Hi, 

This whole time i thought i posted which board im working on.... 
The Board is: LPC5536-EVK. 

The pulldown resistor is connected to ground on JP8 and the other end is currently only connected to the miso connection on JP7(PIO1_3)  and a logic analyser. 

I've bridged JP57 didnt result in any changes on the misopin. 




0 件の賞賛
返信

12,728件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As the following Figure, the P1_3-CAN0_RD-PDM_DATA1-HS_SPI_MISO is hardware connected to CAN0_RXD via JP48 which is driven by the CAN transceiver.

I suggest you cut the line of the JP48 and have a try

BR

XiangJun Rong

xiangjun_rong_0-1659600785985.png

 

9,868件の閲覧回数
danielholala
Senior Contributor II

Hi, 

working with HS-SPI on the LPC5536-EVK, I have a similar observation.

Setup

The HS-SPI (Flexcomm8) is available through "mikroBUS" socket connector J7. 

On MISO (Pin 5 @ J7), I measure 3,3 V. This is because MISO-Signal "P1_3" is pulled HIGH by R425, according to the schematic:

danielholala_0-1698057881282.png

Problem

When I connect my SPI target (formerly known as "slave") and start a SPI transaction, MISO is pulled LOW by some unknown force. I don't know why this is. In any case, the target is unable to assert HIGH level on MISO.

Solution

 

Removing JP48 solves the problem.

danielholala_1-1698058430503.png

 

Explanation: Through JP48, MISO is connected to CAN0_RXD and the devices connected to CAN0_RXD (i.e., U25) obviously hamper SPI communication.

Notes

Maybe it's best to remove JP49, too, although it was not required with my setup.

J57 is not populated on my board and thus open. This means the USB-to-SPI bridge via U24 is enabled (according to the LPC5536 EVK user manual). Still this did not interfere with SPI communication in my setup.

I don't know why NXP has decided not to mention this in the LPCXpresso55S36 Development Board User Manual.

 

 

0 件の賞賛
返信

12,705件の閲覧回数
fr0stw1ng
Contributor I

Hi, 

Disconnecting JP48 resulted in miso still being driven high. 

As a test i've imported another example code and modded its contents to drive the PIO1_3
parallel to the led, stays high here too. whilst the led blinks as needed.
-Pin was set as output in with pins configtool, verified setting in pin_mux.c
-Signal stays high with pin connected or disconnected. 
-Output was still pulled down by a resistor to ground. 

TLDR: 
PIO1_3 stays high while set as GPIO Input, GPIO Output , MISO input
JP48 has no effect.

0 件の賞賛
返信

12,679件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

With the following code, I try to toggle the P1_3 based ion LPC5536-EVK board, I can toggle the P1_3 pin. I use the LED_blinky example and add the following code.

Hardware configuration.

1)Open pin1&2 of JP48, connect the pin1 of JP48 to scope

2)close the JP57 jumper, note that JP57 jumper is NOT populated, you can connect connect them with a cable or whatever.

Pls have a try.

BR

XiangJuin Rong

 

 

 

#include "fsl_gpio.h"

void P1_3_Toggle(void)
{
CLOCK_EnableClock(kCLOCK_Gpio1);

gpio_pin_config_t P1_3_config = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U
};
const uint32_t port1_pin3_config = (/* Pin is configured as PIO1_28 */
IOCON_PIO_FUNC0 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* 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);
/* PORT1 PIN28 (coords: 72) is configured as PIO1_28 */
IOCON_PinMuxSet(IOCON, 1, 3, port1_pin3_config);

GPIO_PinInit(GPIO, 1, 3, &P1_3_config);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
}

0 件の賞賛
返信

12,676件の閲覧回数
fr0stw1ng
Contributor I

Hello, 


Thank you for your reply, 

the piece of code does not seem to compile.. 

Using the code below to toggle multiple pins for testing. 
Pins: p1,28  p1,29  p1,25  p0,4 all seem to function as a GPIO output. 
p1,3 still does not (still high) even while configuring and measuring as described in your post. 

kind regards, 




/*
* Copyright 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#include "pin_mux.h"
#include "board.h"

/*******************************************************************************
* Definitions
******************************************************************************/
#define BOARD_LED_PORT BOARD_LED_RED_GPIO_PORT
#define BOARD_LED_PIN BOARD_LED_RED_GPIO_PIN

/*******************************************************************************
* Prototypes
******************************************************************************/

/*******************************************************************************
* Variables
******************************************************************************/
volatile uint32_t g_systickCounter;

/*******************************************************************************
* Code
******************************************************************************/
void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}

void SysTick_DelayTicks(uint32_t n)
{
g_systickCounter = n;
while (g_systickCounter != 0U)
{
}
}

/*!
* @brief Main function
*/
int main(void)
{
/* Init output LED GPIO. */
GPIO_PortInit(GPIO, BOARD_LED_PORT);
// GPIO_PortInit(GPIO, 1u); // io
GPIO_PortInit(GPIO, 0u); // io


/* Board pin init */
BOARD_InitPins();
BOARD_BootClockPLL150M();

/* Set systick reload value to generate 1ms interrupt */
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}

while (1)
{
/* Delay 1000 ms */
SysTick_DelayTicks(500U);
GPIO_PortToggle(GPIO, BOARD_LED_PORT, 1u << BOARD_LED_PIN);
GPIO_PortToggle(GPIO, BOARD_LED_PORT, 1u << 3);
GPIO_PortToggle(GPIO, BOARD_LED_PORT, 1u << 29);
GPIO_PortToggle(GPIO, BOARD_LED_PORT, 1u << 25);
GPIO_PortToggle(GPIO, 0, 1u << 4);


}
}




0 件の賞賛
返信

12,674件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I copy all the code here

BR

XiangJun Rong

/*
* Copyright 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#include "pin_mux.h"
#include "board.h"
#include "fsl_gpio.h"

/*******************************************************************************
* Definitions
******************************************************************************/
#define BOARD_LED_PORT BOARD_LED_RED_GPIO_PORT
#define BOARD_LED_PIN BOARD_LED_RED_GPIO_PIN
void P1_3_Toggle(void);
/*******************************************************************************
* Prototypes
******************************************************************************/

/*******************************************************************************
* Variables
******************************************************************************/
volatile uint32_t g_systickCounter;

/*******************************************************************************
* Code
******************************************************************************/
void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}

void SysTick_DelayTicks(uint32_t n)
{
g_systickCounter = n;
while (g_systickCounter != 0U)
{
}
}

/*!
* @brief Main function
*/
int main(void)
{
/* Init output LED GPIO. */
GPIO_PortInit(GPIO, BOARD_LED_PORT);
/* Board pin init */
BOARD_InitPins();
BOARD_BootClockPLL150M();

/* Set systick reload value to generate 1ms interrupt */
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}
P1_3_Toggle();
while (1)
{
/* Delay 1000 ms */
SysTick_DelayTicks(1000U);
GPIO_PortToggle(GPIO, BOARD_LED_PORT, 1u << BOARD_LED_PIN);
}
}
void P1_3_Toggle(void)
{
CLOCK_EnableClock(kCLOCK_Gpio1);

gpio_pin_config_t P1_3_config = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U
};
const uint32_t port1_pin3_config = (/* Pin is configured as PIO1_28 */
IOCON_PIO_FUNC0 |
/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* 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);
/* PORT1 PIN28 (coords: 72) is configured as PIO1_28 */
IOCON_PinMuxSet(IOCON, 1, 3, port1_pin3_config);

GPIO_PinInit(GPIO, 1, 3, &P1_3_config);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
}

0 件の賞賛
返信

12,668件の閲覧回数
fr0stw1ng
Contributor I

Hi, 

The code didnt result in any changes. 

Kind regards, 

0 件の賞賛
返信

12,666件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Set  break point at each  GPIO_PortToggle(GPIO,1,0x08);, you can see that the pin will toggle when you run step by step while the JP57 is short by cable.
BR

XiangJun Rong

 

GPIO_PinInit(GPIO, 1, 3, &P1_3_config);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);
GPIO_PortToggle(GPIO,1,0x08);

0 件の賞賛
返信

12,663件の閲覧回数
fr0stw1ng
Contributor I

Hello, 

Even while stepping through the program theres no activity on P1,3 only high. 
Checked while JP57 is shorted and not shorted.
Checked all pins of JP48 just to be safe. 
Also tried adding function GPIO_PortToggle(GPIO,1,0x08);
to the while loop of the LED so the pin would toggle along side the led indefinitely.

Stil no signs on life other than a high pin. 

kind regards, 

0 件の賞賛
返信

12,660件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

You said that "Also tried adding function GPIO_PortToggle(GPIO,1,0x08);
to the while loop of the LED so the pin would toggle along side the led indefinitely.", as far as I know that the node "P1_3-CAN0_RD-PDM_DATA1-HS_SPI_MISO" is NOT connected to any LED, can you tell us which LED the node "P1_3-CAN0_RD-PDM_DATA1-HS_SPI_MISO" is connected?

You have to hook the pin1 of JP48 to a oscilloscope so that you can observe the signal.

BR

XiangJun Rong

 

0 件の賞賛
返信

12,556件の閲覧回数
fr0stw1ng
Contributor I

I haven't heard back from you i hope everything is going alright! 

I do hope you or anyone at NXP can help me resolve this issue.

kind regards, 
Quincy Fleuren

0 件の賞賛
返信

12,542件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I retested the P1_3(pin10 of J92), I am sure it can toggle with JP57 is closed.

Note that the JP57 is not populated, you have to populate it with a jumper and close it.

I use the led_blinky in SDK as an example,pls check it.

BR

XiangJun Rong

xiangjun_rong_0-1662456102672.png

 

 

 

0 件の賞賛
返信