-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards/feather-m0: initial support #7510
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
Conversation
b91dcc1
to
8fa7f78
Compare
Updated this PR to work with all Adafruit Feather M0 boards: they are all built on the same base (same pinout) with different modules. |
ae2ecf5
to
0ec2aec
Compare
I've too few experience with SAM processors to see if there's something weird... The only thing I could notice is that you'll have to run uncrustify on One question: why can't the STDIO be accessed directly on the USB? |
Because there's no FDTI. The USB port is connected directly to the MCU, and that would required a software UART built on top of the USB. AFAIK, RIOT doesn't provide a USB stack (yet). Correct me if I'm wrong. |
The official page in the Adafruit website and states "This chip comes with built in USB so it has USB-to-Serial program & debug capability built in with no need for an FTDI-like chip" but I just checked how is this handled by the Arduino library and they implemented this part of the USB stack. So I guess that it's Ok like this :-) |
Not sure about the uncrustify issue but I pushed an update. Let me know if it's better for you now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are just cosmetic thingys, sorry
{ | ||
.dev = &SERCOM0->USART, | ||
.rx_pin = GPIO_PIN(PA,11), /* RX pin */ | ||
.tx_pin = GPIO_PIN(PA,10), /* TX pin */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it' seems that uncrustify didn't get what I meant... sorry I thought it would: missing space between PA and number.
{TCC0, { | ||
/* GPIO pin, MUX value, TCC channel */ | ||
{ GPIO_UNDEF, (gpio_mux_t)0, 0 }, | ||
{ GPIO_PIN(PA, 7), GPIO_MUX_E, 1 }, /* ~9 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many spaces before last parameter (also in pwm1)
|
||
static const adc_conf_chan_t adc_channels[] = { | ||
/* port, pin, muxpos */ | ||
{GPIO_PIN(PA, 2), ADC_INPUTCTRL_MUXPOS_PIN0}, /* A0 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no spaces after and before curly braces
* @name I2C configuration | ||
* @{ | ||
*/ | ||
#define I2C_NUMOF (1U) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space missing before (
3e5d57d
to
028a689
Compare
@lebrush, I addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested ACK
028a689
to
41cd0f8
Compare
boards/feather-m0/include/board.h
Outdated
* | ||
* ### General information | ||
* | ||
* Feather M0 boards are development boards shipped by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice detailed infos on that board, I'd rather put that into a separate doc.txt
in the root directory of the board.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea.
Maybe one day, it could be used to auto-generate (by replacing some keyword) the list for provided features (i2c, gpio, etc) for this board, when generating the doxygen documentation.
boards/feather-m0/include/board.h
Outdated
*/ | ||
|
||
/** | ||
* @defgroup boards_adafruit-feather-m0 Adafruit Feather M0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be boards_feather-m0
matching the path or rename the board directory
834307d
to
a9afb69
Compare
I rebased this PR on #7646. |
boards/feather-m0/Makefile.include
Outdated
export CPU_MODEL = samd21g18a | ||
|
||
#export needed for flash rule | ||
export PORT_LINUX ?= /dev/ttyUSB0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aabadie Mine is /dev/ttyACM0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aabadie Maybe this two patches would fix this?
makefiles/tools/bossa: Introduce PORT_BOSSA variable
boards/feather-m0: Use PORT_BOSSA variable for flashing using Bossa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make -j10 BOARD=feather-m0 -C examples/hello-world flash term
...
/opt/devel/mcu/RIOT/dist/tools/bossa/bossac -p /dev/ttyACM0 -e -i -w -v -b -R /opt/devel/mcu/RIOT/examples/hello-world/bin/feather-m0/hello-world.bin
...
Done in 0.059 seconds
CPU reset.
...
/opt/devel/mcu/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyUSB0" -b "115200"
2017-09-28 15:21:58,683 - INFO # Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.
2017-09-28 15:21:59,688 - INFO # main(): This is RIOT! (Version: 2017.10-devel-509-g52f9b-ntbk-feather-m0-testing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking of something similar. Thanks, I'll update the PR asap
a9afb69
to
d7e50f7
Compare
2a8e7da
to
b81ec7c
Compare
b81ec7c
to
6fc84ad
Compare
boards/feather-m0/Makefile.features
Outdated
@@ -0,0 +1,14 @@ | |||
# Put defined MCU peripherals here (in alphabetical order) | |||
FEATURES_PROVIDED += periph_adc | |||
FEATURES_PROVIDED += periph_cpuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is now already in sam0_common/Makefile.features (see #7880)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed !
I have the Feather M0, and tested it. Works like a charm after I figured how to flash it. Also tested the rebased version, and it works. #7880 should be applied though. |
6fc84ad
to
cb110c4
Compare
FEATURES_PROVIDED += periph_uart | ||
|
||
# The board MPU family (used for grouping by the CI system) | ||
FEATURES_MCU_GROUP = cortex_m0_2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost:
Last line should be: -include $(RIOTCPU)/samd21/Makefile.features
(see other boards, e.g. arduino-zero).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks for spotting this :)
cb110c4
to
25aa6be
Compare
ACK when Murdock is green. |
4e4d20c
to
1fcb5d7
Compare
The CI is broken because of a doxygen warning... I prepended a9f499c in order to fix this (it works locally on my machine) |
Wouldn't it be better to have a9f499c in a separate PR? |
Yes, that's also what I think. We'll have to wait a bit more before we can merge this one. |
Regarding the doxygen fix, I created #7939. Will remove the commit from this PR (and Murdock should fail) |
8838575
to
d011fd1
Compare
#7939 is merged, so this can be merged as soon as Murdock is green. |
@ynezz, now that this one is merged, you can propose a PR with your changes regarding the bootloader shell command. |
Add support for Adafruit Feather M0 board. This board is the base boards used for:
Those boards are all the same, except that they have a different module soldered on them. All extra modules are connected to the same SPI (SPIDEV(0)). So the idea will be to add a
<driver>_params.h
inboards/feather-m0
when one is available (for example, RIOT doesn't support ATWINC1500 for the moment).They are very similar to the Arduino MKR boards: same MCU (samd21g18a), can be flashed using bossa (since it uses the same bootloader preinstalled), same ldscript.
Only on-board LED, UART, 2 PWM, 6 ADC, 1 SPI, 1 I2C, RTC are configured.