Go Down

Topic: Arduino Due & The Wire Library (Read 2262 times) previous topic - next topic

GolamMostafa

#15
Nov 09, 2017, 04:31 am Last Edit: Nov 09, 2017, 04:33 am by GolamMostafa
@ pert  

This is just to satisfy my queries:

I have found two Wire.h files in the following paths in my one PC (rarely used when my primary PC is down). The contents of the files look identical. I have also included the .cpp files.

This PC > Documents > WPA Files > Arduino15 > packages > arduino > hardware > sam > 1.6.2 > libraries > Wire

This PC > Local Disk (C:) > Program Files(x86) > Arduino > hardware > arduino > avr > libraries > Wire > src

In my other two PCs, the Top path (.....sam > ) does not exist.

In all these 3 computers, TWI Bus DUE and UNO programs run well.

pert

In my other two PCs, the Top path (.....sam > ) does not exist.
Are you saying that on those two PCs if you do this:
  • Tools > Board > Arduino Due
  • File > Examples > Wire > digital_potentiometer
  • Sketch > Show sketch folder

It opens this exact path:
This PC > Local Disk (C:) > Program Files(x86) > Arduino > hardware > arduino > avr > libraries > Wire > src

artisticforge

From https://github.com/arduino/ArduinoCore-sam/issues/19:Almost certainly not. Try this:
  • Tools > Board > Arduino/Genuino Uno
  • File > Examples > Wire > digital_potentiometer
  • Sketch > Show sketch folder
  • Tools > Board > Arduino Due
  • File > Examples > Wire > digital_potentiometer
  • Sketch > Show sketch folder

You will now see that you have two different Wire folders. One is in the libraries subfolder of your Arduino AVR Boards hardware package, the other in the libraries subfolder of your Arduino SAM Boards package. It's easy to think it's only one library because of the standardized API and the IDE automatically choosing the correct library based on board selection.

Hello

Earlier today I found at least 4 different Wire Libraries

the Boards
Arduino Yun - /home/niemand/arduino-1.8.5/hardware/arduino/avr/libraries/Wire/examples/digital_potentiometer/
Arduino Due - /home/niemand/.arduino15/packages/arduino/hardware/sam/1.6.11/libraries/Wire/examples/digital_potentiometer/
Arduino Zero - /home/niemand/.arduino15/packages/arduino/hardware/samd/1.6.16/libraries/Wire/examples/digital_potentiometer/
Arduino Primo - /home/niemand/.arduino15/packages/arduino/hardware/nrf52/1.0.2/libraries/Wire/examples/digital_potentiometer/

So with the limited buffer in Arduino I2C/TWI the two Arduino Due master / slave example does work.

I did come across another interesting note on the Wire Library:

Quote
https://www.arduino.cc/en/Reference/Wire
Note

There are both 7- and 8-bit versions of I2C addresses. 7 bits identify the device, and the eighth bit determines if it's being written to or read from. The Wire library uses 7 bit addresses throughout. If you have a datasheet or sample code that uses 8 bit address, you'll want to drop the low bit (i.e. shift the value one bit to the right), yielding an address between 0 and 127. However the addresses from 0 to 7 are not used because are reserved so the first address that can be used is 8. Please note that a pull-up resistor is needed when connecting SDA/SCL pins. Please refer to the examples for more informations. MEGA 2560 board has pull-up resistors on pins 20 - 21 onboard.
Are 0 through 7 still reserved?
I did change the 2 in the examples to 8 just in case.


hirschmensch

I had a similar problem so I wrote my own library for the TWI. But I have only implemented what I needed in my project. Here's the link: https://github.com/hirschmensch/Arduino-Due-DSP

sam3x8e_twi is the name of the library files.

maybe this helps...

LarryKloth

I don't know if this helps but I found that I believe that the include directory for the HID, SPI, and Wire  files end at Sam/1.6.11/libraries . I would think that as an example that should include Wire/src in the list. When I did this in Visual Studio the problem seams to go away any input?

Go Up