boards: Add I2C and sensor driver support on MIMXRT595-EVK

Enable I2C access to FXOS7000 sensor on the mixrt595_evk board
Tested using samples/sensor/fxos8700 for mimxrt595_evk_cm33.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
This commit is contained in:
Chay Guo 2022-05-16 11:02:25 +08:00 committed by Carles Cufí
commit 0d64506130
9 changed files with 65 additions and 1 deletions

View file

@ -11,4 +11,8 @@ config BOARD
config FLASH_SIZE
default $(dt_node_int_prop_int,/soc/spi@134000/mx25um51345g@2,size,K)
config FXOS8700_DRDY_INT1
default y
depends on FXOS8700_TRIGGER
endif # BOARD_MIMXRT595_EVK

View file

@ -77,6 +77,8 @@ features:
+-----------+------------+-------------------------------------+
| CLOCK | on-chip | clock_control |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file:
@ -107,6 +109,12 @@ functionality of a pin.
+---------+-----------------+----------------------------+
| PIO4_31 | USART12 | USART RX |
+---------+-----------------+----------------------------+
| PIO0_29 | I2C | I2C SCL |
+---------+-----------------+----------------------------+
| PIO0_30 | I2C | I2C SDA |
+---------+-----------------+----------------------------+
| PIO0_22 | GPIO | FXOS8700 TRIGGER |
+---------+-----------------+----------------------------+
System Clock
============

View file

@ -24,6 +24,17 @@
};
};
pinmux_flexcomm4_i2c: pinmux_flexcomm4_i2c {
group0 {
pinmux = <FC4_TXD_SCL_MISO_WS_PIO0_29>,
<FC4_RXD_SDA_MOSI_DATA_PIO0_30>;
input-enable;
slew-rate = "normal";
drive-strength = "high";
drive-open-drain;
};
};
pinmux_flexcomm12_usart: pinmux_flexcomm12_usart {
group0 {
pinmux = <FC12_RXD_SDA_MOSI_PIO4_31>;

View file

@ -104,6 +104,24 @@
pinctrl-names = "default";
};
arduino_i2c: &flexcomm4 {
compatible = "nxp,lpc-i2c";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&pinmux_flexcomm4_i2c>;
pinctrl-names = "default";
fxos8700@1e {
compatible = "nxp,fxos8700";
reg = <0x1e>;
label = "FXOS8700";
int1-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
reset-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
};
};
arduino_serial: &flexcomm12 {
compatible = "nxp,lpc-usart";
status = "okay";

View file

@ -16,5 +16,7 @@ ram: 4608
flash: 65536
supported:
- arduino_gpio
- arduino_i2c
- arduino_serial
- gpio
- i2c

View file

@ -121,6 +121,18 @@ Sample can be built and executed for the MIMXRT685-EVK as follows:
:goals: build flash
:compact:
Building and Running for MIMXRT595-EVK
======================================
MIMXRT595-EVK is optionally equipped with FXOS8700CQ accelerometer and magnetometer.
Please confirm the FXOS8700CQ(U6) is populated on your board.
Sample can be built and executed for the MIMXRT595-EVK as follows:
.. zephyr-app-commands::
:zephyr-app: samples/sensor/fxos8700
:board: mimxrt595_evk_cm33
:goals: build flash
:compact:
Sample Output
=============

View file

@ -9,6 +9,7 @@ tests:
platform_allow: frdm_k64f hexiwear_k64 warp7_m4 frdm_kw41z
rv32m1_vega_ri5cy twr_ke18f lpcxpresso55s16
mimxrt685_evk_cm33 frdm_k22f mimxrt1024_evk
mimxrt595_evk_cm33
integration_platforms:
- frdm_k64f
extra_configs:
@ -19,7 +20,7 @@ tests:
- CONFIG_FXOS8700_MAG_VECM=y
sample.sensor.fxos8700.accel:
platform_allow: frdm_kl25z bbc_microbit lpcxpresso55s69_cpu0 reel_board
mimxrt685_evk_cm33
mimxrt685_evk_cm33 mimxrt595_evk_cm33
integration_platforms:
- bbc_microbit
extra_args: CONF_FILE=prj_accel.conf

View file

@ -20,6 +20,10 @@ config UART_MCUX_FLEXCOMM
default y if HAS_MCUX_FLEXCOMM
depends on SERIAL
config I2C_MCUX_FLEXCOMM
default y if HAS_MCUX_FLEXCOMM
depends on I2C
config CLOCK_CONTROL_MCUX_SYSCON
default y if HAS_MCUX_SYSCON
depends on CLOCK_CONTROL

View file

@ -184,6 +184,10 @@ void clock_init(void)
/* Switch FLEXCOMM0 to FRG */
CLOCK_AttachClk(kFRG_to_FLEXCOMM0);
#endif
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
/* Switch FLEXCOMM4 to FRO_DIV4 */
CLOCK_AttachClk(kFRO_DIV4_to_FLEXCOMM4);
#endif
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm12), nxp_lpc_usart, okay)
/* Switch FLEXCOMM12 to FRG */
CLOCK_AttachClk(kFRG_to_FLEXCOMM12);