Skip to content

Commit c5c61db

Browse files
yandldnxpyandld
andauthored
[nxp][mcx] add frdm-mcxa366 support (#11243)
* add frdm-mcxa366 support * add frdm-mcxa366 bsp driver support * add ALL_BSP_COMPILE.json * fix co-pliot issue --------- Co-authored-by: nxp-alexyang <alex.yang@nxp.com>
1 parent fe548e1 commit c5c61db

35 files changed

+9652
-10
lines changed

.github/ALL_BSP_COMPILE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
"nxp/mcx/mcxa/frdm-mcxa153",
251251
"nxp/mcx/mcxa/frdm-mcxa156",
252252
"nxp/mcx/mcxa/frdm-mcxa346",
253+
"nxp/mcx/mcxa/frdm-mcxa366",
253254
"nxp/mcx/mcxe/frdm-mcxe247",
254255
"renesas/ebf_qi_min_6m5",
255256
"renesas/ra6m4-cpk",

bsp/nxp/mcx/mcxa/Libraries/drivers/drv_i2c.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#define DBG_LVL DBG_INFO
2121
#include <rtdbg.h>
2222

23+
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN) || \
24+
defined(CPU_MCXA366VLH) || defined(CPU_MCXA366VLL) || defined(CPU_MCXA366VLQ) || defined(CPU_MCXA366VPN))
25+
#define MCXA_I2C_USE_FRO_LF_DIV
26+
#endif
27+
2328
enum
2429
{
2530
#ifdef BSP_USING_I2C0
@@ -55,7 +60,7 @@ struct lpc_i2c_bus lpc_obj[] =
5560
{
5661
.I2C = LPI2C0,
5762
.baud = 100000U,
58-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
63+
#if defined(MCXA_I2C_USE_FRO_LF_DIV)
5964
.clock_attach_id = kFRO_LF_DIV_to_LPI2C0,
6065
#else
6166
.clock_attach_id = kFRO12M_to_LPI2C0,
@@ -69,7 +74,7 @@ struct lpc_i2c_bus lpc_obj[] =
6974
{
7075
.I2C = LPI2C1,
7176
.baud = 100000U,
72-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
77+
#if defined(MCXA_I2C_USE_FRO_LF_DIV)
7378
.clock_attach_id = kFRO_LF_DIV_to_LPI2C1,
7479
#else
7580
.clock_attach_id = kFRO12M_to_LPI2C1,
@@ -83,7 +88,7 @@ struct lpc_i2c_bus lpc_obj[] =
8388
{
8489
.I2C = LPI2C2,
8590
.baud = 100000U,
86-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
91+
#if defined(MCXA_I2C_USE_FRO_LF_DIV)
8792
.clock_attach_id = kFRO_LF_DIV_to_LPI2C2,
8893
#else
8994
.clock_attach_id = kFRO12M_to_LPI2C2,
@@ -97,7 +102,7 @@ struct lpc_i2c_bus lpc_obj[] =
97102
{
98103
.I2C = LPI2C3,
99104
.baud = 100000U,
100-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
105+
#if defined(MCXA_I2C_USE_FRO_LF_DIV)
101106
.clock_attach_id = kFRO_LF_DIV_to_LPI2C3,
102107
#else
103108
.clock_attach_id = kFRO12M_to_LPI2C3,

bsp/nxp/mcx/mcxa/Libraries/drivers/drv_spi.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#define DBG_LVL DBG_INFO
1919
#include <rtdbg.h>
2020

21+
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN) || \
22+
defined(CPU_MCXA366VLH) || defined(CPU_MCXA366VLL) || defined(CPU_MCXA366VLQ) || defined(CPU_MCXA366VPN))
23+
#define MCXA_SPI_USE_FRO_LF_DIV
24+
#endif
25+
2126
enum
2227
{
2328
#ifdef BSP_USING_SPI0
@@ -46,7 +51,7 @@ static struct lpc_spi lpc_obj[] =
4651
#ifdef BSP_USING_SPI0
4752
{
4853
.LPSPIx = LPSPI0,
49-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
54+
#if defined(MCXA_SPI_USE_FRO_LF_DIV)
5055
kFRO_LF_DIV_to_LPSPI0,
5156
#else
5257
.clock_attach_id = kFRO12M_to_LPSPI0,
@@ -59,7 +64,7 @@ static struct lpc_spi lpc_obj[] =
5964
#ifdef BSP_USING_SPI1
6065
{
6166
.LPSPIx = LPSPI1,
62-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
67+
#if defined(MCXA_SPI_USE_FRO_LF_DIV)
6368
kFRO_LF_DIV_to_LPSPI1,
6469
#else
6570
.clock_attach_id = kFRO12M_to_LPSPI1,
@@ -74,12 +79,20 @@ static struct lpc_spi lpc_obj[] =
7479
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t pin)
7580
{
7681
struct rt_spi_device *spi_device = rt_malloc(sizeof(struct rt_spi_device));
82+
rt_err_t ret;
83+
7784
if (!spi_device)
7885
{
7986
return -RT_ENOMEM;
8087
}
8188

82-
return rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, pin, NULL);
89+
ret = rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, pin, NULL);
90+
if (ret != RT_EOK)
91+
{
92+
rt_free(spi_device);
93+
}
94+
95+
return ret;
8396
}
8497

8598
static rt_err_t spi_configure(struct rt_spi_device *device, struct rt_spi_configuration *cfg)

bsp/nxp/mcx/mcxa/Libraries/drivers/drv_uart.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#define DBG_LVL DBG_INFO
1919
#include <rtdbg.h>
2020

21+
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN) || \
22+
defined(CPU_MCXA366VLH) || defined(CPU_MCXA366VLL) || defined(CPU_MCXA366VLQ) || defined(CPU_MCXA366VPN))
23+
#define MCXA_UART_USE_FRO_LF_DIV
24+
#endif
25+
2126
struct mcx_uart
2227
{
2328
struct rt_serial_device *serial;
@@ -65,7 +70,7 @@ static const struct mcx_uart uarts[] =
6570
LPUART0,
6671
LPUART0_IRQn,
6772
kCLOCK_Fro12M,
68-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
73+
#if defined(MCXA_UART_USE_FRO_LF_DIV)
6974
kFRO_LF_DIV_to_LPUART0,
7075
#else
7176
kFRO12M_to_LPUART0,
@@ -81,7 +86,7 @@ static const struct mcx_uart uarts[] =
8186
LPUART1,
8287
LPUART1_IRQn,
8388
kCLOCK_Fro12M,
84-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
89+
#if defined(MCXA_UART_USE_FRO_LF_DIV)
8590
kFRO_LF_DIV_to_LPUART1,
8691
#else
8792
kFRO12M_to_LPUART1,
@@ -97,7 +102,7 @@ static const struct mcx_uart uarts[] =
97102
LPUART2,
98103
LPUART2_IRQn,
99104
kCLOCK_Fro12M,
100-
#if (defined(CPU_MCXA346VLH) || defined(CPU_MCXA346VLL) || defined(CPU_MCXA346VLQ) || defined(CPU_MCXA346VPN))
105+
#if defined(MCXA_UART_USE_FRO_LF_DIV)
101106
kFRO_LF_DIV_to_LPUART2,
102107
#else
103108
kFRO12M_to_LPUART2,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
scons.args: &scons
2+
scons_arg:
3+
- '--strict'
4+
5+
# ------ component CI ------
6+
component.can:
7+
kconfig:
8+
- CONFIG_BSP_USING_CAN=y
9+
- CONFIG_BSP_USING_CAN0=y
10+
11+
# ------ Peripheral CI ------
12+
Peripheral.arduino:
13+
kconfig:
14+
- CONFIG_BSP_USING_ARDUINO=y
15+

0 commit comments

Comments
 (0)