<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: reading current state of a board LED</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587858#M21706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rocketdawg on Tue Aug 26 08:23:04 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;as soon as you change the pin to an input, the LED will turn off.&amp;nbsp; You are no longer supplying a voltage.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;there is some internal capacitance in the LED, but the R/C discharge curve is probably quite short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so, you turn off the LED, then sample the input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so it should always be off.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So do not change it to an input, just read it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can still read the SET register (UM10503 section 18.6.2) which will report the current state of the output latch.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:12:20 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:12:20Z</dc:date>
    <item>
      <title>reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587857#M21705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mrabbasi61 on Mon Aug 25 15:38:34 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for opening new topic for repeated subject, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd asked similar question before, but finally I couldn't fix the problem. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I couldn't find out why the following function always return false?!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;/* Returns the current state of a board LED */&lt;BR /&gt;bool Board_LED_Test(uint8_t LEDNumber)&lt;BR /&gt;{&lt;BR /&gt;if (LEDNumber &amp;lt;= 7) {&lt;BR /&gt;Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);&lt;BR /&gt;return (bool) Chip_GPIO_GetPinState(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);&lt;BR /&gt;}&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using "periph_blinky" example of LPCOpen v2_10 or V2_11 and I can only blink the LED by using two functions "Board_LED_Set(0, TRUE)" and "Board_LED_Set(0, FALSE)" , I can not use "Board_LED_Toggle(0)" because the above function always return FALSE. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tested all possible values for the "modefunc" parameter in fuction "Chip_SCU_PinMuxSet()".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587857#M21705</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587858#M21706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rocketdawg on Tue Aug 26 08:23:04 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;as soon as you change the pin to an input, the LED will turn off.&amp;nbsp; You are no longer supplying a voltage.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;there is some internal capacitance in the LED, but the R/C discharge curve is probably quite short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so, you turn off the LED, then sample the input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so it should always be off.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So do not change it to an input, just read it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can still read the SET register (UM10503 section 18.6.2) which will report the current state of the output latch.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587858#M21706</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587859#M21707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mrabbasi61 on Tue Aug 26 23:54:57 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you for your reply, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tested with and without changing the pin to input, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so I have used both of the following functions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;1)&lt;BR /&gt;bool Board_LED_Test(uint8_t LEDNumber)&lt;BR /&gt;{&lt;BR /&gt;if (LEDNumber &amp;lt;= 7) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (bool) Chip_GPIO_GetPinState(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);&lt;BR /&gt;}&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;2)&lt;BR /&gt;bool Board_LED_Test(uint8_t LEDNumber)&lt;BR /&gt;{&lt;BR /&gt;if (LEDNumber &amp;lt;= 7) {&lt;BR /&gt;Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);&lt;BR /&gt;return (bool) Chip_GPIO_GetPinState(LPC_GPIO_PORT, ledports[LEDNumber], ledbits[LEDNumber]);&lt;BR /&gt;}&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but both of them return false , &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587859#M21707</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587860#M21708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mrabbasi61 on Tue Aug 26 23:57:48 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am wondering .. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;no one has problem with "periph_blinky" project from lpcopen for lpc_board_keil_mcb_4357 board ??!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587860#M21708</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587861#M21709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rocketdawg on Wed Aug 27 07:53:18 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;directly from the board.c file in the NXG Explorer LPC4330 projects &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;notice the "!" operator?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;bool Board_LED_Test(uint8_t LEDNumber)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (LEDNumber == 0) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return (bool) !Chip_GPIO_GetPinState(LPC_GPIO_PORT, 1, 12);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if (LEDNumber == 1) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return (bool) !Chip_GPIO_GetPinState(LPC_GPIO_PORT, 1, 11);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;return false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587861#M21709</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587862#M21710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rcontrol on Thu Aug 28 00:30:05 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the same question with you.&amp;nbsp;&amp;nbsp;&amp;nbsp; And I found your two questions not yet answered.&amp;nbsp; Weird...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That example "periph_blinky" comes from the file "lpcopen_2_12_lpcxpresso_ngx_xplorer_4330.zip"&amp;nbsp; downloaded from &lt;A href="https://community.nxp.com/www.lpcware.com" target="test_blank"&gt;www.lpcware.com&lt;/A&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It uses Chip_GPIO_GetPinState and returns false (or true ?) no matter which state the pin has actually.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the example for LPC1769 "lpcopen_2_10_lpcxpresso_ngx_xplorer_1769.zip"&amp;nbsp; uses the same function Chip_GPIO_GetPinState&amp;nbsp; and it works successfully.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other examples for LPC43xx do not read the state of the pin to blink LED. ( lpc4330_Xplorer_LPCXpresso.zip from &lt;A href="https://community.nxp.com/www.ngxtechnologies.com" target="test_blank"&gt;www.ngxtechnologies.com&lt;/A&gt; )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;STATIC INLINE bool Chip_GPIO_GetPinState(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return (bool) pGPIO-&amp;gt;B[port][pin];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This function in "gpio_18xx_43xx.h" ( lpcopen_2_12_lpcxpresso_ngx_xplorer_4330) does not work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Maybe by reading the manual I can correct this.&amp;nbsp; But I hope somebody could tell me the whole story.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587862#M21710</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587863#M21711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rocketdawg on Thu Aug 28 10:08:40 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I see the confusion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you really want to read the GPIO PIN which is NOT pGPIO-&amp;gt;B&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Reading pGPIO-&amp;gt;B will read what the output latch is set to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that is not necessarily what the pin output really is, it could be shorted or overloaded.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;reading the PIN[port] should read the actual state of the pin and you have to make sure the input buffer is enabled in the syscon block for that pin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STATIC INLINE uint32_t Chip_GPIO_GetPortValue(LPC_GPIO_T *pGPIO, uint8_t port)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return pGPIO-&amp;gt;PIN[port];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this gets the port value, and then you have to mask off the pin bit mask&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The LPCOpen developers should standardize this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587863#M21711</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587864#M21712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mrabbasi61 on Fri Aug 29 20:27:03 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think that "Chip_GPIO_GetPortValue" is the answer. what I want to read at this example is exactly the output latch of that pin in order to get the last state of the LED connected to that pin. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;however, I tested the "Chip_GPIO_GetPortValue" function, and again LEDs in my board are always ON!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587864#M21712</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587865#M21713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rcontrol on Sat Aug 30 00:59:18 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Ya, right.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that we cannot read the SFR while we can write it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The GPIO port byte pin registers (pGPIO-&amp;gt;B) should be read out.&amp;nbsp;&amp;nbsp;&amp;nbsp; The user manual UM10503.pdf says those registers are R/W.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The LPC1769 has the same code and it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe I suspect some setting is required. Or the manual is just wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After reading rocketdawg's answer (thanks!!!), I examined other example from &lt;A href="https://community.nxp.com/www.ngxtechnologies.com" target="test_blank"&gt;www.ngxtechnologies.com&lt;/A&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And I found this example uses the PIN registers only. With the flag EZI set, I could get the correct PIN value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I can read the pin state, but my wondering does not cease.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My chip is LPC4337.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587865#M21713</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587866#M21714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mrabbasi61 on Sat Aug 30 09:25:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I would really appreciate it if lpc support guys could write their opinion about this issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587866#M21714</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587867#M21715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rcontrol on Sun Aug 31 00:02:15 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Ha,Ha.....&amp;nbsp;&amp;nbsp; My wondering begins ceasing...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My mistake was that I put the GPIO port &amp;amp; bit value into the SCU setting function (enabling input buffer). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After studying NGX's example, I found that they used SCU port/bit values to set GPIO's properties.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As rocketdawg suggested, I add Chip_SCU_PinMuxSet function with SCU port&amp;amp;bit values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now even pGPIO-B[xx] values can be read well.&amp;nbsp;&amp;nbsp; Maybe in this aspect LPC43xx are different from LPC1769. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So all the test code works fine.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks to rocketdawg !!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;board.c =============================================================================&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// In the original code, port&amp;amp;bit values are hard coded.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// but they defined the LED1_GPIO_PORT_NUM symbols in the board.h file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;static void Board_LED_Init()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SCU_PinMuxSet(LED1_SCU_PORT_NUM, LED1_SCU_BIT_NUM, SCU_MODE_INBUFF_EN);&amp;nbsp; // I add this line&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SCU_PinMuxSet(LED2_SCU_PORT_NUM, LED2_SCU_BIT_NUM, SCU_MODE_INBUFF_EN);&amp;nbsp; //&amp;nbsp; I add this line&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* P2.12 : LED D2 as output */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED1_GPIO_PORT_NUM, LED1_GPIO_BIT_NUM); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* P2.11 : LED D3 as output */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED2_GPIO_PORT_NUM, LED2_GPIO_BIT_NUM);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Set initial states to off (true to disable) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED1_GPIO_PORT_NUM, LED1_GPIO_BIT_NUM, (bool) true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED2_GPIO_PORT_NUM, LED2_GPIO_BIT_NUM, (bool) true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;board.h ==============================================================================================&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED1_GPIO_PORT_NUM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // I am using the WaveShare' Open43xxB1 board.&amp;nbsp; So this numbers are different from NGX board.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED1_GPIO_BIT_NUM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED1_SCU_PORT_NUM6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED1_SCU_BIT_NUM12&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED2_GPIO_PORT_NUM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED2_GPIO_BIT_NUM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED2_SCU_PORT_NUM6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define LED2_SCU_BIT_NUM11&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587867#M21715</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587868#M21716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rocketdawg on Tue Sep 02 09:12:52 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: rcontrol&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Many thanks to rocketdawg !!!&lt;BR /&gt;I am using the WaveShare' Open43xxB1 board. &lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Welcome.&amp;nbsp; Wow, that is some well populated dev board for the cost.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I started with the LPC43xx all I had was the NGX Explorer I got at a ESC, and then I found Bambino 200, but it has those funky Gadgeteer sockets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still think that the LPCOpen folks should update the example projects with similar board.c fixes as yours.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587868#M21716</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: reading current state of a board LED</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587869#M21717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by nerd herd on Wed Sep 03 08:28:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The bug in the blinky example will be looked into and reported to the guys in charge of LPCOpen. Thanks for debugging it among yourselves!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/reading-current-state-of-a-board-LED/m-p/587869#M21717</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:27Z</dc:date>
    </item>
  </channel>
</rss>

