How to use CN0391 evaluation board with Arduino DUE (Vcc and SPI library problems)

Hi everyone,

I am starting to use the evaluation board EVAL-CN0391-ARDZ based on AD7124-8 analog to digital converter (four channel thermocouple shield). I already used it with an Arduino UNO and MEGA (so AVR board with 5V logic) using the provvided official example and it works very well.

Now I want to move to Arduino DUE (so ARM board with 3.3V logic) but I encoured two dinstinct problems:

  1. Bus and power supply voltage problem. The evaluation board is based on 5V logic. The voltage supply, as well as the SPI bus are 5V. Looking at the schematic note of the board, I notice that there is a voltage level converter that shift the 5V to 3.3V and the indeed the AD7124-8 work at 3.3V. Now, the point is that I can't use 5V board on my DUE otherwise I burn the microntroller. How can I overcome this problem?
    1. One not very nice solution is to use an external breakout board that shift the 5V (CN0391 shield side) to 3.3V (Arduino DUE side).
    2. Another solution is to somehow bypass the level-converter of the CN0391 and use directly the 3.3V logic of DUE. Is it possible to bypass such level converter?
    3.  Are there other solution to use the shield on a 3.3V logic microcontroller?
  2. Library problem. When I try to compile the official example  for a AVR board, everything works correctly and I can upload the code on my MEGA. However when I try to compile the same code for an ARM microcontroller (in particolar I select DUE on the Arduino IDE), I get a long list of errors. All the errors are referred to the routine "SPI_Read()" and "SPI_Write" that are into the "Communication.h" file. I attach the long log of the error that I get when I try to compile the library selecting ARM microcontroller. How can I fix the library in order use the CN0391 with an ARM microcontroller (example the Arduino DUE)?

Thank you very much for the help and best regards.

Alberto

5657.ErrorLogCN0391.txt
In file included from sketch\AD7124.cpp:50:0:

Communication.h:57:91: error: declaration of C function 'void SPI_Write(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Write(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                           ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:36,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\libraries\SPI\src/SPI.h:15,

                 from sketch\Communication.h:40,

                 from sketch\AD7124.cpp:50:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:93:13: error: previous declaration 'void SPI_Write(Spi*, uint32_t, uint16_t)' here

 extern void SPI_Write( Spi* spi, uint32_t dwNpcs, uint16_t wData ) ;

             ^

In file included from sketch\AD7124.cpp:50:0:

Communication.h:58:90: error: declaration of C function 'void SPI_Read(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Read(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                          ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:36,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\libraries\SPI\src/SPI.h:15,

                 from sketch\Communication.h:40,

                 from sketch\AD7124.cpp:50:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:92:17: error: previous declaration 'uint32_t SPI_Read(Spi*)' here

 extern uint32_t SPI_Read( Spi* spi ) ;

                 ^

In file included from sketch\CN0391.cpp:48:0:

Communication.h:57:91: error: declaration of C function 'void SPI_Write(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Write(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                           ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from sketch\CN0391.cpp:41:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:93:13: error: previous declaration 'void SPI_Write(Spi*, uint32_t, uint16_t)' here

 extern void SPI_Write( Spi* spi, uint32_t dwNpcs, uint16_t wData ) ;

             ^

In file included from sketch\CN0391.cpp:48:0:

Communication.h:58:90: error: declaration of C function 'void SPI_Read(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Read(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                          ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from sketch\CN0391.cpp:41:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:92:17: error: previous declaration 'uint32_t SPI_Read(Spi*)' here

 extern uint32_t SPI_Read( Spi* spi ) ;

                 ^

In file included from sketch\Communication.cpp:42:0:

Communication.h:57:91: error: declaration of C function 'void SPI_Write(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Write(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                           ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:36,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\libraries\SPI\src/SPI.h:15,

                 from sketch\Communication.h:40,

                 from sketch\Communication.cpp:42:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:93:13: error: previous declaration 'void SPI_Write(Spi*, uint32_t, uint16_t)' here

 extern void SPI_Write( Spi* spi, uint32_t dwNpcs, uint16_t wData ) ;

             ^

In file included from sketch\Communication.cpp:42:0:

Communication.h:58:90: error: declaration of C function 'void SPI_Read(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Read(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                          ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:36,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\libraries\SPI\src/SPI.h:15,

                 from sketch\Communication.h:40,

                 from sketch\Communication.cpp:42:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:92:17: error: previous declaration 'uint32_t SPI_Read(Spi*)' here

 extern uint32_t SPI_Read( Spi* spi ) ;

                 ^

In file included from C:\Users\mora\Google Drive\Strumentazione STIIMA - CNR\EVAL-CN0391-ARDZ thermocouple RTD ADC Analog Devices\Arduino code\CN0391_example_Improved_By_AM\CN0391_example_Improved_By_AM.ino:3:0:

Communication.h:57:91: error: declaration of C function 'void SPI_Write(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Write(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                           ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from sketch\CN0391_example_Improved_By_AM.ino.cpp:1:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:93:13: error: previous declaration 'void SPI_Write(Spi*, uint32_t, uint16_t)' here

 extern void SPI_Write( Spi* spi, uint32_t dwNpcs, uint16_t wData ) ;

             ^

In file included from C:\Users\mora\Google Drive\Strumentazione STIIMA - CNR\EVAL-CN0391-ARDZ thermocouple RTD ADC Analog Devices\Arduino code\CN0391_example_Improved_By_AM\CN0391_example_Improved_By_AM.ino:3:0:

Communication.h:58:90: error: declaration of C function 'void SPI_Read(unsigned char, unsigned char*, unsigned char)' conflicts with

 void SPI_Read(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);

                                                                                          ^

In file included from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/chip.h:58:0,

                 from C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:42,

                 from sketch\CN0391_example_Improved_By_AM.ino.cpp:1:

C:\ProgramData\MATLAB\SupportPackages\R2019a\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\hardware\sam\1.6.12\system/libsam/include/spi.h:92:17: error: previous declaration 'uint32_t SPI_Read(Spi*)' here

 extern uint32_t SPI_Read( Spi* spi ) ;

                 ^

exit status 1
declaration of C function 'void SPI_Write(unsigned char, unsigned char*, unsigned char)' conflicts with



Small improvements in the title
[edited by: Albi at 1:46 PM (GMT -4) on 3 Sep 2020]

Top Replies