9 years ago.

GR-PEACH and low level I2C problems

Hello GR-PEACH team,

Last week, I reported low-level I2C issues with the PEACH. Has anyone taken a look at this?

https://developer.mbed.org/questions/7409/GR-PEACH-I2C-not-completely-working/

Regards,

...kevin

Question relating to:

Factory-written program for GR-PEACH.

I found the cause of this issue.
Can you try a tentative library and see if issue would be gone?

How to import the library:

  1. Go to
    http://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#build-and-run
  2. "4" of "Let's blink LED"
    If you're using "mbed-src_GR-PEACH_rev_c" but not "mbed lib", delete "mbed-src_GR-PEACH_rev_c".
  3. "5" of "Let's blink LED"
    But import "mbed-src_GR-PEACH_rev_c_I2C" instead.
  4. "6" and "7" of "Let's blink LED"


In case of GR-PEACH, please use program described below.
- In case of read processing:
(1) Add a dummy read after an address transmission. The dummy read is marked (*1).
(2) Specify "false" as argument of i2c.read for "last - 1" byte. The sentence is marked (*2).

    char dmmy, reg0, reg1, reg2 = 0;
    i2c.start();
    wr_ack_ok = i2c.write(TESTADDRESS);
    i2c.write(POINTER);
    i2c.stop();
    i2c.start();
    rd_ack_ok = i2c.write(TESTADDRESS | 1);
    dmmy = i2c.read(true);   // (*1) Dummy read for GR-PEACH
    reg0 = i2c.read(true);
    reg1 = i2c.read(false);   // (*2) "last - 1" byte is false for GR-PEACH
    reg2 = i2c.read(false);   // "last" byte is false
    i2c.stop();
posted by Tomo Yamanaka 28 Apr 2015

I have a rev B board. Is that library updated as well?

posted by Kevin Braun 29 Apr 2015

For the rev.B board, it should work by the following procedure.

1. Import "mbed-src_GR-PEACH_rev_c_I2C".

2. Replace your "mbed-src\taregets\hal\TARGET_RENESAS\TARGET_RZ_A1H\PinNames.h" with "http://developer.mbed.org/media/uploads/RyoheiHagimoto/pinnames.h".

3. Recompile it on your environment.

Otherwise, we'll upload an updated rev.B library on the week of May 11th.

posted by Yasu Kutsuma 01 May 2015

Thank you Yasu,

I made the changes like you suggest. The only thing I found was that the I2C NACK timeouts take a very long time.

I have not yet tested the low-level I2C routines. Over the past couple of days, I re-wrote my I2C drivers to include using the hi-level I2C commands and they now work on the GR-PEACH. I will try the low level routines later when I get a chance.

posted by Kevin Braun 01 May 2015

1 Answer

9 years ago.

Your best bet is probably the mbed github. Or just stick to regular functions, in general a better idea than the low level functions.

Accepted Answer

Using the "regular functions" is a nice gesture Erik,

However, I have written a few I2C drivers. Sometimes using the more complex functions results in problems with some mbed devices and not others. Also, there are a few devices (i.e the MLX90620) that have a non-standard way of using the I2C bus. Because of these incompatibility issues, I always used the low-level I2C commands when writing drivers. Until GR-PEACH, my drivers have always worked with all other mbed CPUs that I use.

I am unfamiliar with github.

Regards,

...kevin

posted by Kevin Braun 27 Apr 2015

Non-standard I2C devices can be an issue. But actually the normal ones should be less likely to have differences between devices, since some devices simply are not suitable for the low-level ones (due to I2C peripherals never being intended for that).

Mbed github is here: https://github.com/mbedmicro/mbed

posted by Erik - 27 Apr 2015