Skip to content
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

boards/arduino-nano: Support for the Arduino Nano #9499

Merged
merged 3 commits into from
Mar 14, 2019

Conversation

maribu
Copy link
Member

@maribu maribu commented Jul 4, 2018

Contribution description

This PR adds support for the Arduino Nano. The Arduino Nano board is the cheapest member of the Arduino family and used the same MCU as the Arduino Uno. It differs in the form factor (the Nano is much smaller), it uses an integrated FT232RL TTL adapter instead of an ATmega16u2 to provide access to the serial console via USB, and it uses a different bootloader (which occupies 2 KiB of the 32 KiB flash instead of 0.5 KiB occupied on the Arduino Uno). This commit mostly copy pastes code from the Arduino Uno.

Testing procedure

  • Check the provided documentation
  • Check if make BOARD=arduino-nano flash and make BOARD=arduino-nano term works for examples/hello-world

As this shares most code with the Arduino UNO, no huge troubles are expected.

Issues/PRs references

None

@maribu
Copy link
Member Author

maribu commented Jul 4, 2018

TODO: Is the serial device on Linux really /dev/ttyUSB0 for Arduino Nano? (I own a board that should be mostly compatible to the Arduino Nano and looks similar to it, but it is not actually an Arduino at all.) Maybe someone can help me with that?

@ZetaR60
Copy link
Contributor

ZetaR60 commented Jul 4, 2018

@maribu I think you need to find someone with an Arduino Nano in order to complete this PR. Your similar board is not enough because we have no guarantee that it will translate over to the Arduino Nano.

@ZetaR60 ZetaR60 added Type: new feature The issue requests / The PR implemements a new feature for RIOT Platform: AVR Platform: This PR/issue effects AVR-based platforms Area: boards Area: Board ports Community: help wanted The contributors require help from other members of the community Area: arduino API Area: Arduino wrapper API labels Jul 4, 2018
@maribu
Copy link
Member Author

maribu commented Jul 5, 2018

@ZetaR60: All Arduino clones I saw so far use the same PIN layout, the same MCU, and the same bootloader. Some use a different USB to UART chip, which is a minor inconvenience on Linux machines. E.g. the device file of official Arduino UNO will be located at /dev/ttyACM0, while most clones will have it named /dev/ttyUSB0. Apart from that and the missing Arduino logo the clones are identical to the real boards.

This PR uses /dev/ttyUSB0, as this almost accepted PR used it also. But maybe that PR was never tested on an official board...

@maribu
Copy link
Member Author

maribu commented Jul 5, 2018

@SemjonKerner, @sebastiankliem, @smlng: You were active in the old and apparently dead Arduino Nano PR. Did you test that PR on original hardware? If so, could test this PR, also?

@ZetaR60
Copy link
Contributor

ZetaR60 commented Jul 5, 2018

@maribu The code would probably end up okay, but in my opinion should still be tested at least once on an original. I think it is fine to go ahead and work on the PR, as it shouldn't be too hard to find someone that has one.

@maribu
Copy link
Member Author

maribu commented Jul 5, 2018

@ZetaR60: I totally agree that this should be tested on an original Arduino. I just wanted to point out, that apart from the PORT value on Linux it is unlikely that something wont work.

@maribu
Copy link
Member Author

maribu commented Jul 5, 2018

Another issue: Currently this PR contains no C code or header files. As result, Doxygen documentation for this board is available. May creating a board.h that contains the documentation and an #include to the Arduino Uno's board.h would be better?

Or maybe the whole folder should be dropped and instead some Makefile magic like

ifeq($(BOARD),arduino-nano)
  export PROGRAMMER_SPEED ?= 57600
  BOARD := arduino-uno
endif

should be used?

@kYc0o
Copy link
Contributor

kYc0o commented Jul 5, 2018

Please look at #9130, I'd like to avoid more code duplication by adding more atmega based boards. I know the PR seems big but I'll try to split it once they allow me to squash.

@maribu
Copy link
Member Author

maribu commented Jul 5, 2018

@kYc0o: I'm not sure if I got you. Are you suggesting to wait until #9130 is merged, than rebase this PR against it?

Actually, I'm not even sure if this PR is really required. Updating the wiki page to tell users to just use treat the Nano as an Arduino Uno with a different programmer speed might be just as fine. E.g. like this:

make BOARD=arduino-uno PROGRAMMER_SPEED=57600 flash
make BOARD=arduino-uno term

@sebastiankliem
Copy link

I did not test the code on original hardware. Unfortunately, I do not have any capacity to work on this further.

@kYc0o
Copy link
Contributor

kYc0o commented Jul 5, 2018

@kYc0o: I'm not sure if I got you. Are you suggesting to wait until #9130 is merged, than rebase this PR against it?

I'd say yes, wait to unify and clean up the code. Then we continue to add more boards.

For the sake of consistency, I think the board folder is needed, along with the required (minimal) files. After #9130 is merged this should be 2 or 3 files max.

@miri64 miri64 removed the Area: arduino API Area: Arduino wrapper API label Sep 1, 2018
@maribu maribu added the State: waiting for other PR State: The PR requires another PR to be merged first label Nov 16, 2018
@maribu maribu removed Community: help wanted The contributors require help from other members of the community State: waiting for other PR State: The PR requires another PR to be merged first labels Mar 3, 2019
@maribu maribu requested review from miri64, kYc0o and ZetaR60 March 3, 2019 18:53
@maribu
Copy link
Member Author

maribu commented Mar 3, 2019

Maybe @miri64 might want to take a look, as I shamelessly stole all code in this PR from her ;-)

In the meantime I verified that /dev/ttyUSB0 is indeed the correct path even for non-clones, as the Nano does not use the ATmega32u2 for USB connectivity but a USB TTL adapter. According to the doc of that adapter dev/ttyUSBx is correct on Linux.

@maribu maribu added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 3, 2019
@miri64 miri64 removed their request for review March 7, 2019 10:17
@miri64
Copy link
Member

miri64 commented Mar 7, 2019

Again: not my domain (I only reviewed #7306 because I happened to have it in my drawer ;-)).

kYc0o
kYc0o previously approved these changes Mar 7, 2019
Copy link
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested ACK.

There are basically no changes to the base code, however I'd like someone to test it. Unfortunately I don't have the hardware.

If it doesn't get tested you might merge it before the soft feature freeze.

@kYc0o
Copy link
Contributor

kYc0o commented Mar 7, 2019

You need to blacklist the board on some tests before Murdock is happy.

@miri64 miri64 dismissed kYc0o’s stale review March 7, 2019 14:16

Removing approval so we don't accidentally merge this PR untested ;-)

@miri64 miri64 added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines labels Mar 7, 2019
@SemjonWilke
Copy link
Member

I believe I have a nano at home. If so I can test this PR by beginning of the next week.

@SemjonWilke
Copy link
Member

SemjonWilke commented Mar 12, 2019

My "nano" is indeed a clone. The PR works out of the box, but sadly I couldn't flash some tests and examples, like examples/default and tests/saul, for a lack of memory. It came back with section '.data' is not within region 'data' and some more overflow messages. EDIT: I expected that, but still hoped, it could fit though.

I did nothing but install the compiler, and make examples/hello-world, tests/shell, and two or three tests/driver_*.
If you want me to test anything specific, pls summon me again.

@maribu
Copy link
Member Author

maribu commented Mar 12, 2019

but sadly I couldn't flash some tests and examples, like examples/default and tests/saul,

Thats expexted, this doesn't work for the Uno either. Thanks for testing!

@kYc0o
Copy link
Contributor

kYc0o commented Mar 14, 2019

Everything seems ok but (again...) the board needs to be marked as insufficient memory...

maribu added 2 commits March 14, 2019 13:54
The Arduino Nano board is the cheapest member of the Arduino family and used the
same MCU as the Arduino Uno. It differs in the form factor (the Nano is much
smaller), it uses an integrated FT232RL TTL adapter instead of an ATmega16u2 to
provide access to the serial console via USB, and it uses a different
bootloader (which occupies 2 KiB of the 32 KiB flash instead of 0.5 KiB occupied
on the Arduino Uno). This commit mostly copy pastes code from the Arduino Uno.
Added arduino-nano to BOARD_INSUFFICIENT_MEMORY/BOARD_BLACKLIST following suit
of how arduino-uno is marked, as arduino-nano is mostly an Uno in a different
form factor.
Added arduino-nano to BOARD_INSUFFICIENT_MEMORY/BOARD_BLACKLIST following suit
of how arduino-uno is marked, as arduino-nano is mostly an Uno in a different
form factor.
@maribu
Copy link
Member Author

maribu commented Mar 14, 2019

So, after updating 141 Makefiles and adding the Nano BOARD_INSUFFICIENT_MEMORY or to BOARDS_BLACKLISTED, everything is green now.

@kYc0o: Mind to merge before anyone touches one of the 141 Makefiles? Otherwise I would need to rebase again and solve the merge conflicts.

Copy link
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

@kYc0o kYc0o merged commit cff2b5e into RIOT-OS:master Mar 14, 2019
@kYc0o
Copy link
Contributor

kYc0o commented Mar 14, 2019

Oops, the latest commit message has "Upadte" twice, but it's rather a detail. Thanks for your contribution @maribu !

@maribu
Copy link
Member Author

maribu commented Mar 14, 2019

Oops, the latest commit message has "Upadte" twice

That kind of error is really typical for me... *faceplam*

@maribu maribu deleted the arduino-nano branch March 14, 2019 15:11
@danpetry danpetry added this to the Release 2019.04 milestone Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: AVR Platform: This PR/issue effects AVR-based platforms Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants