Go Down

Topic: pcf8574 with DUE does not work (Read 1 time) previous topic - next topic

franz0815

I have used the a PIO on Arduino UNO. The Software and Harware was from
http://www.elektronik-bastelkeller.de/arduino_pcf8574.php
This run perfectly.

The same with DUE did not work.

Experiments:
#SCL, SDA  is on i20 und 21
#Pull up 4k7 and 15k - no sucsess.
#supply Voltage from Duo with 3,3 Volt should be possible acording the Datasheet of PCF8574
#An I2C Scanner from http://playground.arduino.cc/Main/I2cScanner find a response
  at adress 0x20
 
Thanks



 

MarkT

Sorry to hear that, but how can we help?

Or put another way, post your code, post your circuit...  We can't mind-read!!!
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

cartoonist

#2
Jan 01, 2015, 04:04 pm Last Edit: Jan 01, 2015, 04:16 pm by cartoonist
I found the sketch at PCF8574
It did not work like that, I had to change a line in the setup of both the sketches:

Wire.begin(I2C_ADDR);

changed it to

Wire.begin();
 
and it worked

edit: The line Wire.begin(I2C_ADDR); will define the device at the address 'I2C_ADDR'  as  the master of the bus, so the pcf8574 was set as master. That will not work.
You do not need a new P.C., you need a new O.S.  Linux is free, safe, easy, fast and reliable.

franz0815

The change "Wire.begin(I2C_ADDR);  to Wire.begin();" was the solution.

Thanks everboby, who writes in this thread.

urvi1995

I have used IO Expander with Arduino Mega. it work good. but later I switch to Arduino DUE for more processing power. but I got following compile error.
Compiling libraries...
Compiling library "Azande"
Using previously compiled file: C:\Users\Hi\AppData\Local\Temp\arduino_build_339666\libraries\Azande\Azande.cpp.o
Compiling library "Wire"
Using previously compiled file: C:\Users\Hi\AppData\Local\Temp\arduino_build_339666\libraries\Wire\Wire.cpp.o
Compiling library "PCF8574"
"C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -Wall -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10805 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM  -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON '-DUSB_MANUFACTURER="Arduino LLC"' '-DUSB_PRODUCT="Arduino Due"' "-IC:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\system/libsam" "-IC:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\system/CMSIS/CMSIS/Include/" "-IC:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\system/CMSIS/Device/ATMEL/" "-IC:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\cores\arduino" "-IC:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x" "-IC:\Users\Hi\Documents\Arduino\libraries\Azande\src" "-IC:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src" "-IC:\Users\Hi\Documents\Arduino\libraries\PCF8574" "-IC:\Users\Hi\Documents\Arduino\libraries\RTClib-master" "C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp" -o "C:\Users\Hi\AppData\Local\Temp\arduino_build_339666\libraries\PCF8574\PCF8574.cpp.o"
In file included from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:22:0:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:3:41: error: 'PCMSK0' was not declared in this scope

 volatile uint8_t *port_to_pcmask[] = { &PCMSK0, &PCMSK1, &PCMSK2 };

                                         ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:3:50: error: 'PCMSK1' was not declared in this scope

 volatile uint8_t *port_to_pcmask[] = { &PCMSK0, &PCMSK1, &PCMSK2 };

                                                  ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:3:59: error: 'PCMSK2' was not declared in this scope

 volatile uint8_t *port_to_pcmask[] = { &PCMSK0, &PCMSK1, &PCMSK2 };

                                                           ^

In file included from C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:28:0,

                 from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:19:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h: In function 'void PCattachInterrupt(uint8_t, void (*)(), int)':

C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:63:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]

 #define digitalPinToPort(P)        ( g_APinDescription[P].pPort )

                                                                 ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:18:17: note: in expansion of macro 'digitalPinToPort'

  uint8_t port = digitalPinToPort(pin);

                 ^

In file included from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:22:0:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:42:2: error: 'PCICR' was not declared in this scope

  PCICR |= 0x01 << port;

  ^

In file included from C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:28:0,

                 from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:19:

C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer

 #define portInputRegister(port)    ( &(port->PIO_PDSR) )

                                            ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:45:18: note: in expansion of macro 'portInputRegister'

  PCintLast[0] = *portInputRegister(2);

                  ^

C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer

 #define portInputRegister(port)    ( &(port->PIO_PDSR) )

                                            ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:46:18: note: in expansion of macro 'portInputRegister'

  PCintLast[1] = *portInputRegister(3);

                  ^

C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer

 #define portInputRegister(port)    ( &(port->PIO_PDSR) )

                                            ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:47:18: note: in expansion of macro 'portInputRegister'

  PCintLast[2] = *portInputRegister(4);

                  ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h: In function 'void PCdetachInterrupt(uint8_t)':

C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:63:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]

 #define digitalPinToPort(P)        ( g_APinDescription[P].pPort )

                                                                 ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:52:17: note: in expansion of macro 'digitalPinToPort'

  uint8_t port = digitalPinToPort(pin);

                 ^

In file included from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:22:0:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:67:3: error: 'PCICR' was not declared in this scope

   PCICR &= ~(0x01 << port);

   ^

In file included from C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:28:0,

                 from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:19:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h: In function 'void PCint(uint8_t)':

C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer

 #define portInputRegister(port)    ( &(port->PIO_PDSR) )

                                            ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:80:10: note: in expansion of macro 'portInputRegister'

  curr = *portInputRegister(port + 2);

          ^

In file included from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:22:0:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h: At global scope:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:104:7: error: expected constructor, destructor, or type conversion before '(' token

 SIGNAL(PCINT0_vect) {

       ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:107:7: error: expected constructor, destructor, or type conversion before '(' token

 SIGNAL(PCINT1_vect) {

       ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:110:7: error: expected constructor, destructor, or type conversion before '(' token

 SIGNAL(PCINT2_vect) {

       ^

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp: In member function 'void PCF8574::checkForInterrupt()':

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:199:6: error: 'sei' was not declared in this scope

  sei();

      ^

In file included from C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCF8574.cpp:22:0:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h: At global scope:

C:\Users\Hi\Documents\Arduino\libraries\PCF8574\PCint.h:73:13: warning: 'void PCint(uint8_t)' defined but not used [-Wunused-function]

 static void PCint(uint8_t port) {

             ^

Using library Azande at version 2.0.1 in folder: C:\Users\Hi\Documents\Arduino\libraries\Azande
Using library Wire at version 1.0 in folder: C:\Users\Hi\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire
Using library PCF8574 in folder: C:\Users\Hi\Documents\Arduino\libraries\PCF8574 (legacy)
Using library RTClib-master at version 1.2.1 in folder: C:\Users\Hi\Documents\Arduino\libraries\RTClib-master
exit status 1
Error compiling for board Arduino Due (Programming Port).

Go Up