Here is my code
rtv = mraa_init();
if (rtv != MRAA_SUCCESS && rtv != MRAA_ERROR_PLATFORM_ALREADY_INITIALISED)
printf( "ER MRAA Init Failed,Return Value is %d\n",rtv);
i2c = mraa_i2c_init(0);
|rav = mraa_i2c_address(i2c, ADDR);|
|printf("** return value is %d\n",rav);|
With no i2c devices connected all values of ADDR 0x7F and below return 0 and all values of ADDR above 0x80 return 5,
My problem is that I have two i2c devices on the buss. One is address 0x5C and the other 0X9A. The device with address 0x5C is working fine but I just get error returns for the one with address 0x9A.
I tried it with chips installed and without chips installed. It makes no difference. I get error 5 with high order addresss and 0 with addresses below 0x7F and below.
My choices of addresses are 0x9n and 0xAn. There are lots of choices of n but only 9 or A for the first nibble.
I also tried defining a variable of type uint8_t and using that instead of the 0x9A but no difference
Well, that was an easy answer. One device has an address in its data sheet of 5C and the other has an address in the data sheet of 9A. The address of the first device is in fact 5C when using mmra. The second device uses 0x4D when using mmra, its published address shifted right one bit. Code works now.
Hope this helps someone else.