[bsp][nrf5340]add 5340 define for 1000000 baud rate;change RTC driver for 5340 (#6754)
* add nrf5340 bsp,add uarte and gpio drv for 5340 * [bsp][nrf5340]add 5340 define for 1000000 baud rate;change RTC driver for 5340 Co-authored-by: andrew li <andrew.li@nordicsemi.no>
This commit is contained in:
parent
e8504c7cf1
commit
91cdcea900
|
@ -107,6 +107,7 @@ jobs:
|
|||
- {RTT_BSP: "nrf5x/nrf52832", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "nrf5x/nrf52833", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "nrf5x/nrf52840", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "nrf5x/nrf5340", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "qemu-vexpress-a9", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "sam7x", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "stm32/stm32f072-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
|
|
|
@ -112,6 +112,39 @@ const static struct rt_device_ops rtc_ops =
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(SOC_NRF5340)
|
||||
static rt_err_t rt_hw_rtc_register_5340(rt_device_t device, const char *name, rt_uint32_t flag)
|
||||
{
|
||||
struct tm time_new = ONCHIP_RTC_TIME_DEFAULT;
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
init_time = timegm(&time_new);
|
||||
if (rt_rtc_config(device) != RT_EOK)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
#ifdef RT_USING_DEVICE_OPS
|
||||
device->ops = &rtc_ops;
|
||||
#else
|
||||
device->init = RT_NULL;
|
||||
device->open = RT_NULL;
|
||||
device->close = RT_NULL;
|
||||
device->read = RT_NULL;
|
||||
device->write = RT_NULL;
|
||||
device->control = rt_rtc_control;
|
||||
#endif
|
||||
device->type = RT_Device_Class_RTC;
|
||||
device->rx_indicate = RT_NULL;
|
||||
device->tx_complete = RT_NULL;
|
||||
device->user_data = RT_NULL;
|
||||
|
||||
/* register a character device */
|
||||
rt_device_register(device, name, flag);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
#else
|
||||
static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint32_t flag)
|
||||
{
|
||||
struct tm time_new = ONCHIP_RTC_TIME_DEFAULT;
|
||||
|
@ -143,11 +176,15 @@ static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
#endif
|
||||
int rt_hw_rtc_init(void)
|
||||
{
|
||||
rt_err_t result;
|
||||
#if defined(SOC_NRF5340)
|
||||
result = rt_hw_rtc_register_5340(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
|
||||
#else
|
||||
result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
|
||||
#endif
|
||||
if (result != RT_EOK)
|
||||
{
|
||||
LOG_E("rtc register err code: %d", result);
|
||||
|
|
|
@ -155,9 +155,11 @@ static rt_err_t _uart_cfg(struct rt_serial_device *serial, struct serial_configu
|
|||
case BAUD_RATE_921600:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_921600;
|
||||
break;
|
||||
#if defined(SOC_NRF5340)
|
||||
case 1000000:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_1000000;
|
||||
break;
|
||||
#endif /* SOC_NRF5340*/
|
||||
case BAUD_RATE_2000000:
|
||||
case BAUD_RATE_3000000:
|
||||
return -RT_EINVAL;
|
||||
|
@ -286,7 +288,9 @@ int rt_hw_uart_init(void)
|
|||
|
||||
#ifdef BSP_USING_UART0
|
||||
m_serial_0.config = config;
|
||||
#if defined(SOC_NRF5340)
|
||||
m_serial_0.config.baud_rate = 1000000;
|
||||
#endif /* SOC_NRF5340*/
|
||||
m_serial_0.ops = &_uart_ops;
|
||||
m_uarte0_cb.serial = &m_serial_0;
|
||||
rt_hw_serial_register(&m_serial_0, "uart0", \
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
| **片上外设** | **支持情况** | **备注** |
|
||||
| :----------- | :----------: | :--------------------: |
|
||||
| GPIO | 支持 | GPION |
|
||||
| UART | 支持 | UART0 |
|
||||
| UART | 支持 | UART0 请暂时使用1000000波特率|
|
||||
| PWM | 支持 | 支持 |
|
||||
| SPI | 支持 | 支持 |
|
||||
| QSPI | 支持 | 支持开发板上QSPI FLASH |
|
||||
|
|
Loading…
Reference in New Issue