diff options
Diffstat (limited to 'bsp/lpc55sxx/lpc55s69_nxp_evk')
10 files changed, 267 insertions, 10 deletions
diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/SConscript b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/SConscript index 0d32358417..e1c7fa5996 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/SConscript +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/SConscript @@ -1,17 +1,18 @@ -import rtconfig from building import * +import os -cwd = GetCurrentDir() -src = Glob('main.c') +cwd = GetCurrentDir() CPPPATH = [cwd] +src = Glob('*.c') -# add for startup script -if rtconfig.PLATFORM in ['gcc']: - CPPDEFINES = ['__START=entry'] -else: - CPPDEFINES = [] +if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']): + src += ['arduino_main.cpp'] +group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) -group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES) +list = os.listdir(cwd) +for item in list: + if os.path.isfile(os.path.join(cwd, item, 'SConscript')): + group = group + SConscript(os.path.join(item, 'SConscript')) Return('group') diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_main.cpp b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_main.cpp new file mode 100644 index 0000000000..1323d585ab --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_main.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-02-22 ChuShicheng first version + * 2023-02-23 Wangyuqiang second version + */ + +#include <Arduino.h> + +void setup(void) +{ + /* put your setup code here, to run once: */ + Serial.begin(); +} + +void loop(void) +{ + /* put your main code here, to run repeatedly: */ + Serial.println("Hello Arduino!"); + delay(800); +} diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/LPC55s69-nxp-evk-pinout1.png b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/LPC55s69-nxp-evk-pinout1.png Binary files differnew file mode 100644 index 0000000000..1fb2f2b3b4 --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/LPC55s69-nxp-evk-pinout1.png diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/LPC55s69-nxp-evk-pinout2.png b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/LPC55s69-nxp-evk-pinout2.png Binary files differnew file mode 100644 index 0000000000..74c0117099 --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/LPC55s69-nxp-evk-pinout2.png diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/README.md b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/README.md new file mode 100644 index 0000000000..4f1a4bc2e2 --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/README.md @@ -0,0 +1,55 @@ +# LPC55s69-nxp-evk开发板的Arduino生态兼容说明 + +## 1 RTduino - RT-Thread的Arduino生态兼容层 + +LPC55s69-nxp-evk开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)。 + +### 1.1 如何开启针对本BSP的Arduino生态兼容层 + +Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings: + +```Kconfig +Hardware Drivers Config ---> + Onboard Peripheral Drivers ---> + [*] Compatible with Arduino Ecosystem (RTduino) +``` + +## 2 Arduino引脚排布 + +更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。 + + + + + +| Arduino引脚编号 | LPC55引脚编号 | 5V容忍 | 备注 | +| ------------------- | --------- | ---- | ------------------------------------------------------------------------- | +| 0 (D0) | P(1,24) | 是/否 | Serial2-RX,默认被RT-Thread的UART设备框架uart2接管 | +| 1 (D1) | P(0,27) | 是/否 | Serial2-TX,默认被RT-Thread的UART设备框架uart2接管 | +| 2 (D2) | P(0,15) | 是/否 | | +| 3 (D3) | P(1,6) | 是/否 | | +| 4 (D4) | P(1,7) | 是/否 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 | +| 5 (D5) | P(1,4) | 是/否 | PWM2-CH1,默认被RT-Thread的PWM设备框架pwm2接管 | +| 6 (D6) | P(1,10) | 是/否 | | +| 7 (D7) | P(1,9) | 是/否 | PWM1-CH0,默认被RT-Thread的PWM设备框架pwm1接管 | +| 8 (D8) | P(1,8) | 是/否 | | +| 9 (D9) | P(1,5) | 是/否 | | +| 10 (D10) | P(1,1) | 是/否 | | +| 11 (D11) | P(0,26) | 是/否 | | +| 12 (D12) | P(1,3) | 是/否 | PWM0-CH3,默认被RT-Thread的PWM设备框架pwm0接管 | +| 13 (D13) | P(1,2) | 是/否 | | +| 14 (D14) | P(1,21) | 是/否 | I2C4-SDA,默认被RT-Thread的I2C设备框架i2c4接管 | +| 15 (D15) | P(1,20) | 是/否 | I2C4-SCL,默认被RT-Thread的I2C设备框架i2c4接管 | +| 16 (A0) | P(0,16) | 是/否 | ADC0-CH8,默认被RT-Thread的ADC设备框架adc0接管 | +| 17 (A1) | P(0,23) | 是/否 | ADC0-CH0,默认被RT-Thread的ADC设备框架adc0接管 | +| 18 (A2) | -- | 是/否 | | +| 19 (A3) | P(1,31) | 是/否 | | +| 20 (A4) | P(0,13) | 是/否 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 | +| 21 (A5) | P(1,14) | 是/否 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 | +| 22 (A6) | -- | | 芯片内部参考电压 ADC,默认被RT-Thread的ADC设备框架adc1接管 | +| 23 (A7) | -- | | 芯片内部温度 ADC,默认被RT-Thread的ADC设备框架adc1接管 | + +> 注意: +> +> 1. xxxxxxxxx +> 2. xxxxxxxxx diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/SConscript b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/SConscript new file mode 100644 index 0000000000..2539929027 --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/SConscript @@ -0,0 +1,9 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') + Glob('*.cpp') +inc = [cwd] + +group = DefineGroup('RTduino', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc) + +Return('group') diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c new file mode 100644 index 0000000000..0c02e3ac29 --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-02-22 ChuShicheng first version + * 2023-02-23 Wangyuqiang second version + */ + +#include <Arduino.h> +#include <board.h> +#include <drv_pin.h> +#include "pins_arduino.h" + +/* + * {Arduino Pin, RT-Thread Pin [, Device Name, Channel]} + * [] means optional + * Digital pins must NOT give the device name and channel. + * Analog pins MUST give the device name and channel(ADC, PWM or DAC). + * Arduino Pin must keep in sequence. + */ +const pin_map_t pin_map_table[]= +{ + {D0, GET_PINS(1,24), "uart2"}, /* Serial2-RX */ + {D1, GET_PINS(0,27), "uart2"}, /* Serial2-TX */ + {D2, GET_PINS(0,15)}, + {D3, GET_PINS(1,6)}, + {D4, GET_PINS(1,7), "pwm2", 2}, /* PWM */ + {D5, GET_PINS(1,4), "pwm2", 1}, /* PWM */ + {D6, GET_PINS(1,10)}, + {D7, GET_PINS(1,9), "pwm1", 0}, /* PWM */ + {D8, GET_PINS(1,8)}, + {D9, GET_PINS(1,5)}, + {D10, GET_PINS(1,1)}, + {D11, GET_PINS(0,26)}, + {D12, GET_PINS(1,3), "pwm0", 3}, /* PWM */ + {D13, GET_PINS(1,2)}, + {D14, GET_PINS(1,21), "i2c4"}, /* I2C-SDA (Wire) */ + {D15, GET_PINS(1,20), "i2c4"}, /* I2C-SCL (Wire) */ + {A0, GET_PINS(0,16), "adc0", 8}, /* ADC */ + {A1, GET_PINS(0,23), "adc0", 0}, /* ADC */ + {A2, RT_NULL}, + {A3, GET_PINS(1,31)}, + {A4, GET_PINS(0,13), "i2c1"}, /* I2C-SDA (Wire) */ + {A5, GET_PINS(1,14), "i2c1"}, /* I2C-SCL (Wire) */ + {A6, RT_NULL, "adc0", 13}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */ + {A7, RT_NULL, "adc0", 26}, /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */ +}; diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.h b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.h new file mode 100644 index 0000000000..22dbc3b4e3 --- /dev/null +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-02-22 ChuShicheng first version + * 2023-02-23 Wangyuqiang second version + */ + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +/* pins alias. Must keep in sequence */ +#define D0 (0) +#define D1 (1) +#define D2 (2) +#define D3 (3) +#define D4 (4) +#define D5 (5) +#define D6 (6) +#define D7 (7) +#define D8 (8) +#define D9 (9) +#define D10 (10) +#define D11 (11) +#define D12 (12) +#define D13 (13) +#define D14 (14) +#define D15 (15) +#define A0 (16) +#define A1 (17) +#define A2 (18) +#define A3 (19) +#define A4 (20) +#define A5 (21) +#define A6 (22) +#define A7 (23) + +#define F_CPU 150000000L /* CPU:150MHz */ + +/* i2c1 : P(,13-SDA P(,14-SCL */ +#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" + +/* Serial2 : P(,27-TX P(,24-RX */ +#define RTDUINO_SERIAL2_DEVICE_NAME "uart2" + +#endif /* Pins_Arduino_h */ diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig b/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig index 4e4ed80b37..99d7da5bae 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/board/Kconfig @@ -42,6 +42,22 @@ menu "On-chip Peripheral Drivers" endchoice endif + config BSP_USING_UART1 + bool "Enable Flexcomm1 as UART" + default n + if BSP_USING_UART1 + choice + prompt "Select UART2 badurate" + default HW_UART1_BAUDRATE_115200 + + config HW_UART1_BAUDRATE_9600 + bool "Badurate 9600" + + config HW_UART1_BAUDRATE_115200 + bool "Badurate 115200" + endchoice + endif + config BSP_USING_UART2 bool "Enable Flexcomm2 as UART" default n @@ -70,6 +86,7 @@ menu "On-chip Peripheral Drivers" config BSP_USING_I2C1 bool "Enable Flexcomm1 I2C" default y + if BSP_USING_I2C1 choice prompt "Select I2C1 badurate" @@ -130,6 +147,21 @@ menu "On-chip Peripheral Drivers" config BSP_USING_ADC0_CH1 bool "Enable ADC0 Channel1" default n + + config BSP_USING_ADC0_CH8 + bool "Enable ADC0 Channel8" + default n + + + config BSP_USING_ADC0_CH13 + bool "Enable ADC0 Channel13" + default n + + + config BSP_USING_ADC0_CH26 + bool "Enable ADC0 Channel26" + default n + endif config BSP_USING_SDIO @@ -180,6 +212,18 @@ menu "On-chip Peripheral Drivers" default y if BSP_USING_PWM + config BSP_USING_CTIMER0_MAT3 + bool "Enable CIMER0 Match3 as PWM output" + default y + + config BSP_USING_CTIMER1_MAT0 + bool "Enable CIMER1 Match0 as PWM output" + default y + + config BSP_USING_CTIMER1_MAT3 + bool "Enable CIMER1 Match3 as PWM output" + default n + config BSP_USING_CTIMER2_MAT0 bool "Enable CIMER2 Match0 as PWM output" default y @@ -191,6 +235,10 @@ menu "On-chip Peripheral Drivers" config BSP_USING_CTIMER2_MAT2 bool "Enable CIMER2 Match2 as PWM output" default n + + config BSP_USING_CTIMER3_MAT2 + bool "Enable CIMER3 Match2 as PWM output" + default n endif endmenu @@ -215,6 +263,26 @@ menu "Onboard Peripheral Drivers" default "i2c4" endif + config BSP_USING_ARDUINO + bool "Compatible with Arduino Ecosystem (RTduino)" + select PKG_USING_RTDUINO + select BSP_USING_UART2 + select BSP_USING_GPIO + select BSP_USING_ADC + select BSP_USING_ADC0 + select BSP_USING_PWM + select BSP_USING_CTIMER1_MAT0 + select BSP_USING_CTIMER1_MAT3 + select BSP_USING_CTIMER2_MAT0 + select BSP_USING_CTIMER2_MAT1 + select BSP_USING_CTIMER2_MAT2 + select BSP_USING_CTIMER3_MAT2 + select BSP_USING_I2C + select BSP_USING_I2C1 + imply RTDUINO_USING_SERVO + imply RTDUINO_USING_WIRE + default n + endmenu menu "Board extended module Drivers" diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py index 33c94fb73e..647b22a2a6 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/rtconfig.py @@ -19,7 +19,7 @@ if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = r'C:\Users\XXYYZZ' elif CROSS_TOOL == 'keil': - PLATFORM = 'armcc' + PLATFORM = 'armclang' EXEC_PATH = r'C:/Keil_v5' elif CROSS_TOOL == 'iar': PLATFORM = 'iccarm' |
