13 Replies Latest reply on Mar 29, 2016 4:19 PM by GerardVidal

    Problems with I2C-6.

    egortech

      Hello,

      I am trying to connect MLX90614 to Intel Edison with Arduino Breakout Kit. But looks like that this sensor did't detect by board. I am using A4 and A5 port for SDA, SCL pins. So I decide to execute i2cdetect -y -r 6 command in my console session, but instead of a table of addresses I got follow error: Device: i2c-designware-pci. controller timed out. Moreover i get this error again and again. I am try to disconnect device, reboot and flash its, but I am still get this error. Also my board completely hangs without any kernel messages when i am trying run i2cdetect for i2c-3 port.This command works well with another buses.

      Full dmesg log with stack traces you can see in attached file.

      Any idea how I can fix this problem with I2C-6 bus in my board?

        • 1. Re: Problems with I2C-6.
          CMata_Intel

          Hi egortech,

           

          Yes, I have seen the same output before while using i2cdetect, try setting the configuration that appears on Section 11.6 fromthis document: Edison + Arduino Expansion Board - HG. Then, try to see if you get improvements by using i2cdetect.

           

          If you want to use the MLX90614, I suggest you to use the UPM libraries:

          upm: Main Page

          GitHub - intel-iot-devkit/upm: UPM is a high level repository for sensors that use mraa

           

          There is an example you could use for C++ : upm/mlx90614.cxx at master · intel-iot-devkit/upm · GitHub

          You can compile this code by using: g++ mlx90614.cxx -o out1 -I /usr/include/upm/ -lupm-mlx90614 then you can execute the out1 file with ./out1

           

          If you get problems with this code it could be the mraa, upm and image version you have, so let us know the outcome of the following commands:

          configure_edison –version

          opkg list-installed mraa

          opkg list-installed libmraa0

          opkg list-installed upm

           

          Regards,

          Charlie

          • 2. Re: Problems with I2C-6.
            CMata_Intel

            Hi egortech,

             

            Have you been able to work on this?

            I would like to know if you have been able to run the UPM example with your sensor.

             

            Regards,

            Charlie

            • 3. Re: Problems with I2C-6.
              egortech

              Sorry for delay answer. I update all package using opkg update opkg upgrage command in my board. i2cdetect runs correctly now, but example program doesn't work. I try to select different bus number in constructor of lib class but application still print zero value for temperature and i2cdetect also don't see sensor. This sensor uses a non-standard type of I2C called "repeated-start" and I think this is main problem. I try to connect this sensor to Arduino UNO and there it runs correctly.

              • 4. Re: Problems with I2C-6.
                CMata_Intel

                Hi egortech,

                 

                Could you post the output of running the following commands:

                configure_edison –version

                opkg list-installed mraa

                opkg list-installed libmraa0

                opkg list-installed upm


                If you want to use the repeated start function, I suggest you to look into this library: sajingeo/i2crw - C - GitHub


                Regards,

                Charlie

                • 5. Re: Problems with I2C-6.
                  CMata_Intel

                  Hi egortech,

                   

                  Did you check the library I posted on above? I would like to know if you are still working on this, and if you do please post the output of running the commands I posted above.

                   

                  Regards,

                  Charlie

                  • 6. Re: Problems with I2C-6.
                    GerardVidal

                    HI, @

                    I think that I have the same problem with MPL3115A2  but unfortunately "look into this library" is not enough detailed plan for me to be able to make any progress. I do not understand what to do. I can gitclone this library and compile it but what to do with it ? Is it necessary to use the functions in a new upm module MPL3115A2+ that incorporates the code meaning I need to step into rrecoding the module is it just necessary to call init funcion or change the read/write function?

                    If anybody could give me some clues I may spend some time on it.

                     

                    Thanks.

                    • 7. Re: Problems with I2C-6.
                      CMata_Intel

                      Hi GerardVidal,

                       

                      I saw you opened the thread: Impossible to plug more than one sensor on I2c Arduino breakout and you found some suggestions there, I also saw that you are working now with repeated start, take a look at this library: GitHub - sajingeo/i2crw: A light weight library for performing a mixed I2c transaction on the Intel Edison this is from another maker that was using the MRAA library but also had problems with the repeated start feature (this feature is not included in the MRAA library), take a look at it I think it may be helpful.

                       

                      Regards,

                      Charlie

                      • 8. Re: Problems with I2C-6.
                        GerardVidal

                        Hi CMata_Intel

                         

                        I am away from my edisons and sensors but I have tried to introduce sajin code slightly amended in mraa as it was very close to  some mraa functions, I don't know if it is allowed or wanted or even if it works because  I cannot test it right now but if it may help to progress you can check my proposal here : GitHub - g-vidal/mraa at mraa+GV: Low Level Skeleton Library for IO Communication on GNU/Linux platforms

                         

                        i can amend or make pull rquest if it helps

                        Regards

                        • 9. Re: Problems with I2C-6.
                          CMata_Intel

                          Hi,

                           

                          Have you been able to work again with your board and sensors? Let us know if you have updates on this.

                           

                          Regards,

                          Charlie

                          • 10. Re: Problems with I2C-6.
                            GerardVidal

                            Hi Charlie,

                             

                            Thanks for the follow up...

                             

                            Unfortunately things are still bad on the I2c front. I have bought a set of resistors, learned how to wire pull-ups, tried various values as recommended in one of the links with no effect. I have changed the sensor and it is even worse ! I am trying to connect on the same I2cbus  2 Adafruit sensors HTU21DF and MPL115A2.  I succeed in getting HT21DF work properly but when I add MLP115A2 on the bus (with or without 4.7 kOhms as stated on the datasheet, measurement from HTU21F get wrong (0 value measured and usual weird values for temp and humidity). When I try to start MPL alone using upm lib it fails with the message on wrong id....

                             

                            As I told you in my previous message I have tried to incorporate in mraa "repeated start code" from sajin  you mentionned earlier, the proposal is here and I am trying to add a repeated sensor MPL115A2RS in upm to check if it works. It is compiling and I will let you know if it works but upm compilation is loooong.

                            Compilation is OK  but the code segfaults.... I have to work a little more

                             

                            We realy need to have a solution for sensors requiring repeated start OR please remove from upm those sensors that cannot work with Edisons, I cannot see for example how anybody can have MPL3115A2 work out of the box. I have bought an BME280 and BME180 that do not require repeated start but unfortunately the driver is not available. If nobody does it I willl translate Arduino drivers to upm as I did for MIC6814 and MQ135.

                            Regards

                            Gérard

                            • 11. Re: Problems with I2C-6.
                              CMata_Intel

                              Hi Gérard,

                               

                              I’m glad to know that you were able to use the HT21DF, what happens if you try to use one at a time? Not both at the same time using the same lines.

                              Which repository are you using to install the MPL?

                              I can imagine that the compilation is taking some time, but due to MRAA not having this feature, the only way is to include a new library or module that could be able to do the repeated start.

                               

                              Regarding to remove from UPM the sensors that doesn’t work with the Edison, I suggest you to open an Issue in their Github: Issues · intel-iot-devkit/upm as you know UPM is a repository that works for sensors that use the MRAA library, and these are not specifically just for Edison, there are other boards that can use these libraries. You can add this as suggestion for them, maybe a file that shows which boards has been tested with the different sensors and libraries.

                               

                              How are you testing the MPL3115A2? Which error are you having?

                              If you are using the example upm/mpl3115a2.cxx at master · GitHub you can compile it with g++ mpl3115a2.cxx -o output -I /usr/include/upm/ -lupm-mpl3115a2 –lmraa

                               

                              Regarding the BME280, look at this example: upm/bme280.cxx at master · GitHub

                               

                              Latest MRAA and UPM versions are available in: i586/

                               

                              Regards,

                              Charlie

                              • 12. Re: Problems with I2C-6.
                                GerardVidal

                                Hi Charlie CMata_Intel Thanks again for the time spent,

                                 

                                1st question : I can use any sensor that does not need repeated start alone on I2c, I have not been able to use any sensor with repeated start even alone. I have bought a BMP180 and a BME280  and prepared evrything to check a combination with HTU21DF on last saturday but unfortunately something was changed in github repository for upm lib and it was impossible to get the code as usual  (I have proposed a workaround on github  but it took me all the WE!)

                                 

                                1st remark : I had no time to go further on my try to include sajin code in mraa as I have told you it compiles but segfaults, I may have messed up between bus addresses. From what I have seen in his workaround there are few differences with the original mraa code reading and writing instead of reading only working on 2 bytes instead of one but I may have missed many things I am not coder .

                                 

                                2nd remark : I understand that mraa and upm are made for any platform (I am using this opportunity in my new course  ) and it is a great opportunity. For somebody like me that is not in electronics  this feature of repeated start is hard to see at first and a newcomer with an Edison (or a Raspberry) may waste money and time. I'll follow your advice and make a proposal for upm support.

                                 

                                2nd question : I am using the driver from upm lib compiled from sources from github with the recommended method using the cmakefiles provided. I am working with python at the moment, I can import the module  but when I initiate it it yields an error telling that the sensor has wrong id. I checked the code and discovered that in the instantiation the program tries to read the id on the bus (the address scaned is correct) but due to the repeated start feature I guess it cannot reead anything and returns 0x0 or 0xL which fails the test  I have tried to compile removing this test and it fails on the next read which confirms the origin of the problem in repeated start.

                                 

                                3rd remark : BME280 and BMP180 have been recently added so I rushed to those drivers..... which has been a mistake !  declarations in the .h file differ from other sensors which yield warning or errors, something has been changed in upm CMakefile process and I had to modify by hand  upm/src/CMakeLists.txt to get the modules inside /usr/lib/python2.7 and not in /usr/lib/python. I have prepared a breadbord with all connections and optional pull-up resistors to check  what happens. I'll let you know. Maybe in the meantime upm will be cleaned....

                                 

                                4th remark : I am not using the binaries I am using compilation from sources  because I am using also MICS6814 that I have translated from Adafruit Arduino lib, my pull request has not been considered  because my proposal does not fully respect the rules yet (I'll work on it if nobody does it before me )

                                 

                                Question : Do you intend to provide repeated start functionnality in mraa ?

                                 

                                Thanks again, my roadmap is now  :

                                1. check HTU21DF + BMP180 ;
                                2. check HTU21DF + BME280 ;
                                3. with pullup resistors if the previous did not work
                                4. check the use of  mraa and upm  on Edison Arduino breakout / mini-breakout / sparkfunbreakout with I2c board / Raspberry Pi

                                 

                                Best regards

                                Gérard

                                • 13. Re: Problems with I2C-6.
                                  GerardVidal

                                  Hi Charlie CMata_Intel ,

                                   

                                  Back here with very sad news.....

                                  I am using mraa and upm from github compiled the standard way with cmake instructions  installing them in /usr.

                                  I am using Adafruit sensors HTU21DF and BMP180 with standard python drivers from upm. 3.3v in Arduino breakout.

                                  Situation 1 : HTU21DF alone on I2c bus works perfectly

                                  Situation 2 : BMP180 alone on I2c busworks perfectly (even if I do not understand why it gives int temperatures badly rounded in the driver (int) (temp/10))

                                  Situation 3 : HTU21DF and BMP180 on the same bus does not work

                                  Situation 4 : Situation 3 + pull-up resistors (4.7 kohms) does not work either

                                  From Situation 3, if I unplug BMP180  HTU21DF yields correct measurements

                                  From Situation 4 I have to unplug BMP180 and pull-up resistors to get good measurements

                                  When both are plugged HTU21DF gives bad measurements and  BMP180 crashes at initialisation with the message init failed  which corresponds to

                                  if (!isAvailable() || !getCalibrationData())
                                      UPM_THROW("Init failed");

                                  The picture shows the wiring, pull-up resistors have been removed but their position can be inferred.

                                   

                                  The conclusion is that even with sensors that do not require repeated start I cannot get two of them on the I2c bus of the arduino breakout. next step I wil try other breakouts and Raspi.....

                                  Stay tuned!

                                   

                                  Best regards

                                   

                                  i2C.png