MAX44000 PMB1 programming Error- ( mbed assertation failed: )

10 Feb 2017

/media/uploads/MahekDave/max44000.txt I am trying to program MAX44000 PMB1 (Proximity Sensor) with MAX32630FTHR Board. But after running the sample program (file attached), I get the error -

"Initialized MAX44000 mbed assertation failed: stop != 0, file: C:\Jenkins\workspace\mbed-2-build-library\targets\TARGET_Maxim\TARGET_MAX32630\i2c_api.c, line 103 "

Please help me in programming MAX44000 peripheral module with MAX32630 FTHR Board.

/media/uploads/MahekDave/max44000.txt

11 Feb 2017

Dave,

You can find the official mbed library sources below. It's also a fairly small download (41MB) for convenient browsing on your home machine.

Click on mbed-dev below to browse the library source online. Also, take note of "Supersedes mbed-src." /media/uploads/AzqDev/arrow-link-color.gif

Import librarymbed-dev

mbed library sources. Supersedes mbed-src.

The offending line 103 of i2c_api.c, found at
https://developer.mbed.org/users/mbed_official/code/mbed-dev/file/ff67d9f36b67/targets/TARGET_Maxim/TARGET_MAX32630/i2c_api.c is shown in line 3 below:

int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
{
    MBED_ASSERT(stop != 0);  // <<<<<<<<<<<<<<<<<< HERE IS THE LINE 103 ASSERT <<<<<<<<<<<<<
    return I2CM_Read(obj->i2c, address >> 1, NULL, 0, (uint8_t *)data, length);
}

From the above it seems that this target's version of i2c_read requires stop to be a non-zero value.

Then, in https://developer.mbed.org/users/mbed_official/code/mbed-dev/file/ff67d9f36b67/drivers/I2C.cpp we find at line 79

int I2C::read(int address, char* data, int length, bool repeated) {
    // stuff deleted

    int stop = (repeated) ? 0 : 1; // <<<<<<<<< STOP SET TO ZERO WHEN REPEATED IS TRUE <<<<<<<<<
    int read = i2c_read(&_i2c, address, data, length, stop);

    // stuff deleted

And in line 98 of https://developer.mbed.org/users/mbed_official/code/mbed-dev/file/ff67d9f36b67/drivers/I2C.h we see the default for parameter repeated is false.

     int read(int address, char *data, int length, bool repeated = false); // <<< DEFAULT FOR REPEATED IS FALSE <<<

This means the assert will only fail when parameter repeated is deliberately set to true.

This should give you enough material to dig into the Max4400 library and find the offending reads that set repeated to true, and find a way around them.

Also, I'm sure that the Max4400 team and library creator(s) would certainly appreciate the feedback on their library.

Hope that helps, let us know what happened!

Azq
IQS624 library creator
http://bit.ly/IQS624-page