<?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 Re: Adc / swdio in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531976#M2802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Sun Apr 17 23:37:16 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: bobi-one&lt;/STRONG&gt;&lt;BR /&gt;Yes, so that means in order to debug I need to switch it back after every ADC read?&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will not work. If you want debug, you cannot re-use any SWD pins (even briefly).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 21:43:32 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T21:43:32Z</dc:date>
    <item>
      <title>Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531971#M2797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by bobi-one on Sun Apr 17 13:31:12 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried using this pin as ADC but after the upload&amp;nbsp; several times LPC link wasn't able to connect and program. Is there a way to use ADC function and&amp;nbsp; still use the debugger, without the need of&amp;nbsp; grounding FT/GPIO again?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(code hint)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531971#M2797</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531972#M2798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Sun Apr 17 13:40:03 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you switch a pin function from SWD to ADC ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After that your SWD is dead :)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531972#M2798</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531973#M2799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by bobi-one on Sun Apr 17 14:12:25 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, so that means in order to debug I need to switch it back after every ADC read?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;btw, @ Zero, DO you know which register is for USB_VBUS to be GPio, because I am trying&amp;nbsp; to display charging icon when the usb cable is plugged but with no success for now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531973#M2799</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531974#M2800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Sun Apr 17 14:36:24 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I think we are still talking about LPC1343 and PIO1_3 (SWDIO/AD4) ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course the simplest solution is to use another pin for ADC. I don't think that switching between functions will work (and this pin is still connected to some kind of input circuit).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;USB_VBUS can be switched with IOCON_PIO0_3.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531974#M2800</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531975#M2801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Sun Apr 17 18:20:51 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I would suggest to use CON-bit of USB-Device Status (See User manual Chapter 9.11.7)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In Chapter 9.11 a sample shows how to use SIE commands. Unfortunately values for CCEMPTY and CDFULL are wrong there :mad: and therefore I've added a (working) sample here &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
//returns 1 if USB is powered
int read_usb_power(void)
{
 unsigned int read_val;
 LPC_USB-&amp;gt;DevIntClr = 0xC00; // Clear both CCEMPTY &amp;amp; CDFULL
 LPC_USB-&amp;gt;CmdCode = 0x00FE0500; // CMD_CODE=0xFE, CMD_PHASE=0x05(Command)
 while (!(LPC_USB-&amp;gt;DevIntSt &amp;amp; 0x400)); // Wait for CCEMPTY.
 LPC_USB-&amp;gt;DevIntClr = 0x400; // Clear CCEMPTY interrupt bit.
 LPC_USB-&amp;gt;CmdCode = 0x00FE0200; // CMD_CODE=0xFE, CMD_PHASE=0x02(Read)
 while (!(LPC_USB-&amp;gt;DevIntSt &amp;amp; 0x800)); // Wait for CDFULL.
 LPC_USB-&amp;gt;DevIntClr = 0x800; // Clear CDFULL.
 read_val = LPC_USB-&amp;gt;CmdData; // Read data
 if(read_val &amp;amp; 0x01)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //CON = connected = power
 {
&amp;nbsp; return (1);
 }
 else
 {
&amp;nbsp; return(0);
 }
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531975#M2801</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531976#M2802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Sun Apr 17 23:37:16 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: bobi-one&lt;/STRONG&gt;&lt;BR /&gt;Yes, so that means in order to debug I need to switch it back after every ADC read?&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will not work. If you want debug, you cannot re-use any SWD pins (even briefly).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531976#M2802</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531977#M2803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by bobi-one on Mon Apr 18 02:52:02 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Zero&lt;/STRONG&gt;&lt;BR /&gt;I would suggest to use CON-bit of USB-Device Status (See User manual Chapter 9.11.7)&lt;BR /&gt;&lt;BR /&gt;In Chapter 9.11 a sample shows how to use SIE commands. Unfortunately values for CCEMPTY and CDFULL are wrong there :mad: and therefore I've added a (working) sample here &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
//returns 1 if USB is powered
int read_usb_power(void)
{
 unsigned int read_val;
 LPC_USB-&amp;gt;DevIntClr = 0xC00; // Clear both CCEMPTY &amp;amp; CDFULL
 LPC_USB-&amp;gt;CmdCode = 0x00FE0500; // CMD_CODE=0xF5, CMD_PHASE=0x05(Command)
 while (!(LPC_USB-&amp;gt;DevIntSt &amp;amp; 0x400)); // Wait for CCEMPTY.
 LPC_USB-&amp;gt;DevIntClr = 0x400; // Clear CCEMPTY interrupt bit.
 LPC_USB-&amp;gt;CmdCode = 0x00FE0200; // CMD_CODE=0xF5, CMD_PHASE=0x02(Read)
 while (!(LPC_USB-&amp;gt;DevIntSt &amp;amp; 0x800)); // Wait for CDFULL.
 LPC_USB-&amp;gt;DevIntClr = 0x800; // Clear CDFULL.
 read_val = LPC_USB-&amp;gt;CmdData; // Read Frame number LSB byte.
 if(read_val &amp;amp; 0x01)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //CON = connected = power
 {
&amp;nbsp; return (1);
 }
 else
 {
&amp;nbsp; return(0);
 }
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Great code, thanks &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; I'will try to implement it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@CodeRedSupport, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The thing I'am trying to do is this: my stand alone device have RX/TX connector,&amp;nbsp; debug connector and USB. My initial idea was to modify the&amp;nbsp; MSD code so that compiled bin files to be drag and dropped easily via the USB, and the&amp;nbsp; unused debug connector can be used for peripherals. But since I am having trouble getting&amp;nbsp; my USB to work, thought that debug connector can be used for both.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531977#M2803</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adc / swdio</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531978#M2804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Mon Apr 18 04:46:00 MST 2011&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;As I said, if you are using any of the debug pins for another function, then you will be unable to debug.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:43:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Adc-swdio/m-p/531978#M2804</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:43:33Z</dc:date>
    </item>
  </channel>
</rss>

