Skip to content
Permalink
Browse files

boards: arm: twr_ke18f: add I2C support

Add I2C support to the NXP TWR-KE18F development board.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
  • Loading branch information...
henrikbrixandersen authored and MaureenHelm committed May 14, 2019
1 parent efa2b23 commit 4770b1ebec6efcc80534241506c4ee6200bec725
@@ -17,6 +17,16 @@ config UART_MCUX_LPUART_0

endif # UART_MCUX_LPUART

if I2C

config I2C_0
default y

config I2C_1
default y

endif # I2C

if PINMUX_MCUX

config PINMUX_MCUX_PORTA
@@ -68,6 +68,13 @@ features:
+-----------+------------+-------------------------------------+
| RTC | on-chip | rtc |
+-----------+------------+-------------------------------------+
| I2C(M) | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SENSOR | off-chip | fxos8700 polling; |
| | | trigger supported with H/W mods |
| | | explained below; |
+-----------+------------+-------------------------------------+


The default configuration can be found in the defconfig file:
``boards/arm/twr_ke18f/twr_ke18f_defconfig``.
@@ -86,6 +93,31 @@ Serial Port
The KE18 SoC has three UARTs. UART0 is configured for the console. The
remaining UARTs are not used.

Accelerometer and magnetometer
==============================

The TWR-KE18F board by default only supports polling the FXOS8700
accelerometer and magnetometer for sensor values
(``CONFIG_FXOS8700_TRIGGER_NONE=y``).

In order to support FXOS8700 triggers (interrupts) the 0 ohm resistors
``R47`` and and ``R57`` must be mounted on the TWR-KE18F board. The
device tree must also be modified to describe the FXOS8700 interrupt
GPIOs:

.. code-block:: none

/dts-v1/;

&fxos8700 {
int1-gpios = <&gpioa 14 0>;
int2-gpios = <&gpioc 17 0>;
};

Finally, a trigger option must be enabled in Kconfig (either
``FXOS8700_TRIGGER_GLOBAL_THREAD=y`` or
``FXOS8700_TRIGGER_OWN_THREAD=y``).

Programming and Debugging
*************************

@@ -58,6 +58,27 @@ static int twr_ke18f_pinmux_init(struct device *dev)
pinmux_pin_set(porte, 10, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif

#if CONFIG_I2C_0
/* LPI2C0 SCL, SDA - FXOS8700 */
pinmux_pin_set(porta, 3, PORT_PCR_MUX(kPORT_MuxAlt3));
pinmux_pin_set(porta, 2, PORT_PCR_MUX(kPORT_MuxAlt3));
#endif

#if CONFIG_I2C_1
/* LPI2C1 SCL, SDA - Elevator connector */
pinmux_pin_set(portd, 9, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portd, 8, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif

/* FXOS8700 INT1, INT2, RST */
#ifdef DT_NXP_FXOS8700_0_INT1_GPIOS_PIN
pinmux_pin_set(porta, 14, PORT_PCR_MUX(kPORT_MuxAsGpio));
#endif
#ifdef DT_NXP_FXOS8700_0_INT2_GPIOS_PIN
pinmux_pin_set(portc, 17, PORT_PCR_MUX(kPORT_MuxAsGpio));
#endif
pinmux_pin_set(portc, 15, PORT_PCR_MUX(kPORT_MuxAsGpio));

return 0;
}

@@ -118,6 +118,21 @@
current-speed = <115200>;
};

&i2c0 {
status = "ok";

fxos8700: fxos8700@1d {
compatible = "nxp,fxos8700";
reg = <0x1d>;
label = "FXOS8700";
reset-gpios = <&gpioc 15 0>;
};
};

&i2c1 {
status = "ok";
};

&flash0 {
/*
* For more information, see:
@@ -11,3 +11,4 @@ flash: 512
supported:
- rtc
- counter
- i2c

0 comments on commit 4770b1e

Please sign in to comment.
You can’t perform that action at this time.