mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-08 14:43:04 +08:00
[BSP][RT1050] fix rt1050 bsp bug and update code. | 修复RT1050 BSP bug并更新代码.
修复以下问题: 1. 修复当配置BSP为野火开发板时, 编译无法通过问题.。 2. 修复ft5406驱动挂载i2c总线到i2c1 bus。 3. 修复spibus时钟分频数错误,并修复所有spi bus都关闭时编译警告。 更新代码: 1. 移除rtgui相关初始化代码.。 2. 导出lcd相关配置参数:HSW/HFP/HBP/VSW/VFP/VBP/Backlight pin/Reset pin/width pixel/height pixel。 3. 当配置BSP为野火板子时, 默认添加sdio驱动。
This commit is contained in:
1 parent
8ea0ea9105
commit
f9e58990ef
13 files changed
+589
-1136
No files matched your search
@@ -317,6 +317,7 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
|
||||
# CONFIG_PKG_USING_QUICKLZ is not set
|
||||
# CONFIG_PKG_USING_MULTIBUTTON is not set
|
||||
# CONFIG_PKG_USING_SAMPLES is not set
|
||||
# CONFIG_PKG_USING_CANFESTIVAL is not set
|
||||
|
||||
#
|
||||
# example package: hello
|
||||
@@ -343,14 +344,14 @@ CONFIG_RT_USING_UART1=y
|
||||
# CONFIG_RT_USING_UART8 is not set
|
||||
|
||||
#
|
||||
# Select spi bus drivers
|
||||
# Select spi bus and dev drivers
|
||||
#
|
||||
CONFIG_LPSPI_CLK_SOURCE_FROM_PLL3PFD1=y
|
||||
# CONFIG_LPSPI_CLK_SOURCE_FROM_PLL3PFD0 is not set
|
||||
# CONFIG_LPSPI_CLK_SOURCE_FROM_PLL2 is not set
|
||||
# CONFIG_LPSPI_CLK_SOURCE_FROM_PLL2PFD2 is not set
|
||||
CONFIG_LPSPI_CLK_SOURCE=0
|
||||
CONFIG_LPSPI_CLK_SOURCE_DIVIDER=7
|
||||
CONFIG_LPSPI_CLK_SOURCE_DIVIDER=8
|
||||
# CONFIG_RT_USING_SPIBUS1 is not set
|
||||
# CONFIG_RT_USING_SPIBUS2 is not set
|
||||
# CONFIG_RT_USING_SPIBUS3 is not set
|
||||
@@ -361,5 +362,35 @@ CONFIG_LPSPI4_SDO_GPIO_1=y
|
||||
# CONFIG_LPSPI4_SDO_GPIO_2 is not set
|
||||
CONFIG_LPSPI4_SDI_GPIO_1=y
|
||||
# CONFIG_LPSPI4_SDI_GPIO_2 is not set
|
||||
# CONFIG_RT_USING_SPI_FLASH is not set
|
||||
|
||||
#
|
||||
# Select i2c bus drivers
|
||||
#
|
||||
CONFIG_LPI2C_CLOCK_SOURCE_DIVIDER=4
|
||||
CONFIG_RT_USING_I2C1=y
|
||||
# CONFIG_RT_USING_I2C1_BITOPS is not set
|
||||
# CONFIG_RT_USING_I2C2 is not set
|
||||
# CONFIG_RT_USING_I2C3 is not set
|
||||
# CONFIG_RT_USING_I2C4 is not set
|
||||
|
||||
#
|
||||
# Select lcd driver
|
||||
#
|
||||
|
||||
#
|
||||
# Notice: Evk Board para: 480*272 4 4 8 2 40 10 106 45
|
||||
#
|
||||
CONFIG_RT_USING_LCD=y
|
||||
CONFIG_LCD_WIDTH=480
|
||||
CONFIG_LCD_HEIGHT=272
|
||||
CONFIG_LCD_HFP=4
|
||||
CONFIG_LCD_VFP=4
|
||||
CONFIG_LCD_HBP=8
|
||||
CONFIG_LCD_VBP=2
|
||||
CONFIG_LCD_HSW=40
|
||||
CONFIG_LCD_VSW=10
|
||||
CONFIG_LCD_BL_PIN=106
|
||||
CONFIG_LCD_RST_PIN=45
|
||||
CONFIG_RT_USING_SDRAM=y
|
||||
CONFIG_RT_USING_RTC_HP=y
|
||||
+133
-26
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,11 @@ Import('RTT_ROOT')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('drivers/*.c')
|
||||
src = Glob('drivers/*.c')
|
||||
|
||||
if GetDepend('BOARD_RT1050_FIRE'):
|
||||
SrcRemove(src, r'drivers\fsl_enet.c')
|
||||
|
||||
SrcRemove(src, 'drivers/dataqueue.c')
|
||||
src += Glob('common/chip/*.c')
|
||||
src += [cwd + '/system_MIMXRT1052.c']
|
||||
|
||||
@@ -2,7 +2,7 @@ Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = os.path.join(str(Dir('#')), 'drivers')
|
||||
cwd = os.path.join(str(Dir('#')), 'drivers')
|
||||
|
||||
# add the general drivers.
|
||||
src = Split("""
|
||||
@@ -16,7 +16,7 @@ CPPDEFINES = []
|
||||
|
||||
# add sdram driver code
|
||||
if GetDepend('RT_USING_SDRAM'):
|
||||
src = src + ['./drv_sdram.c']
|
||||
src = src + ['drv_sdram.c']
|
||||
|
||||
# add pin driver code
|
||||
if GetDepend('RT_USING_PIN'):
|
||||
@@ -24,25 +24,34 @@ if GetDepend('RT_USING_PIN'):
|
||||
|
||||
# add rtc driver code
|
||||
if GetDepend('RT_USING_RTC_HP'):
|
||||
src = src + ['./drv_rtc.c']
|
||||
src = src + ['drv_rtc.c']
|
||||
|
||||
# add spibus driver code
|
||||
if GetDepend('RT_USING_SPI'):
|
||||
src += ['drv_spi_bus.c']
|
||||
|
||||
# add spi flash driver code
|
||||
if GetDepend('RT_USING_SPI_FLASH'):
|
||||
src += ['drv_spi_flash.c']
|
||||
|
||||
# add i2cbus driver code
|
||||
if GetDepend('RT_USING_I2C'):
|
||||
src += ['drv_i2c.c']
|
||||
|
||||
# add lcd driver code
|
||||
if GetDepend('RT_USING_LCD'):
|
||||
src += ['drv_lcd.c']
|
||||
|
||||
# add sdio driver code
|
||||
if GetDepend('RT_USING_SDIO'):
|
||||
src += ['drv_sdio.c']
|
||||
|
||||
if GetDepend('BOARD_RT1050_EVK'):
|
||||
src += ['hyper_flash_boot.c']
|
||||
|
||||
if GetDepend('RT_USING_LWIP'):
|
||||
src += ['drv_eth.c', 'fsl_phy.c']
|
||||
CPPDEFINES += ['FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE']
|
||||
|
||||
if GetDepend('RT_USING_SDIO'):
|
||||
src += ['drv_sdio.c']
|
||||
|
||||
if GetDepend('RT_USING_USB_DEVICE'):
|
||||
src += Glob('usb/phy/*.c')
|
||||
@@ -52,9 +61,6 @@ if GetDepend('BOARD_RT1050_EVK'):
|
||||
src += ['drv_usbd.c']
|
||||
src += Glob('usb/device/*.c')
|
||||
|
||||
if GetDepend('RT_USING_RTGUI') or GetDepend('PKG_USING_GUIENGINE'):
|
||||
src += ['drv_lcd.c', 'drv_ft5406.c', 'drv_i2c.c']
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
@@ -202,24 +202,4 @@ void rt_hw_board_init()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PKG_USING_GUIENGINE
|
||||
#include <rtgui/driver.h>
|
||||
#include "drv_lcd.h"
|
||||
|
||||
/* initialize for gui driver */
|
||||
int rtgui_lcd_init(void)
|
||||
{
|
||||
rt_device_t device;
|
||||
|
||||
imxrt_hw_lcd_init();
|
||||
|
||||
device = rt_device_find("lcd");
|
||||
/* set graphic device */
|
||||
rtgui_graphic_set_device(device);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rtgui_lcd_init);
|
||||
#endif
|
||||
|
||||
/*@}*/
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#define BSP_TOUCH_SAMPLE_HZ 30
|
||||
|
||||
#define I2CBUS_NAME "i2c0"
|
||||
#define I2CBUS_NAME "i2c1"
|
||||
|
||||
#if 0
|
||||
#define FTDEBUG rt_kprintf
|
||||
|
||||
+156
-646
File diff suppressed because it is too large.
Load diff
@@ -1,29 +1,23 @@
|
||||
/*
|
||||
* File : drv_i2c.c
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
* File : drv_lcd2.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-12-15 Tanek the first version
|
||||
* 2018-04-05 Liuguang the first version.
|
||||
*/
|
||||
|
||||
#ifndef __DRV_LCD_H__
|
||||
#define __DRV_LCD_H__
|
||||
|
||||
extern int imxrt_hw_lcd_init(void);
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt_hw_lcd_init(void);
|
||||
|
||||
#endif
|
||||
@@ -18,7 +18,8 @@
|
||||
#include "fsl_iomuxc.h"
|
||||
#include "fsl_lpspi.h"
|
||||
|
||||
#ifdef RT_USING_SPI
|
||||
#if defined(RT_USING_SPIBUS1) || defined(RT_USING_SPIBUS2) || \
|
||||
defined(RT_USING_SPIBUS3) || defined(RT_USING_SPIBUS4)
|
||||
|
||||
#if defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL
|
||||
#error "Please don't define 'FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL'!"
|
||||
@@ -28,7 +29,7 @@
|
||||
#define LPSPI_CLK_SOURCE (1U) /* PLL3 PFD0 */
|
||||
#endif
|
||||
#if !defined(LPSPI_CLK_SOURCE_DIVIDER)
|
||||
#define LPSPI_CLK_SOURCE_DIVIDER (7U) /* 8div */
|
||||
#define LPSPI_CLK_SOURCE_DIVIDER (8U) /* 8div */
|
||||
#endif
|
||||
|
||||
/* LPSPI1 SCK SDO SDI IOMUX Config */
|
||||
@@ -399,14 +400,10 @@ static struct rt_spi_ops rt1050_spi_ops =
|
||||
|
||||
int rt_hw_spi_bus_init(void)
|
||||
{
|
||||
#if defined(RT_USING_SPIBUS1) || defined(RT_USING_SPIBUS2) || \
|
||||
defined(RT_USING_SPIBUS3) || defined(RT_USING_SPIBUS4)
|
||||
|
||||
CLOCK_SetMux(kCLOCK_LpspiMux, LPSPI_CLK_SOURCE);
|
||||
CLOCK_SetDiv(kCLOCK_LpspiDiv, LPSPI_CLK_SOURCE_DIVIDER);
|
||||
CLOCK_SetDiv(kCLOCK_LpspiDiv, LPSPI_CLK_SOURCE_DIVIDER-1);
|
||||
|
||||
CLOCK_EnableClock(kCLOCK_Iomuxc);
|
||||
#endif
|
||||
|
||||
#if defined(RT_USING_SPIBUS1)
|
||||
rt_spi_bus_register(&spi1_bus, "spi1", &rt1050_spi_ops);
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* File : drv_spi_flash.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-04-02 Liuguang the first version.
|
||||
*/
|
||||
|
||||
#include "drv_spi_flash.h"
|
||||
|
||||
#include "spi_flash.h"
|
||||
#include "spi_flash_sfud.h"
|
||||
|
||||
#ifndef SPI_FLASH_USING_SPIBUS_NAME
|
||||
#define SPI_FLASH_USING_SPIBUS_NAME "spi4"
|
||||
#endif
|
||||
#ifndef SPI_FLASH_NAME
|
||||
#define SPI_FLASH_NAME "flash0"
|
||||
#endif
|
||||
#ifndef SPI_FLASH_USING_CS_PIN
|
||||
#define SPI_FLASH_USING_CS_PIN (79)
|
||||
#endif
|
||||
|
||||
int rt_hw_spi_flash_init(void)
|
||||
{
|
||||
rt_err_t ret;
|
||||
|
||||
extern rt_err_t rt1050_spi_bus_attach_device(const char *bus_name,
|
||||
const char *device_name, rt_uint32_t pin);
|
||||
|
||||
ret = rt1050_spi_bus_attach_device(SPI_FLASH_USING_SPIBUS_NAME,
|
||||
SPI_FLASH_USING_SPIBUS_NAME "0", SPI_FLASH_USING_CS_PIN);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(rt_sfud_flash_probe(SPI_FLASH_NAME, SPI_FLASH_USING_SPIBUS_NAME "0") == RT_NULL)
|
||||
{
|
||||
return RT_ERROR;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_spi_flash_init);
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* File : drv_spi_flash.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-04-02 Liuguang the first version.
|
||||
*/
|
||||
|
||||
#ifndef __DRV_SPI_FLASH_H_
|
||||
#define __DRV_SPI_FLASH_H_
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt_hw_spi_flash_init(void);
|
||||
|
||||
#endif /* __DRV_SPI_FLASH_H_ */
|
||||
+138
-404
File diff suppressed because it is too large.
Load diff
@@ -200,20 +200,36 @@
|
||||
|
||||
#define RT_USING_UART1
|
||||
|
||||
/* Select spi bus drivers */
|
||||
/* Select spi bus and dev drivers */
|
||||
|
||||
#define LPSPI_CLK_SOURCE_FROM_PLL3PFD1
|
||||
#define LPSPI_CLK_SOURCE 0
|
||||
#define LPSPI_CLK_SOURCE_DIVIDER 7
|
||||
#define LPSPI_CLK_SOURCE_DIVIDER 8
|
||||
#define RT_USING_SPIBUS4
|
||||
#define LPSPI4_SCK_GPIO_1
|
||||
#define LPSPI4_SDO_GPIO_1
|
||||
#define LPSPI4_SDI_GPIO_1
|
||||
|
||||
/* Select iic drivers */
|
||||
/* Select i2c bus drivers */
|
||||
|
||||
#define LPI2C_CLOCK_SOURCE_DIVIDER 4
|
||||
#define RT_USING_I2C1
|
||||
|
||||
/* Select lcd driver */
|
||||
|
||||
/* Notice: Evk Board para: 480*272 4 4 8 2 40 10 106 45 */
|
||||
|
||||
#define RT_USING_LCD
|
||||
#define LCD_WIDTH 480
|
||||
#define LCD_HEIGHT 272
|
||||
#define LCD_HFP 4
|
||||
#define LCD_VFP 4
|
||||
#define LCD_HBP 8
|
||||
#define LCD_VBP 2
|
||||
#define LCD_HSW 40
|
||||
#define LCD_VSW 10
|
||||
#define LCD_BL_PIN 106
|
||||
#define LCD_RST_PIN 45
|
||||
#define RT_USING_SDRAM
|
||||
#define RT_USING_RTC_HP
|
||||
|
||||
|
||||
Reference in new issue
Block a user