Programm error: assertion "(address & 0x80) == 0" failed

After compiling and uploading my scetch to the ArduinoDUE, I get this error message via programming port:

"assertion "(address & 0x80) == 0" failed: file "../source/twi.c", line 261, function: TWI_StartWrite
Exiting with status 1."

I tried to finde the file "twi.c" on my harddrive, but could not finde it.
Is the file located on the arduino?

Is this a known error and what caused it?

uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) {

...address cannot be > 127.

Thank you for the fast answer. :slight_smile:

Where do I have to replace the code?
There seems to be no file on my HD, that contains the faulty code.

I'm not that good with Arduino.
Can you give me some additional informations about the cause of the error and wehere it is located?
I understand "address cannot be > 127" but I don't know why the code works on my Arduino Mega but refuses to work on my DUE. :~

Trench:
Thank you for the fast answer. :slight_smile:

You are welcome.

I understand "address cannot be > 127" but I don't know why the code works on my Arduino Mega but refuses to work on my DUE. :~

According to these...

http://www.nongnu.org/avr-libc/user-manual/group__twi__demo.html
http://www.i2c-bus.org/addressing/
http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html

...I2C addresses > 127 are not valid. Which means the assertion is correct and the problem is very likely in your sketch.

Can you give me some additional informations about the cause of the error and wehere it is located?

Post (or attach) your sketch.

...I2C addresses > 127 are not valid. Which means the assertion is correct and the problem is very likely in your sketch.

I just double checked my sketch. It works perfectly on the Mega 265 board.
The only device using I2C is a two-wire LCD display.
To print a message i use this code:

** lcd.setCursor(0, 0);**
** lcd.print(display_line_1);**
** lcd.setCursor(0, 1);**
** lcd.print(display_line_2);**

In other words, I don't have to bodder with adressing.
I just send the text I want to print via the library to the display.

After digging through the tutorials (thank you, great stuff :slight_smile: ), I have a wild hunch where the problem may come from.
The library is written for a 16mHz and not for a 82Mhz chip:

** // overclcking I2C**
** #define CPU_FREQ 16000000L // (...) - a discuter, car fonction vitesse clock cpu**
** #define TWI_FREQ_MCP23008 400000L**

Do i have to replace those Lines with the new clock speed?

** // overclcking I2C**
** #define CPU_FREQ 82000000L // (...) - a discuter, car fonction vitesse clock cpu**
** #define TWI_FREQ_MCP23008 400000L** <--- do i need to modify this line too?

The Due/SAM3X takes the TWI address in 7 bit format with out the lower b0 R/W. ie range 0-127. and that is used to write the hardware address register.
A lot of TWI address are quoted in 8bit format with the lower R/W bit added and then it is written it to the hardware address register.
This particular syntax got me stymied for a few days when an NXP data sheet was quoting the address in 8 bit "hex" format and Ididn't realize it.

Hi Guys!

I know that it's been a while ... but has anyone got a better handle on the cause and resolution of this issue?

I've run into the same thing. On a DUE accessing ADS1115 via I2C and the WIRE library. I've already verified that the address that I am passing the ADS1115 lib is correct but I have not yet verified the address that it is passing to wire, etc. However, the above appears to lean towards a cpu frequency issue.

The odd thing is that this program has worked fine for quite a while running for days at a time and now it does the same thing for about 15 minutes and then...crashes as above.

Not sure if this is related but...checking to see if I have the correct version of Wire library and saw someone say that it was supposed to be in hardware/arduino/sam/libraries/Wire...but I don't have sam. Running 1.6.5 Arduino IDE and 1.6.4 DUE board version. ...but no sam...so I remove and reinstall the DUE board and still no sam.

Any direction or suggestion greatly appreciated!

Thanks!

I had or have the same problem. I found twi.c file in C:\Program Files\arduino\hardware\arduino\avr\libraries\Wire\utility folder.

Error is related with addresses, I noticed, so it is possible that too large address is the problem.

Arduino can have strange problems. I had conflicting libraries, until I restarted my machine.