Skip to content

Conversation

@madlain
Copy link

@madlain madlain commented Aug 8, 2018

Hi,

I've implemented a basic I2C driver and an external interrupt controller driver for Atmel's SAMD21 MCU. I've performed functional testing for both by exercising the sample application for the FXAS21002 gyroscope running on an Arduino MKRZero board connecting to Adafruits NXP Precision 9DoF breakout board.

Madani.

@codecov-io
Copy link

codecov-io commented Aug 8, 2018

Codecov Report

Merging #9347 into master will decrease coverage by 3.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9347      +/-   ##
==========================================
- Coverage   52.83%   49.72%   -3.12%     
==========================================
  Files         310      292      -18     
  Lines       45311    42425    -2886     
  Branches    10468     9968     -500     
==========================================
- Hits        23942    21096    -2846     
- Misses      16584    17178     +594     
+ Partials     4785     4151     -634
Impacted Files Coverage Δ
lib/libc/minimal/include/stdlib.h 0% <0%> (-100%) ⬇️
subsys/bluetooth/host/keys.h 0% <0%> (-100%) ⬇️
subsys/net/lib/sockets/sockets_internal.h 28.57% <0%> (-71.43%) ⬇️
drivers/console/native_posix_console.c 10.52% <0%> (-62.21%) ⬇️
subsys/usb/usb_descriptor.c 0% <0%> (-44.59%) ⬇️
subsys/net/ip/dhcpv4.c 6.08% <0%> (-35.68%) ⬇️
ext/hal/nordic/nrfx/hal/nrf_rtc.h 75% <0%> (-25%) ⬇️
subsys/bluetooth/host/keys.c 10.22% <0%> (-20.46%) ⬇️
...oth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c 68.18% <0%> (-13.36%) ⬇️
subsys/net/lib/sockets/sockets.c 36.36% <0%> (-12.08%) ⬇️
... and 269 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f90acbf...608287a. Read the comment docs.

Copy link
Contributor

@dbkinder dbkinder left a comment

Choose a reason for hiding this comment

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

+1 for doc, thanks!

@dbkinder
Copy link
Contributor

dbkinder commented Aug 9, 2018

... but you do have lots of issues with coding style noted in the shippable details above :(

@madlain madlain force-pushed the master branch 5 times, most recently from 806602b to 665a752 Compare August 10, 2018 14:30
@madlain
Copy link
Author

madlain commented Aug 14, 2018

I'm not sure why the shippable run successive to the merge conflict resolution is failing. Can you please help me out?

@madlain
Copy link
Author

madlain commented Sep 3, 2018

Is there anything needed from my side to move forward with the merge?

@galak galak added area: I2C platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) labels Sep 12, 2018
@galak
Copy link
Contributor

galak commented Sep 12, 2018

@anangl can you review the i2c driver.

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

Will you please add the new board to samples/sensor/fxas21002/sample.yaml? This will ensure that the i2c driver gets built in CI.

Copy link
Member

Choose a reason for hiding this comment

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

Move the sercom compatibles to samd21.dtsi

Copy link
Author

Choose a reason for hiding this comment

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

I've adhered to the exact same approach taken for the arduino_zero also based on Atmel SAMD21: the SoC device tree file only declares SERCOM devices while the board device tree file specifies how a given SERCOM is configured (USART, SPI or I2C) for that board. Is there anything wrong with this approach?

Copy link
Member

Choose a reason for hiding this comment

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

These should be part of the const config struct

Copy link
Author

Choose a reason for hiding this comment

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

The porta_extints array allows using designated initializers for both the
mapping table and its length in the const config struct. Moving the definition
of the table to the const config struct prevents using a designated initializer
for the length and defers its computation to run time, using pointer arithmetic
in the device init function.

Copy link
Member

Choose a reason for hiding this comment

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

Instead of doing this, you can get the device struct using the CONTAINER_OF macro.

Copy link
Author

Choose a reason for hiding this comment

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

Not sure how this macro could help here. This code is in the Interrupt Service
Routine for the External Interrupt Controller where the only way to get a
reference to the structure for the GPIO ports is to use their respective device
names with DEVICE_GET.

@zephyrbot
Copy link

zephyrbot commented Nov 26, 2018

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

@madlain madlain force-pushed the master branch 2 times, most recently from dd86549 to d3274b0 Compare November 30, 2018 15:21
@madlain
Copy link
Author

madlain commented Nov 30, 2018

Hi,

Thanks for the review and the valuable comments. I’ve addressed and resolved all but three of them for which I’m expecting your feedback. Also as clarification, and to answer your top-level comment, the board doesn't carry the FXAS21002 gyro. At the time I implemented the I2C and EIC drivers, it was possible to build the sample app for the sensor with an external gyro board hooked up to the MKRZero. This set-up provided a convenient way to exercise the newly developed I2C and EIC drivers all together with the already existing drivers for the SoC (UART, GPIO, PINMUX).

Only the most basic operation has been tested. Current limitations
include:

- the use of polling
- the rudimentary handling of concurrency
- support for standard mode only

Signed-off-by: Madani Lainani <[email protected]>
This extends the existing SAMD21 GPIO driver functionnality with the
possibility to configure I/O pins as interrupt lines.

Signed-off-by: Madani Lainani <[email protected]>
Built upon the existing SoC for Atmel's SAMD21 MCU but with support
enabled for two newly added peripherals:

- I2C port (SERCOM)
- External Interrupt Controller

Signed-off-by: Madani Lainani <[email protected]>
@jfischer-no
Copy link
Contributor

SAM0 I2C driver was introduced by #14128, @madlain please rebase or close

@galak
Copy link
Contributor

galak commented Jan 30, 2020

Closing PR as its been marked stale for several months. Feel free to re-open and update if desired.

@galak galak closed this Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: I2C platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants