Re: Adding new DTS binding for SAM0 I2C


Erwan Gouriou
 

Thanks for the additional info. It would be nice to see what at line 164 in file sodaq_one_v3.dts.pre.tmp.
Anyway, my first guess would be that you miss i2c.h binding file inclusion in your dtsi file.
#include <dt-bindings/i2c/i2c.h>

Erwan


On Mon, 2 Jul 2018 at 10:10, Léonard Bise <leonard.bise@...> wrote:
Hello Erwan,

Thanks for your help.
Well the thing is that is one of my problem, I don't have much to go by.
All I get is a syntax error message from dtc when running cmake:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.5", minimum required is "3.4") 
-- Selected BOARD sodaq_one_v3
Zephyr version: 1.12.99
Parsing Kconfig tree in /home/leonard/gitrepo/zephyr_fork/Kconfig
Using /home/leonard/gitrepo/TravailBachelor/src/Zephyr_sodaq_one_v3/boards/arm/sodaq_one_v3/sodaq_one_v3_defconfig as base
Merging /home/leonard/gitrepo/TravailBachelor/src/Zephyr_sodaq_one_v3/prj.conf
-- Generating zephyr/include/generated/generated_dts_board.h
Error: sodaq_one_v3.dts.pre.tmp:164.21-22 syntax error
FATAL ERROR: Unable to parse input tree
CMake Error at /home/leonard/gitrepo/zephyr_fork/cmake/dts.cmake:83 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /home/leonard/gitrepo/zephyr_fork/cmake/app/boilerplate.cmake:275 (include)
  CMakeLists.txt:9 (include)

As soon as I comment the following block in my dts file it works again. So I assume that it is related to the new atmel,sam0-i2c binding I added.
I added the atmel,sam0-i2c.yaml file in dts/bindings/i2c but I'm not sure if I missed something elsewhere?

&sercom3 {
status = "ok";
compatible = "atmel,sam0-i2c";
clock-frequency = <I2C_BITRATE_FAST>;
#address-cells = <1>;
#size-cells = <0>;
};

Thank you,
Léonard.

On 2 July 2018 at 09:13, Erwan Gouriou <erwan.gouriou@...> wrote:
Hi Léonard,

Some additional information on build error would help to provide you support.

Cheers
Erwan

On Sun, 1 Jul 2018 at 13:37, Léonard Bise <leonard.bise@...> wrote:
I'm trying to add support for SAM0 I2C. Currently my code is compiling as I see warnings in my i2c_sam0.c file. 
However I'm trying to add a new binding for that in zephyr/dts/bindings/i2c/atmel,sam0-i2c.yaml and hitting a wall.

---
title: Atmel SAM0 SERCOM I2C driver
id: atmel,sam0-i2c
version: 0.1
 
description: >
    This binding gives a base representation of the Atmel SAM0 SERCOM I2C driver
 
inherits:
    !include i2c.yaml
 
properties:
    compatible:
      type: string
      category: required
      description: compatible strings
      constraint: "atmel,sam0-i2c"
 
    reg:
      type: array
      description: mmio register space
      generation: define
      category: required
 
...

Then in my board dts I added the following:

&sercom3 {
status = "ok";
compatible = "atmel,sam0-i2c";
clock-frequency = <I2C_BITRATE_FAST>;
#address-cells = <1>;
#size-cells = <0>;
};

But something is missing because I keep getting an error when building that it cannot parse the device tree.
I looked around how the other SAM0 device are setup but I didn't find what I'm missing.

Any pointer on how I should go about setting up this binding ?

Best regards,
Léonard.



Join devel@lists.zephyrproject.org to automatically receive all group messages.