5 Replies Latest reply on Mar 14, 2015 9:43 AM by sunilksi

    Galileo Gen 2 - Problem

    RockPort

                              

      I found this IO Map or table on Emutex Labs website.

      EmutexLabs

       

      Can anyone use the IO Map here and Linux testing to see why my program below works on the Gen 1 but not Gen 2 ?

      G2IOMAP_1.JPGG2IOMAP_2.JPG

       

      LM35_Connection_TO_R3.JPG

      I discovered a problem between the Galileo Gen 1 and the Galileo Gen 2 boards.

      This simple program runs on the Gen 1, but has a problem on the Galileo Gen 2.

       

      float temp;
      int tempPin = 3;

      void setup()
      {
         Serial.begin(115200);
      }

      void loop()
      {
         temp = analogRead(tempPin);
         temp = temp * 0.48828125;
         Serial.print("TEMPRATURE = ");
         Serial.print(temp);
         Serial.print("*C");
         Serial.println();
         delay(1000);
      }

        • 1. Re: Galileo Gen 2 - Problem
          TOMMY_Z

          Hello,

          I only have Gen2 here, but thank you first for the information about the IO mapping, that help me a lot.

          Are you using one wire temp sensor? or just a Analog temp sensor?

          if you are using one sensor like DS18x20, how do you connect the Pull up resistor?

          did you tested the Arduino IDE OneWire Sample?

           

           

          #include <OneWire.h>

          // OneWire DS18S20, DS18B20, DS1822 Temperature Example
          //
          // http://www.pjrc.com/teensy/td_libs_OneWire.html
          //
          // The DallasTemperature library can do all this work for you!
          // http://milesburton.com/Dallas_Temperature_Control_Library

          OneWire  ds(10);  // on pin 10 (a 4.7K resistor is necessary)

          void setup(void) {
            Serial.begin(9600);
          }

          void loop(void) {
            byte i;
            byte present = 0;
            byte type_s;
            byte data[12];
            byte addr[8];
            float celsius, fahrenheit;
           
            if ( !ds.search(addr)) {
              Serial.println("No more addresses.");
              Serial.println();
              ds.reset_search();
              delay(250);
              return;
            }
           
            Serial.print("ROM =");
            for( i = 0; i < 8; i++) {
              Serial.write(' ');
              Serial.print(addr[i], HEX);
            }

            if (OneWire::crc8(addr, 7) != addr[7]) {
                Serial.println("CRC is not valid!");
                return;
            }
            Serial.println();

            // the first ROM byte indicates which chip
            switch (addr[0]) {
              case 0x10:
                Serial.println("  Chip = DS18S20");  // or old DS1820
                type_s = 1;
                break;
              case 0x28:
                Serial.println("  Chip = DS18B20");
                type_s = 0;
                break;
              case 0x22:
                Serial.println("  Chip = DS1822");
                type_s = 0;
                break;
              default:
                Serial.println("Device is not a DS18x20 family device.");
                return;
            }

            ds.reset();
            ds.select(addr);
            ds.write(0x44, 1);        // start conversion, with parasite power on at the end
           
            delay(1000);     // maybe 750ms is enough, maybe not
            // we might do a ds.depower() here, but the reset will take care of it.
           
            present = ds.reset();
            ds.select(addr);   
            ds.write(0xBE);         // Read Scratchpad

            Serial.print("  Data = ");
            Serial.print(present, HEX);
            Serial.print(" ");
            for ( i = 0; i < 9; i++) {           // we need 9 bytes
              data[i] = ds.read();
              Serial.print(data[i], HEX);
              Serial.print(" ");
            }
            Serial.print(" CRC=");
            Serial.print(OneWire::crc8(data, 8), HEX);
            Serial.println();

            // Convert the data to actual temperature
            // because the result is a 16 bit signed integer, it should
            // be stored to an "int16_t" type, which is always 16 bits
            // even when compiled on a 32 bit processor.
            int16_t raw = (data[1] << 8) | data[0];
            if (type_s) {
              raw = raw << 3; // 9 bit resolution default
              if (data[7] == 0x10) {
                // "count remain" gives full 12 bit resolution
                raw = (raw & 0xFFF0) + 12 - data[6];
              }
            } else {
              byte cfg = (data[4] & 0x60);
              // at lower res, the low bits are undefined, so let's zero them
              if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
              else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
              else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
              //// default is 12 bit resolution, 750 ms conversion time
            }
            celsius = (float)raw / 16.0;
            fahrenheit = celsius * 1.8 + 32.0;
            Serial.print("  Temperature = ");
            Serial.print(celsius);
            Serial.print(" Celsius, ");
            Serial.print(fahrenheit);
            Serial.println(" Fahrenheit");
          }

          • 2. Re: Galileo Gen 2 - Problem
            Fish

            Tommy_z,

             

            I am using a standard Analog LM35 type sensor.

            For some reason, the code that executes perfectly on my Galileo Gen 1, has a problem on the Gen 2.

            I think, the OS or kernel has a problem with setting up the IO configuration or switching the mux according to the ADC read commands.

            Hoping one of the Intel folks will duplicate my simple test above to help trouble shot this compatibility problem between Galileo boards.

            Thanks,

            Chris

            • 3. Re: Galileo Gen 2 - Problem
              Fish

              OK, I found the problem.

              Galileo Gen 2 is working correctly.

              The problem is the LM35 Ti Temp sensor and the load impedance on the output pin.

              Not sure why the Galileo Gen 2 has a different loading effect than the Gen 1 but that is where the difference is.

              I put a 6.2k ohm resistor on the LM35 output or the A3 input and the oscillation went away.

              I googled LM35 oscillation and it appears the temp sensor can oscillate the output depending on the loading at the output pin.

              Simply adding load stopped the output from oscillating.  No caps or low pass filters necessary, just pulling output to ground with 1k-6.8k did the trick.

              Chris

              1 of 1 people found this helpful
              • 4. Re: Galileo Gen 2 - Problem
                TOMMY_Z

                Glad to hear that Chris!

                Maybe there really have some bug at analog IO control.

                from the IO mapping table you supply, for Analog 3 seems the GPIO55 is the one to contorl the internal 22k pullup/pulldown resistor, Set this pin to low will enable the pull down, set to high will enable the pull up, you've tested the origianl code with external pulldown will work, so probably you can force enable the internal pullup/pull down by adding those command into the setup() loop

                 

                void setup() {
                  // put your setup code here, to run once:
                system("echo \"55\" > /sys/class/gpio/export") ;                  //write a "55" to the export file, which reserves gpio46 for use
                system("echo \"out\" > /sys/class/gpio/gpio55/direction") ;   //sets gpio55 as an output
                system("echo \"0\" > /sys/class/gpio/gpio55/value")   ;       //sets gpio55 low, pull down to GND by 22k resistor


                }

                void loop() {


                }

                 

                Here is more instruction how to control the GPIO by write the IO files, I've successfuly using it to control Gen2 GPIOs according the IO mapping table you found. Hope this will works for you too so you can get rid of the external pull down resistor.

                Python with Galileo

                • 5. Re: Galileo Gen 2 - Problem
                  sunilksi

                  Hi Chris,

                   

                   

                  I am facing the issue with LM35 Sensor Gen-2 and it was perfectly working with Gen-1.

                  I interface three sensor Alcohol,Lm35,5V Battery rest two is working fine only lm35 giving constant garbage value.

                  I went through the above solution and use following circuit and still having the same issue.

                  Image result for lm35 circuits

                   

                  Can you suggest me the possible solution ?

                   

                  Thanks,

                  Sunil