<?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: SDI-12 communication with 1758</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522473#M5109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lix on Sun May 31 03:40:49 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Your approach to SDI-12 is rather simplistic, there is way more to do to implement an SDI-12 master functionality. However, as I understand you want only to see an answer from the sensor. I can give you some hints: to wake-up a sensor, you need to send it a break. Only a couple of cr/lfs won't make it. Therefore check once again the SDI-12 spec and implement a send break function. Verify with a scope that the break has the minimum length specified in the protocol.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second hint is that the SDI-12 hardware configuration is such that you always receive back what you send. Therefore you must implement a technique that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;a) switches the Tx/Rx line only after the last character is out of the UART;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;b) filters the characters you have send that will come back to you from the UART.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A good approach would be to listen to your own characters you just sent, and after receiving the SDI-12 terminator (!) start parsing the sensor answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also don't forget that SDI-12 specifies even parity for the serial communication.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lix&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:56:49 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:56:49Z</dc:date>
    <item>
      <title>SDI-12 communication with 1758</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522472#M5108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Saurabh Dey on Sat May 30 02:37:32 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Campbell make sensor which has SDi-12 output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to interface the sensor with my 1758 development board.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I also wrote a piece of code, but I am not able to get any output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am sending a simple command ?! and the output I am getting is the same Echo ?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kindly let me know what firmware and hardware changes are required so as to get the output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions will be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[u]*Note: The characters in Bold is the code and the characters in bold &amp;amp; Italic is the output.[/u]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;[u]Code: [/u]&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;void InitSDI12(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;call_back_init(SDI12, SDI12_CALLTIME, "ms");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;InitDirOut();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SDI12_TX_DISABLE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned int SDI12(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned char RxData,Cmd[5]="?!",i=0; ///Here ?! is the command&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unsigned int j=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SDI12_TX_ENABLE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;put_char(U2,'\r');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;put_char(U2,'\n');&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;//The reason to send \r\n is beacuse the sensor also has RS232 o/p and in RS232 communication the sensor needs to be wake up after pressing Enter for 9-10 times continuously//&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for(j =0 ; j &amp;lt; 10000; j ++);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;printf("SDI cmd- ");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for(j =0 ; j &amp;lt; 50000; j ++);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for(i = 0;i &amp;lt; (strlen((const char *)Cmd));i++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;put_char(U2,Cmd&lt;/SPAN&gt;&lt;I&gt;);&lt;BR /&gt;printf("%c", Cmd&lt;I&gt;);&lt;BR /&gt;}&lt;BR /&gt;for(j =0 ; j &amp;lt; 50000; j ++);&lt;BR /&gt;SDI12_TX_DISABLE;&lt;BR /&gt;for(j =0 ; j &amp;lt; 50000; j ++);&lt;BR /&gt;printf("\r\n");&lt;BR /&gt;printf("Waiting for Reply\r\n");&lt;BR /&gt;&lt;BR /&gt;for(j =0 ; j &amp;lt; 50000; j ++);&lt;BR /&gt;while(get_char(U2,&amp;amp;RxData))&lt;BR /&gt;{&lt;BR /&gt;//put_char(U0, '$');&lt;BR /&gt;put_char(U0, RxData);&lt;BR /&gt;printf("\r\n");&lt;BR /&gt;}&lt;BR /&gt;printf("Data Received\r\n");&lt;BR /&gt;printf("\r\n");&lt;BR /&gt;&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void InitDirOut(void)&lt;BR /&gt;{&lt;BR /&gt;//!&amp;lt;Set gpio direction&amp;gt;&lt;BR /&gt;gpio_dir(GPIO_DIR_PORT, GPIO_DIR_PIN, 1);//dir:- 0-input 1 output&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;[u]Output: [/u]&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;SDI cmd- ?!&lt;BR /&gt;Waiting for Reply&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;?&lt;BR /&gt;!&lt;BR /&gt;Data Received&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/I&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:56:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522472#M5108</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: SDI-12 communication with 1758</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522473#M5109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lix on Sun May 31 03:40:49 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Your approach to SDI-12 is rather simplistic, there is way more to do to implement an SDI-12 master functionality. However, as I understand you want only to see an answer from the sensor. I can give you some hints: to wake-up a sensor, you need to send it a break. Only a couple of cr/lfs won't make it. Therefore check once again the SDI-12 spec and implement a send break function. Verify with a scope that the break has the minimum length specified in the protocol.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second hint is that the SDI-12 hardware configuration is such that you always receive back what you send. Therefore you must implement a technique that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;a) switches the Tx/Rx line only after the last character is out of the UART;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;b) filters the characters you have send that will come back to you from the UART.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A good approach would be to listen to your own characters you just sent, and after receiving the SDI-12 terminator (!) start parsing the sensor answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also don't forget that SDI-12 specifies even parity for the serial communication.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lix&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:56:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522473#M5109</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: SDI-12 communication with 1758</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522474#M5110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Saurabh Dey on Sun May 31 22:11:42 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Lix for your valuable suggestion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I will work on it and get back to you&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:56:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SDI-12-communication-with-1758/m-p/522474#M5110</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:56:49Z</dc:date>
    </item>
  </channel>
</rss>

