LPCXpresso55S28 unable to read gpio pins though I can set them.

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

LPCXpresso55S28 unable to read gpio pins though I can set them.

Jump to solution
1,298 Views
AlbertStraub
Contributor II

System:

LPCXpresso55S28 Revision A2

Jumpers: J10 off, P25 on, J7 on, P1 off, P3 - 3.3V, J3 - Loc,  USB - FS

Dev Software:

    IDE: MCUXpresso IDE v11.3.0 [Build 5222] [2021-01-11]

    SDKs:

        SDK_2.x_LPC55S28, Version 2.9.0 (Eplugsite 415 2021-01-15), Manifest version 3.8.0, location <plugins>/com.nxp.mcuxspresso.sdk.sdk_2.x_lpc55s28_2.9.0.201911251446;

       SDK_2.x_LPCXpresso55S28, Version 2.9.0 (435 2021-01-15), Manifest version 3.8.0, location <common>\SDK_2.9.0_LPCXpresso55s28.zip

Firmware: 

   

Steps:

1) Create new workspace directory

2) Run NXPXpresso and select the new workspace based upon name created in 1)

3) Select Import SDK Example(s) from quick menu.

4) Presented with 2 pictures of the dev board.  Why are there two???

5) Click on LPC55xx drop down to see LPC55S28 and click on it.

6) Presented with SDKs for selected MCU

7) Select SDK_2.x_LPCXpresso55S28.  I did this because it is the LPCXpresso dev environment.  Is this correct?

All buttons on bottom still greyed out.  Why?

9) Select image of the board on left due to mouseover saying it is LPCXpresso while one on right does not include the words LPCXpresso.

10) Next icon becomes no longer greyed out.  Select "Next"

11) Presented with Import Projects.

12) Drop down driver_examples

13) Drop down gpio

14) Select checkbox for gpio_led_output

15) Select finish button

16) Select left hand bug icon in menu to start debug.

17) Pop up appears showing LPC-Link2 CMSIS-DAP V5.361 SN PQA0AQHR.  Select the row.

18) Select Ok button

19) Hits breakpoint at line 58

20) Press F8 button

21) Console presents:

    GPIO Driver example

    The LED is taking turns to shine.

    Standard port read: 402c0

    Masked port read: 40000

22) Press "User" switch S2 ( I also pressed and held it continuously and still no result.

23) Nothing happens.  LED does not illuminate.

Debugging:

I stepped through the code and see that gpio_pin_config_t led_config is set to a digital output but switch is not configured at all.  Is this because it is a default to be an input pin??

Set breakpoint on line 110 and found that when running this is never hit, thus, no printf.

I modified the while loop to see what was going on with the register like this:

while (1)
{

port_state = GPIO_PortRead(GPIO, APP_SW_PORT);
if (port_state != old_state)
{
PRINTF("Port state: %x\r", port_state);
GPIO_PortToggle(GPIO, APP_BOARD_TEST_LED_PORT, 1u << APP_BOARD_TEST_LED_PIN);
old_state = port_state;
}
/* Delay 1000 ms */
SysTick_DelayTicks(1000U);
}

Pressing the button shows now difference but on occasion the breakpoint is hit and the green LED turns on.  This is due to an occasional change in the port have an additional 18 show up in the pattern.  bottom byte is stuck at 24.  

I went through this exercise because I am unable to read the input ports on our target product board as well.

Ideas??  Can you recreate?

 

 

 

0 Kudos
1 Solution
1,250 Views
AlbertStraub
Contributor II

Ok.  I ran the code on the development board and stepped through the code.  It does sense the input as I can hit the breakpoint there.  However, the LED would not turn on or off.  So, I switched to PIO1_9 and placed my own LED with a series resistor between connector P18 pin 1 and 3.3V.

My LED now turns on and off with presses of the ISP button (SW1).  So, I think that the NXP Dev board LED has some problem.  I have ordered a new board and will try again with it.  At least I now am very familiar with the GPIO settings / pin mux settings.  Thank you Jun!

View solution in original post

0 Kudos
5 Replies
1,251 Views
AlbertStraub
Contributor II

Ok.  I ran the code on the development board and stepped through the code.  It does sense the input as I can hit the breakpoint there.  However, the LED would not turn on or off.  So, I switched to PIO1_9 and placed my own LED with a series resistor between connector P18 pin 1 and 3.3V.

My LED now turns on and off with presses of the ISP button (SW1).  So, I think that the NXP Dev board LED has some problem.  I have ordered a new board and will try again with it.  At least I now am very familiar with the GPIO settings / pin mux settings.  Thank you Jun!

0 Kudos
1,264 Views
AlbertStraub
Contributor II

Thanks Jun!  I ran the app on the demo board and from it I can read the pins.  However, it does not light the LED.  Not sure why.  On my custom board, I can not read pins at all.  I'll continue to trace through my board.  Perhaps I damaged it with ESD.

0 Kudos
1,256 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Albert

Yes, please use multimeter or scope measure the pin while you step over the GPIO toggle code. 

I have tested the SDK demo code on my side. it can toggle led well and can read SW well.

Have a nice day,

Jun Zhang

0 Kudos
1,281 Views
AlbertStraub
Contributor II

Ah.... It would help if I realized that you need to press S1.  Oops!

0 Kudos
1,275 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

HI AlbertStraub

Please run and refer SDK demo led_output, you will see how to read GPIO pins.

 

Have a nice day

Jun Zhang

0 Kudos