- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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 http://www.intel.com/content/www/us/en/support/boards-and-kits/000006038.html.
Peter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
When using the code found in https://software.intel.com/en-us/node/557354 https://software.intel.com/en-us/node/557354 and the script in http://downloadmirror.intel.com/24910/eng/init_i2c8.sh 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Which image are you using? Have you tried reflashing into the latest version?
Peter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
this happens both in the case when no sensor is connected at all or an Invensense MPU9150 is connected over an PCA9616.
I use the Mini Breakout Board.
Please consider the case when nothing is connected. The program should still not hang.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Thanks for the confirmation -- I myself thought partially that I am going crazy too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Ok so, this really bugged me, and I have kind of figured it out:
After trying a bunch of different combinations of your example code and my code and the example code https://software.intel.com/en-us/node/557354# Reading_the_value_of_an_I2C_device_and_sending_it_back_to_the_host here, I came to the conclusion that the problem cannot possibly be with the i2c_read call itself.
I then looked a bit further into your example and differences to the Intel example code, and tried just leaving out the host_receive() call (set bytes_received = 1 instead).
Et voila, it works fine all of a sudden. (Once I run the script mentioned before)
Now, why that is I do not know yet. I have a host_receive at the beginning of my code as well, and that works fine.
I'm done for today, hope that at least partially helps you.
Cheers,
Sebastian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
I took a totally clean edison. No devices connected with a mini breakout.
I put the modified program onto the mcu
# include "mcu_api.h"
# include "mcu_errno.h"
# include
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" );
mcu_sleep ( 100 * 20 ); // tick = 10ms
while ( 1 ) {
bzero ( buffer, SIZE );
bytes_received = 1;/*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 ( 100 * 10 ); // tick = 10ms
}
}
And I got
Poky (Yocto Project Reference Distro) 1.7.3 edison-22 ttyMFD2
edison-22 login: root
Password:
root@edison-22:~# cat /dev/ttymcu1
( INFO): starting v2.X
( INFO): detecting
( INFO): testing adr 66
It still hangs after the first i2c_read call without a host_receive.
@Sebastian: I really appreciate your work but I cannot confirm it unfortunately.
Yours
Norbert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hm ok that is indeed weird.
I just pasted your code and ran it, and do also get stuck there, but then i execute the script, as mentioned, and it unhangs and continues as expected.
Sorry I couldn't be of more help.
Maybe it would be helpful to open a new topic for this, as this one has already been marked solved (probably not by you), and also link to this discussion in the new one.
Cheers,
Sebastian
PS:
FYI, this is the output i get from running the init_i2c8.sh script (custom expansion board):
./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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
OK I got your comment and I have to confirm it is exactly as described. I even can execute the init script before or after hang both is working.
I guess the relevant lines of the init script are
echo mode2 > /sys/kernel/debug/gpio_debug/gpio28/current_pinmux
echo mode2 > /sys/kernel/debug/gpio_debug/gpio27/current_pinmux
This in mind I went back to my full program -- and guess what -- yes it still hangs.
So now I am concerned about the gpios: I am using these lines in my full mcu program
gpio_setup ( 13, 0 );
gpio_setup ( 115, 0 );
err = gpio_register_interrupt ( 13, 0/*falling*/, irq_data_available );
err = gpio_register_interrupt ( 115, 0/*falling*/, irq_toggle_reading );
So my question is now if I have to call something like the two lines in the init script for the gpio 13 and 115 also ?
More general : Is there a documentation for the usage of the folder /sys/kernel/debug/gpio_debug/ ?
What does mode2 mean ?
@Cooper132: Your help is really useful and only with it I got that far -- thanks a lot.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page