1 2 Previous Next 26 Replies Latest reply on Jun 30, 2016 1:18 PM by Intel Corporation

    MCU Program not Working on Yocto 3.0 but ok on 2.1

    nagilo

      Dear all,

       

      I wanted to mention that a previously working MCU program is stopping under Yocto 3.0.

       

      The mcu program hangs in the first call to

       

      err = i2c_read(adr, reg, data, size);

       

      Can someone confirm this ?

       

      Yours

      Norbert

        • 1. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello nagilo,
           
          How did you check this? I ran some tests and I was able to upload the script correctly. Could you explain us a little bit more about the issue?
           
          Peter.

          • 2. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
            Cooper132

            Yes I have the exact same problem, i2c read and write operations just don't seem to work anymore, the mcu application seems to hang.

             

            I used the mcusdk to build and upload the code, after the reboot I start the mcu program via the /dev/ttymcu0.

            I wrote several debug outputs in my program, including one just before and after a call to i2c_write(...).

            The one before I can see on /dev/ttymcu1, the one after I cannot, even after several seconds/minutes waiting.

            No outputs on DEBUG level as well.

             

            Would be nice if this would get some attention, as we desperately need the MCU to work for our current project.

             

            Regards,

            Cooper

             

            Edit: some actual code

            debug_print(DBG_INFO, "DEBUG1\n");
            int res = i2c_write(MAX17043_ADDRESS, addr, (unsigned char*) &data, 2);
            debug_print(DBG_INFO, "DEBUG2\n");
            if (res) { debug_print(DBG_ERROR, "i2c_write fail");}
            debug_print(DBG_INFO, "DEBUG3\n");
            

            output:

            DEBUG1

            • 3. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
              Frederic Philips

              Hi,

              I am facing similar problems with the MCU after the latest Yocto 3.0 build. Also any update on accessing the SPI via the Quark MCU?

               

              Cheers,

              Frederic

              • 4. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                I understand, let me do some additional tests to see it if I can replicate the issue and I'll get back to you as soon as possible.

                @Frederic Philips, the MCU sdk hasn't been updated yet. The updates made in Yocto 3.0 can be found in the release notes: http://www.intel.com/content/www/us/en/support/boards-and-kits/000006038.html.

                Peter.

                • 5. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  When using the code found in https://software.intel.com/en-us/node/557354 and the script in http://downloadmirror.intel.com/24910/eng/init_i2c8.sh to set up the pins, we haven't been able to replicate the issue. Could you please give us a little bit more information like, which sensor are you using with your Edison? Are you using the code we posted above or could you share your code? Which expansion board are you using (Arduino, Mini Breakout, Custom, other)? The specs of your power supply might also help.
                   
                  Peter

                  • 6. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                    Cooper132

                    Executing the script you linked seems to have solved the problem.

                    Which is weird because we never had to do that before at all, with 2.1, it always worked flawless without that.

                    Thanks for the tip!

                     

                    Cheers,

                    Cooper

                    • 7. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                      nagilo

                      Hi,

                       

                      the script does not work for me. I get

                       

                      root@edison-one:~# ./init_i2c8.sh 

                      ./init_i2c8.sh: line 3: echo: write error: No such device 
                      ./init_i2c8.sh: line 4: echo: write error: No such device 
                      ./init_i2c8.sh: line 5: echo: write error: No such device 
                      ./init_i2c8.sh: line 6: echo: write error: No such device 
                      ./init_i2c8.sh: line 9: echo: write error: No such device 
                      ./init_i2c8.sh: line 10: echo: write error: No such device 
                      ./init_i2c8.sh: line 12: echo: write error: No such device 
                      ./init_i2c8.sh: line 14: /sys/class/gpio/gpio214/direction: No such file or directory 
                      ./init_i2c8.sh: line 15: /sys/class/gpio/gpio204/direction: No such file or directory 
                      ./init_i2c8.sh: line 16: /sys/class/gpio/gpio205/direction: No such file or directory 
                      ./init_i2c8.sh: line 19: /sys/class/gpio/gpio236/direction: No such file or directory 
                      ./init_i2c8.sh: line 20: /sys/class/gpio/gpio237/direction: No such file or directory 
                      ./init_i2c8.sh: line 21: /sys/class/gpio/gpio212/direction: No such file or directory 
                      ./init_i2c8.sh: line 22: /sys/class/gpio/gpio213/direction: No such file or directory 
                      root@edison-one:~# cat /dev/ttymcu1  
                      ( INFO): starting v2.6 
                      ( INFO): wakedog 0 
                      ( INFO): wakedog 1 
                      ( INFO): wakedog 2 
                      ( INFO): wakedog 3 
                      ( INFO): wakedog 4 
                      ( INFO): wakedog 5 
                      ( INFO): wakedog 6 
                      ( INFO): wakedog 7 
                      ( INFO): wakedog 8 
                      ( INFO): wakedog 9 
                      ( INFO): wakedog 10 
                      ( INFO): wakedog 11 
                      ( INFO): received 4 bytes 
                      ( INFO): received index 0 dec 100 hex 0x00000064 bytes 
                      ( INFO): received index 1 dec 10 hex 0x0000000a bytes 
                      ( INFO): received index 2 dec 38 hex 0x00000026 bytes 
                      ( INFO): received index 3 dec 193 hex 0x000000c1 bytes 
                      ( INFO): detecting 
                      ( INFO): testing adr 0

                      the last output is just before the first call to i2c_read.

                       

                      Has someone an idea ?

                      • 8. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                        Intel Corporation
                        This message was posted on behalf of Intel Corporation

                        Which image are you using? Have you tried reflashing into the latest version?

                         

                        Peter.

                        • 9. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                          nagilo

                          Hi,

                           

                          as mentioned in the title I am using the Yocto 3.0 which is as far as I know the latest.

                           

                          It also has to be mentioned that the i2c_read is issued on a non-existing address. This is common practive to test if a device is available.

                           

                          On Yocto 2.0 and 2.1 I have different problems but I get further than the first i2c_read.

                           

                          Do I have to do anything special before starting an mcu program ?

                           

                          Norbert

                          • 10. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                            Cooper132

                            I am pretty sure I get the same or similar error messages from the script, but for me it helped anyway. Notice how not all of the lines in the script throw an error.

                            I do not however try to communicate with a non-existing address, so that might be it, have you tried issuing an i2c_read call to an existing device as your first call, and see if that blocks as well?

                             

                            As far as I know, besides the script, there is nothing else to be done; I boot the edison, run the script, and can immediately communicate with the mcu.

                             

                            Sebastian

                            • 11. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                              nagilo

                              Hi,

                               

                              if I cannot do an i2c_read on a non-existing address I have a severe problem. Assume that a device is disconnected. If I then try to communicate it will stop everthing ?! Thats a nightmare.

                              • 12. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                                nagilo

                                Hi again,

                                 

                                I created a minimal example which shows the problem.

                                 

                                The program pasted below does not work under Yocto 3.0 but it is fine under Yocto 2.0. It would be very nice if someone can confirm that or even better if I can get a solution.

                                 

                                The output under Yocto 3.0 is then:

                                 

                                root@edison-one:~# cat /dev/ttymcu1 
                                ( INFO): starting v2.X
                                ( INFO): detecting
                                ( INFO): testing adr 66
                                


                                Here is the program

                                 

                                #include "mcu_api.h"
                                #include "mcu_errno.h"
                                #include <string.h>
                                
                                void mcu_main()
                                {
                                    int err = 0;
                                    int bytes_received = 0;
                                    static const int SIZE = 512;
                                    unsigned char buffer[SIZE];
                                    unsigned char i = 0;
                                
                                    debug_print ( DBG_INFO, "starting v%s\n", "2.X" );
                                
                                    while ( 1 ) {
                                        bzero ( buffer, SIZE );
                                        bytes_received = host_receive ( buffer, SIZE );
                                
                                        if ( bytes_received > 0 ) {
                                            debug_print ( DBG_INFO, "detecting\n" );
                                            for ( i = 0x42; i < 0x7F; i++ ) {
                                                debug_print ( DBG_INFO, "testing adr %d\n", (int)i );
                                                err = i2c_read(i, 0x00, buffer, 0x01);
                                                debug_print ( DBG_INFO, "testing adr %d done\n", (int)i );
                                
                                                if (err != 0)
                                                debug_print(DBG_INFO, "read size failed adr %d\n", (int)i);
                                
                                                if ( err == 0 ) {
                                                    debug_print ( DBG_INFO, "found adr %d\n", i );
                                                }
                                            }
                                        }
                                
                                        mcu_sleep ( 1 ); // tick = 10ms
                                    }
                                }
                                


                                Can someone please help me with that ?

                                • 13. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                                  Intel Corporation
                                  This message was posted on behalf of Intel Corporation

                                  Thank you for sharing your code, I will try to replicate the issue with it. However, it would be very helpful if you could let us know the sensor you are using and the expansion board (Arduino, Mini-Breakout, Custom, etc...) you are using.
                                   
                                  Peter.

                                  • 14. Re: MCU Program not Working on Yocto 3.0 but ok on 2.1
                                    Cooper132

                                    I tried your code and can definitely confirm I have the same problem, with or without the script, on 3.0.

                                    Weirdly though, if I change a device address in my code to something non-existing I would get errors like

                                     

                                    (122574000,ERROR): I2C READ(0x00000077, 0x00000088) failed, -1
                                    (122576000,ERROR): I2C READ(0x00000077, 0x000000e1) failed, -1
                                    (122578000,ERROR): I2C WRITE(0x00000077, 0x000000f2) failed, -1
                                    (122580000,ERROR): I2C WRITE(0x00000077, 0x000000f5) failed, -1
                                    (122582000,ERROR): I2C WRITE(0x00000077, 0x000000f4) failed, -1
                                    
                                    
                                    
                                    

                                     

                                    and the program would not hang. I will look some more into this.

                                     

                                    Edit: I think I'm going crazy, if I run your code but give the i2c_read constant hardcoded values for address and register that I know 100% to exist it still does not work.
                                    My code works fine though, and I can't see any significant difference... so I guess it is not a problem of whether the device exists or not.

                                    1 2 Previous Next