Go Down

Topic: Programm error: assertion "(address & 0x80) == 0" failed (Read 2586 times) previous topic - next topic

Trench

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?

Coding Badly

Code: [Select]
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) {

...address cannot be > 127.

Trench

Thank you for the fast answer.  :)

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.   :~



Code: [Select]
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) {

...address cannot be > 127.


Coding Badly

Thank you for the fast answer.  :)


You are welcome.

Quote
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.

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


Post (or attach) your sketch.

Trench

Quote
...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  :) ), 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?

neil12

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.

Go Up