Skip to content

missing documentation: list of the Arduino board types + print the current one #6345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tofrnr opened this issue Jun 4, 2017 · 13 comments
Closed

Comments

@tofrnr
Copy link

tofrnr commented Jun 4, 2017

hello,
where can I find the list of the available Arduino board or MCU types (e.g., for Uno, Nano, Mega, M0, Due, but also supported boards like ESP8266, and how can I print the current board / MCU type from a running program to check the settings?
I need that overview and the current type check for writing cross-board-compatible code for pin numbers and interrupt numbers, e.g. by
#ifdef
#ifndef
#elseif

@facchinm
Copy link
Member

facchinm commented Jun 5, 2017

Hi @tofrnr ,
unfortunately there is no such list... If you want to target specific boards you can use the #ifdef ARDUINO_$PROVIDER_$BOARDNAME or the architecture generic #ifdef ARDUINO_ARCH_$ARCHTECTURE but if you want to target a family of microcontrollers (like atmega328p) you'll need to take a look at the compiler's specific defines.
The fastest way to create this list is compiling with verbose output for all the boards you want to target and take a look al the generated commandline.

@facchinm facchinm closed this as completed Jun 5, 2017
@tofrnr
Copy link
Author

tofrnr commented Jun 5, 2017

why do you close that topic? it's not resoved !
please reopen!

@tofrnr
Copy link
Author

tofrnr commented Jun 5, 2017

which constants for board and MCUs are used by Arduino?
e.g., for detecting number of digital pins or A* pins or for interrupt pin numbers?

@cmaglie
Copy link
Member

cmaglie commented Jun 5, 2017

This is a question for the forum: https://forum.arduino.cc/

Please also search for already answered questions, I'm pretty sure that someone else already discussed the same question.

@tofrnr
Copy link
Author

tofrnr commented Jun 5, 2017

no, this is a request for adding and publishing the (missing) documentation!

@tofrnr
Copy link
Author

tofrnr commented Jun 6, 2017

@facchinm,
please reopen this topic!
It is not resolved!
tbh, I consider your attitude to be quite rude and unrespectful: I reported this missing documentation about board and mcu type constants to be provided subsequently, and it's not been done so far.
If this all once will have been published, I'll immediately agree to close this topic, don't worry, but so far nothing like that is visible and thus this topic has to be remained opened!

@facchinm
Copy link
Member

facchinm commented Jun 6, 2017

@tofrnr ,
first of all, there is no explicit request to add documentation in the first post; you only said you need that for your library. Then, maintaining such list is a PITA and doesn't add any value to the Arduino ecosystem, which is always trying to be cross-platform by hiding such details at core level. If you really need to access low level functionalities (for example, to perform high speed operation on pins) you can take a look at @PaulStoffregen 's OneWire library (https://github.com/PaulStoffregen/OneWire/blob/master/OneWire.h#L61) which contains most of the needed defines. If you need to target a specific board, I repeat, the define is #ifdef ARDUINO_$PROVIDER_$BOARDNAME and I believe no-one wants to maintain a list of hundreds boards which all refer to this simple pattern.

@bengtmartensson
Copy link

It appears as that what the O.P. wants can be achieved with extraction of information from the boards.txt files, possibly together with some formatting. Try

grep -h build.board. /usr/local/arduino/hardware/arduino/avr/boards.txt ~/.arduino15/packages/*/hardware/*/*/boards.txt | sed -e s"/[^=]*=//"|sort -u

as a first start (on typical Linux installation).(Can use cygwin if on Windows.)

@tofrnr
Copy link
Author

tofrnr commented Jun 6, 2017

@facchinm,
I doubt vehemently that "it doesn't add any value to the Arduino ecosystem", and I don't care if you think it perhaps wouldn't. It is a documentation request and it's impertinent to close this request as long it is not resolved and provided, no matter what you think!

@PaulStoffregen
Copy link
Contributor

Actually, what Martino thinks does matter. He's one of the very few active Arduino developers. You aren't.

@tofrnr
Copy link
Author

tofrnr commented Jun 7, 2017

so then please tell how to poll from a general program for AVR and ARM and Nodemcu boards during runtime

  • the current number of maximum available digital pins
  • the current number of maximum available analog ADC pins
  • the pin numbers for DAC if availble (only Due, on Mega it's ADC)
  • which D and A pin numbers in between are reserved for I2C, SPI, UART, i.e.
  • the pin numbers for all I2C, all UART, and SPI
  • the pin numbers for analog DAC (only (Due)
  • which pins are available for pinchange interrupts, timer interrupts, and for pwm (to avoid overlap or double occupancy)

for a simple example:
can one always analogRead A4 (Mega, Due, M0) or is it reserved for I2C (Uno, Nano) or not at all (nodemcu)?
is there a pin 15 (Mega, Due, nodemcu) and is it free for digital r/w (nodemcu)?
is A2 available (not on nodemcu)
is A6 available (Nano, Mega, Due, not Uno+nodemcu)
is pin 52 available (Mega, Due) and can one r/w to pin 51 (Due) or not (SPI on Mega)?

if there was a list of board and MCU type constants like requested then one could determine that easily on his own.

And reopen this topic because it's not resolved!

@per1234
Copy link
Collaborator

per1234 commented Jun 7, 2017

@tofrnr you're being extremely rude. This is a place to report bugs with the Arduino IDE. As was already suggested, if you want help you need to post your questions on the forum. Hundreds of people get an email every time you make a pointless comment here. Please stop wasting the time of the Arduino developers so they can instead work on the things that benefit the entire Arduino community.

The board macros are already documented here:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#boardstxt
There's no point in trying to maintain a full list. If you take the time to understand how the build.board property set in boards.txt is used you can easily determine the macro for any board.

As for the MCU specific macros, that's outside the scope of Arduino. A list of the AVR macros is found here:
http://www.atmel.com/webdoc/AVRLibcReferenceManual/using_tools_1using_avr_gcc_mach_opt.html
for MCU specific macros of other architectures you will have to do some research of your own.

@tofrnr
Copy link
Author

tofrnr commented Jun 7, 2017

no, I was asking nicely to publish the list but my request was immediately closed in an extremely rude manner without solving the issue.
That was the only rude thing over here.

anyway, so is it true that its possible to determine if the current board is a Nano type (feat. A0...A7) by
#ifdef __AVR_ATmega328__
and for the Unos (feat. A0...A5) by
#ifdef __AVR_ATmega328P__

?
and if so, which are the general constants for M0, Due, and nodemcu ?
This is what my question is about: if available, please publish it and link to it at the Arduino documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants