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

Arduino drivers #10

Closed
5 of 6 tasks
jdavid opened this issue Oct 15, 2020 · 8 comments
Closed
5 of 6 tasks

Arduino drivers #10

jdavid opened this issue Oct 15, 2020 · 8 comments

Comments

@jdavid
Copy link
Member

jdavid commented Oct 15, 2020

Many drivers we need are not natively supported by RIOT. One option is to use an Arduino driver. Apparently this is possible, see RIOT-OS/RIOT#12518

But first we need our boards to provide the arduino feature, and this is not supported by any of our boards, for example:

$ CONTINUE_ON_EXPECTED_ERRORS=1 BOARD=waspmote-pro make -C tests/sys_arduino
make: Entering directory '/home/jdavid/sandboxes/UiO/wsn_riot/RIOT/tests/sys_arduino'
There are unsatisfied feature requirements: arduino
[...]
In file included from /home/jdavid/sandboxes/UiO/wsn_riot/RIOT/sys/arduino/base.cpp:28:
/home/jdavid/sandboxes/UiO/wsn_riot/RIOT/sys/arduino/include/arduino.hpp:27:10: fatal error: arduino_board.h: No such file or directory
   27 | #include "arduino_board.h"
[...]

Looking for arduino_board.h we see there are already a number of boards that support the arduino feature, including some with a non-AVR MCU. But none of our boards does: waspmote-pro, remote-revb and feather-m0.

Also, from what I've read the arduino module allows to run unmodified Arduino sketches. While the arduino_lib pseudomodule allows to use Arduino libraries from RIOT applications, and that's exactly what we want. See RIOT-OS/RIOT#12180

In order to validate this approach we need to:

  1. Package an Arduino library
  2. Test the library with Arduino Uno
  3. Add support for packages out of RIOT tree, see Packages outside RIOT tree RIOT-OS/RIOT#15309
  4. Add arduino support to the waspmote-pro, see arduino feature for the waspmote-pro board RIOT-OS/RIOT#15232
  5. Add arduino support to the remote-revb board, see boards/remote-revb: add arduino feature RIOT-OS/RIOT#15678
  6. Fix print float in arduno, see sys/arduino: fix print float RIOT-OS/RIOT#15314

On hold:

@jdavid
Copy link
Member Author

jdavid commented Oct 15, 2020

See boards/common/arduino-atmega/include/arduino_board.h for an example.

@jdavid
Copy link
Member Author

jdavid commented Oct 15, 2020

Follow RIOT-OS/RIOT#15232

@jdavid
Copy link
Member Author

jdavid commented Oct 21, 2020

Add Arduino support to a board
https://doc.riot-os.org/group__sys__arduino.html#sec_boardsupport

@ArcticSnow
Copy link
Member

ArcticSnow commented Oct 27, 2020

Arduino drivers for the Feather boards in ArduinoIDE can be found here:
https://github.com/adafruit/ArduinoCore-samd

pin map is defined in this file:
https://github.com/adafruit/ArduinoCore-samd/blob/master/cores/arduino/WVariant.h

@jdavid
Copy link
Member Author

jdavid commented Oct 27, 2020

I've packaged Sparkfun's BME280 Arduino library and added a test app, see apps/test-arduino. And tested it with Arduino Uno.
The main purpose of this issue was to evaluate whether we could use or not Arduino libraries, and that's done.

There's one caveat though, RIOT doesn't support packages out of their tree. So to test it I did a symbolic link from their tree to ours, such as:

$ cd RIOT/pkg
$ ln -s ../../pkg/arduino_sparkfun_bme280
$ cd ../..
$ BOARD=arduino-uno make -C apps/test-arduino/ flash term

I've opened an issue to fix this, see RIOT-OS/RIOT#15309

I'm going to update the check list in the description of this issue.

@jdavid
Copy link
Member Author

jdavid commented Nov 4, 2020

I've added the arduino feature to the feather-m0 board in our RIOT fork, in the feather-m0-arduino branch, see https://github.com/spectraphilic/RIOT/tree/feather-m0-arduino

But I cannot submit a PR to RIOT upstream because Serial.print doesn't work. From what I've read we need first the following PR to be merged (pending confirmation):

@jdavid
Copy link
Member Author

jdavid commented Dec 18, 2020

I've made a PR for the arduino feature in the remote-revb, RIOT-OS/RIOT#15678

By the way there's already an I2C device in the remote-revb, the RTC at address 0x69, see #8

@jdavid
Copy link
Member Author

jdavid commented Oct 31, 2022

This can be closed. Latest board with Arduino support is lora-e5-dev
We also have support for SDI-12 through an Arduino library.

@jdavid jdavid closed this as completed Oct 31, 2022
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

2 participants