Own LED does not toggle - Cannot set gpio

cancel
Showing results for 
Search instead for 
Did you mean: 

Own LED does not toggle - Cannot set gpio

583 Views
Contributor III

Hi there,

I am running peripheral blinky example from lpcopen examples and i m trying to toggle a led that i put on the board.

LED 0 from blinky example is pin 3.5 and the led embedded on the dev board toggles fine.

When i put a led of my own to the 3.5 pin of the J1 connector of the dev board it is permanently in high state and doesn't toggle.

Any ideas?

The main purpose is that i want to manually manipulate a gpio pin and the above is an experiment i was trying to make.

Labels (1)
0 Kudos
13 Replies

7 Views
Contributor III

Hi jeremyzhou.

I ll try to explain what i am trying to do and i need the manual gpio configuration.

(Should i make a new post?)

I am trying to connect through spi an lpcxpresso4367 dev board with an esp8266 dev board. The main goal is to make a pcb with these two chips on board.

I am using the SSP1 controller from the side of LPC. The side of esp waits a format of 8 bits command + 8 bits address + 256 bits data.

As i figured out the automatic SSEL mechanism of SSP in LPC toggles thes SSEL between high and low between each 8 bit data tha is sent through SSP which is not my case.

So i needed a manual manipulation of SSEL and thats why i wanted to handle it as gpio, so that i can set it high and low each time i want to.

I connected the LPC to an oscilloscope and found out that clock works nice (clock works each time i m tyring to send sth not permanently).

MOSI and SSEL line (configured as gpio) are not behaving correctly.

I see MOSI data when SSEL is high and other weird things.

I tried to "wrap" send frame commands inside an setlow and sethigh SSEL.

I found out that not any time i use sendframe function the frame is sent and now i am tyring to understand the fifo mechanism when it is ready to send a frame and so on.

Now that you know what the big picture of my problem is can y give me any suggestion or help??

Thanks a lot in advance!

0 Kudos

7 Views
NXP TechSupport
NXP TechSupport

Hi Dimitris Sideris,

I'd highly recommend you to create a new post about the question, then share the link with me.

Thanks for your cooperation.
Have a great day,
Ping

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

0 Kudos

7 Views
Contributor III

https://community.nxp.com/message/827264

On Wed, Aug 31, 2016 at 4:25 AM, jeremyzhou <admin@community.freescale.com>

0 Kudos

7 Views
Contributor III
0 Kudos

7 Views
NXP TechSupport
NXP TechSupport

Hi Hi Dimitris Sideris,

Thanks for your reply.

Please try the following code to set the P1_5 to enter the low state

Chip_SCU_PinMuxSet(0x1, 5, (SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC0));

Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0x1, 5);

Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0x1, 5, false);
Have a great day,
Ping

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

0 Kudos

7 Views
Contributor III

Hi jeremyzhou!

Thanx for replying to all questions.

So i tried the code you suggested.

The only difference that it makes is that with Chip_SCU_PinMuxSet(0x1, 5, (SCU_MODE_FUNC0)); that I used when code starts voltage in pin 1,5 is 2,7V (i have a led in 1,5 that it glows).

When i use Chip_SCU_PinMuxSet(0x1, 5, (SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC0)); then when code starts voltage in pin 1,5 is 2,4V (i have a led in 1,5 that it glows less).

Functions

Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0x1, 5);

Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0x1, 5, false);

are used in both above examples.

So i cannot set gpio to logical zero

0 Kudos

7 Views
Contributor III

Sorry the voltage is 2.7V when in pin 1.5 function 5 is set which is SSEL.

In funtion 0 which is gpio pin 1.5 has 2.4V no matter what

0 Kudos

7 Views
NXP TechSupport
NXP TechSupport

Hi Dimitris Sideris,

I've figured out the root cause of the issue, the P1_5 pin is assigned to the GPIO1[8], not the GPIO1[5] according to the reference manual.

The modified code is below.

      Chip_SCU_PinMuxSet(0x1, 5, (SCU_MODE_FUNC0));

      Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0x1, 8);

      Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0x1, 8, false);
Have a great day,
Ping

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

0 Kudos

7 Views
Contributor III

Thanx jeremyzhou, it worked!

0 Kudos

7 Views
NXP TechSupport
NXP TechSupport

Hi Dimitris Sideris,

According to your statement, you even haven't done any anything except use own LED instead of the LED which is from the dev board.

So I was wondering if you can tell me the total procedure to do the implement.

And one more thing, what's the dev board do you use?
Have a great day,
Ping

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

0 Kudos

7 Views
Contributor III

The problem is that i cannot manipulate a gpio manually. I use api methods like SetPinState etc and cannot set gpio values.

I want to set gpio highs and lows manually so that i can manually handle chip select in spi.

So in the blinky example i tried to put a led in the same pin like the embedded led to see what happens.

I am using lpcxpresso 4367 dev board

0 Kudos

7 Views
NXP TechSupport
NXP TechSupport

Hi Dimitris Sideris,

Thanks for your reply.

I was wondering if you can share the codes, then I can replicate the issue on the LPCXpresso4367 board and it can help me to figure out the root cause.

Have a great day,
Ping

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

0 Kudos

7 Views
Contributor III

there is not some specific code at this time.

I am using from lpcopen periph blinky example

and my main goal is to make ssp example from lpcopen to work.

By default ssp example sets pin 1.5 (which is SSEL for SSP1) to high.

Then i manually do

Chip_SCU_PinMuxSet(0x1, 5, (SCU_MODE_FUNC0));

Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0x1, 5);

Chip_GPIO_SetPinState(LPC_GPIO_PORT, port, pin, false);

but nothing happens to ssel pin.

It is always set to high.

( Ive also tried Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 0x1, 5); and different gpio pins that dont have ssp function)

0 Kudos