Pages: [1]   Go Down
Author Topic: wire library endTransmission() still not working with Due  (Read 183 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have read the posts about endTransmission() returning non-zero on successful transmits. This was supposed to have been fixed in Arduino 1.5.7.
I am testing this with a tinyRTC board. My I2C scanner which relies upon wire.endTransmission()  returns 2 (NACK) for the RTC address (0x68).
However, if I use the RTCdue library which does not use wire, I can access and read the RTC.
My conclusion is that wire is still not fixed for the due.

Any help? I make extensive use of I2C and could do with a working wire library for the Due.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I discovered that RTClib assumes connection to the second I2C port on the Due, without giving the option as to which port you are connected to. Once I sorted that out, it all works as expected.

#ifdef __AVR__
 #include <avr/pgmspace.h>
 #define WIRE Wire
#else
 #define PROGMEM
 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
 #define WIRE Wire // Wire1  --- You have to change Wire1  to Wire to use the standard I2C port on the Due
#endif

Logged

Pages: [1]   Go Up
Jump to: