Skip to content

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Aug 24, 2017

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 in boards/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.

@aabadie aabadie added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Aug 24, 2017
@aabadie aabadie added this to the Release 2017.10 milestone Aug 24, 2017
@aabadie aabadie changed the title boards/feather-m0-wifi: initial support (without atwinc1500) boards/feather-m0: initial support Aug 28, 2017
@aabadie
Copy link
Contributor Author

aabadie commented Aug 28, 2017

Updated this PR to work with all Adafruit Feather M0 boards: they are all built on the same base (same pinout) with different modules.

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Aug 28, 2017
@aabadie aabadie force-pushed the adafruit_feather branch 2 times, most recently from ae2ecf5 to 0ec2aec Compare August 28, 2017 15:38
@lebrush
Copy link
Member

lebrush commented Aug 31, 2017

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 boards/feather-m0/include/periph_conf.h :-) .

One question: why can't the STDIO be accessed directly on the USB?

@aabadie
Copy link
Contributor Author

aabadie commented Aug 31, 2017

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.

@lebrush
Copy link
Member

lebrush commented Aug 31, 2017

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 :-)

@aabadie
Copy link
Contributor Author

aabadie commented Aug 31, 2017

Not sure about the uncrustify issue but I pushed an update. Let me know if it's better for you now.

Copy link
Member

@lebrush lebrush left a 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 */
Copy link
Member

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 */
Copy link
Member

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 */
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

space missing before (

@aabadie
Copy link
Contributor Author

aabadie commented Sep 1, 2017

@lebrush, I addressed your comments

Copy link
Member

@lebrush lebrush 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

*
* ### General information
*
* Feather M0 boards are development boards shipped by
Copy link
Member

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.

Copy link
Contributor Author

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.

*/

/**
* @defgroup boards_adafruit-feather-m0 Adafruit Feather M0
Copy link
Member

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

@aabadie aabadie force-pushed the adafruit_feather branch 3 times, most recently from 834307d to a9afb69 Compare September 27, 2017 07:40
@aabadie aabadie added the State: waiting for other PR State: The PR requires another PR to be merged first label Sep 27, 2017
@aabadie
Copy link
Contributor Author

aabadie commented Sep 27, 2017

I rebased this PR on #7646.

export CPU_MODEL = samd21g18a

#export needed for flash rule
export PORT_LINUX ?= /dev/ttyUSB0
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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)

Copy link
Contributor Author

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

@aabadie aabadie removed the State: waiting for other PR State: The PR requires another PR to be merged first label Oct 12, 2017
@aabadie aabadie added the Area: boards Area: Board ports label Oct 13, 2017
@@ -0,0 +1,14 @@
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_cpuid
Copy link
Member

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed !

@basilfx
Copy link
Member

basilfx commented Nov 5, 2017

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.

FEATURES_PROVIDED += periph_uart

# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m0_2
Copy link
Member

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).

Copy link
Contributor Author

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 :)

@basilfx
Copy link
Member

basilfx commented Nov 5, 2017

ACK when Murdock is green.

@aabadie aabadie force-pushed the adafruit_feather branch 2 times, most recently from 4e4d20c to 1fcb5d7 Compare November 5, 2017 20:47
@aabadie
Copy link
Contributor Author

aabadie commented Nov 5, 2017

The CI is broken because of a doxygen warning... I prepended a9f499c in order to fix this (it works locally on my machine)

@basilfx
Copy link
Member

basilfx commented Nov 5, 2017

Wouldn't it be better to have a9f499c in a separate PR?

@aabadie
Copy link
Contributor Author

aabadie commented Nov 5, 2017

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.

@aabadie
Copy link
Contributor Author

aabadie commented Nov 5, 2017

Regarding the doxygen fix, I created #7939. Will remove the commit from this PR (and Murdock should fail)

@basilfx
Copy link
Member

basilfx commented Nov 6, 2017

#7939 is merged, so this can be merged as soon as Murdock is green.

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 6, 2017
@miri64 miri64 merged commit ce0a82f into RIOT-OS:master Nov 6, 2017
@aabadie
Copy link
Contributor Author

aabadie commented Nov 6, 2017

@ynezz, now that this one is merged, you can propose a PR with your changes regarding the bootloader shell command.

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: ARM Platform: This PR/issue effects ARM-based platforms 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