<?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>topic LPC1768 Problem: High pin suddenly goes to zero when the state of another pin changes in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-Problem-High-pin-suddenly-goes-to-zero-when-the-state-of/m-p/1439161#M48410</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I have a problem with lpc1768. I have configured 2 pins (p0.24 and p0.25) as open drain with external pullups of 10k to 3.3V. The problem is, when I have p0.24 and p0.25 in high state and then set the value of p0.24 to low state, the other pin&amp;nbsp;&lt;SPAN&gt;briefly change the state to low level and then go back to high state, as you can see in the attached image. p0.25 should not be split in two pulses.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="contr2889_0-1649193076537.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/175945i1C1C84F4314582D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="contr2889_0-1649193076537.png" alt="contr2889_0-1649193076537.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;here is my test code:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void Sensor::init()
{
    //para pines p0.24 y p0.25
    LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= 0xFFF0FFFF;
    LPC_GPIO0-&amp;gt;FIODIR |= 0x03000000;
    LPC_PINCON-&amp;gt;PINMODE1 |= 0x000A0000;  
    LPC_PINCON-&amp;gt;PINMODE1 &amp;amp;= 0xFFFAFFFF;
    LPC_PINCON-&amp;gt;PINMODE_OD0 |= 0x03000000;
    LPC_GPIO0-&amp;gt;FIOMASK3 &amp;amp;= 0xFC;
}
void Sensor::measure(void)
{
    sdaSCLSet(1,0);
    wait_us(50);
    sdaSCLSet(1,1);
    wait_us(50);
    sdaSCLSet(0,1);
    wait_us(50);
    sdaSCLSet(0,0);
}
void Sensor::sdaSCLSet(uint8_t sdaValue, uint8_t sclValue)
{
    uint8_t outputPins = LPC_GPIO0-&amp;gt;FIOPIN3;
    sdaValue &amp;gt; 0 ? outputPins |= 0x01 : outputPins &amp;amp;= 0xFE;
    sclValue &amp;gt; 0 ? outputPins |= 0x02 : outputPins &amp;amp;= 0xFD;
    LPC_GPIO0-&amp;gt;FIOPIN3 = outputPins;
}
&lt;/LI-CODE&gt;&lt;P&gt;and the code in main is:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sensor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;init&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;wait&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sensor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;measure&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If p0.25 start in high level and then change p0.24 to high level&amp;nbsp; and then change p0.25 to low level then p024 stays in high level as should be, there is not the problem depicted before. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What could be the problem?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 21:26:08 GMT</pubDate>
    <dc:creator>contr2889</dc:creator>
    <dc:date>2022-04-05T21:26:08Z</dc:date>
    <item>
      <title>LPC1768 Problem: High pin suddenly goes to zero when the state of another pin changes</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-Problem-High-pin-suddenly-goes-to-zero-when-the-state-of/m-p/1439161#M48410</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I have a problem with lpc1768. I have configured 2 pins (p0.24 and p0.25) as open drain with external pullups of 10k to 3.3V. The problem is, when I have p0.24 and p0.25 in high state and then set the value of p0.24 to low state, the other pin&amp;nbsp;&lt;SPAN&gt;briefly change the state to low level and then go back to high state, as you can see in the attached image. p0.25 should not be split in two pulses.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="contr2889_0-1649193076537.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/175945i1C1C84F4314582D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="contr2889_0-1649193076537.png" alt="contr2889_0-1649193076537.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;here is my test code:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void Sensor::init()
{
    //para pines p0.24 y p0.25
    LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= 0xFFF0FFFF;
    LPC_GPIO0-&amp;gt;FIODIR |= 0x03000000;
    LPC_PINCON-&amp;gt;PINMODE1 |= 0x000A0000;  
    LPC_PINCON-&amp;gt;PINMODE1 &amp;amp;= 0xFFFAFFFF;
    LPC_PINCON-&amp;gt;PINMODE_OD0 |= 0x03000000;
    LPC_GPIO0-&amp;gt;FIOMASK3 &amp;amp;= 0xFC;
}
void Sensor::measure(void)
{
    sdaSCLSet(1,0);
    wait_us(50);
    sdaSCLSet(1,1);
    wait_us(50);
    sdaSCLSet(0,1);
    wait_us(50);
    sdaSCLSet(0,0);
}
void Sensor::sdaSCLSet(uint8_t sdaValue, uint8_t sclValue)
{
    uint8_t outputPins = LPC_GPIO0-&amp;gt;FIOPIN3;
    sdaValue &amp;gt; 0 ? outputPins |= 0x01 : outputPins &amp;amp;= 0xFE;
    sclValue &amp;gt; 0 ? outputPins |= 0x02 : outputPins &amp;amp;= 0xFD;
    LPC_GPIO0-&amp;gt;FIOPIN3 = outputPins;
}
&lt;/LI-CODE&gt;&lt;P&gt;and the code in main is:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sensor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;init&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;wait&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sensor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;measure&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If p0.25 start in high level and then change p0.24 to high level&amp;nbsp; and then change p0.25 to low level then p024 stays in high level as should be, there is not the problem depicted before. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What could be the problem?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 21:26:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-Problem-High-pin-suddenly-goes-to-zero-when-the-state-of/m-p/1439161#M48410</guid>
      <dc:creator>contr2889</dc:creator>
      <dc:date>2022-04-05T21:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 Problem: High pin suddenly goes to zero when the state of another pin changes</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-Problem-High-pin-suddenly-goes-to-zero-when-the-state-of/m-p/1439360#M48415</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;It appears that your code has issue.&lt;/P&gt;
&lt;P&gt;Anyway, pls try to modify the code like.&lt;/P&gt;
&lt;P&gt;Hope it can help you&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void Sensor::measure(void)
{
    wait_us(50); //Rong wrote
    sdaSCLSet(1,0);
    wait_us(50);
    sdaSCLSet(1,1);
    wait_us(50);
    sdaSCLSet(0,1);
    wait_us(50);
    sdaSCLSet(0,0);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 06 Apr 2022 05:20:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-Problem-High-pin-suddenly-goes-to-zero-when-the-state-of/m-p/1439360#M48415</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-04-06T05:20:41Z</dc:date>
    </item>
  </channel>
</rss>

