I am unable to run code on Arduino Due that I earlier ran on an Arduino Uno. The error indicates it is unable to recognize the library. Could this library access problem be due to difference of the micro-controllers of the 2 boards?


1 Answer 1


Quite possibly. The modern library format contains a list of board types it runs on (in library.properties). If the Due (SAM) isn't listed then it won't be included in the list of libraries.

For instance the SD library has:

author=Arduino, SparkFun
maintainer=Arduino <[email protected]>
sentence=Enables reading and writing on SD cards. 
paragraph=Once an SD memory card is connected to the SPI interface of the Arduino or Genuino board you can create files and read/write on them. You can also move through directories on the SD card.
category=Data Storage

However the AVR specific SPI library has:

maintainer=Arduino <[email protected]>
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus.  
paragraph=SPI is a synchronous serial data protocol used by microcontrollers for communicating with one or more peripheral devices quickly over short distances. It uses three lines common to all devices (MISO, MOSI and SCK) and one specific for each device.

Note the last line of each - architectures=... - that defines what the library can work with. If your (unspecified) library doesn't have * or include sam in that parameter then there is no way that library will work with the Due.

  • Yes, Due wasn't listed earlier. I installed Due from the Boards Manager. It is able to run other programs . Currently it is not able to access a DFT library which I had earlier ran on Arduino Uno. Commented Jun 13, 2017 at 13:22
  • I am not talking about board support. I am talking about whether the library can ever support the Due. If it's a modern layout with library.properties and it's not designed to run on the Due then the IDE won't even see that it exists - no matter what you do.
    – Majenko
    Commented Jun 13, 2017 at 13:27
  • "the IDE won't even see that it exists". This is incorrect. The Arduino IDE will still attempt to compile for the library even though the architectures value in library.properties doesn't match the architecture of the selected board. If compilation can proceed past preprocessing then the Arduino IDE will display a helpful warning: "WARNING: library FooBar claims to run on (avr) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s)." The examples of the library will also appear under File > Examples > INCOMPATIBLE.
    – per1234
    Commented Sep 12, 2017 at 13:24
  • Now libraries such as SPI that are bundled with hardware packages are only seen by the IDE when a board of that hardware package is selected but this has nothing to do with the architectures value in library.properties, it is solely controlled by the folder the library is located in.
    – per1234
    Commented Sep 12, 2017 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.