页次: 1
在社区发育了半年,想来里面也是有很多和我一样的新手,每天看着大佬的帖子无从下手。
刚开始我也是看到那么多资料一脸茫然,在其他帖子下的回复我也看不懂一些专业术语也时经常百度。
之前我也有就只有stm esp这些单片机的基础。看到很多帖子就心里痒痒。
我大概给像我一样的这种小白说一下,可能小白都有这种症状,大佬就算了
为了追赶大佬的脚步,刚开始我也是各种在网上调查开发板,啥啥啥好入门啥啥资料多的,不敢入手怕板子吃灰了。
市面上的教程就野火和正点的,就想买板子,但是买板子后面用完就吃灰,看到社区里有很多大佬弄f1c200s,板子也好画。但是关键又不知道软件通用不能不能学,反正网上各种了解,底层不一样但是原厂都封装好了,顶层都一样,于是就搞了这个板子。
大致流程就是在社区大佬的帮助下移植好linux就可以白嫖了,重点就是注意设备树添加是不一样的。
这个是所有资料里面又pcb原理图,驱动代码啥的,大概按照正点原子写的一些驱动都能用
f1c200s.zip
github也有 https://github.com/CXJ007/f1c200s
几张板子能动的图片:
上面那个飞线是屏幕背光出现了问题,原理图符号和封装匹配的时候三极管be反了文件里已经改了,弄好可以看看pwm是咋操作的。还有就是声音那个功放买器件漏掉了,现在过年没在学校没设备焊接,就这个没验证了其他的就自己用来学习是没问题的。还有个就是usbid(pe2)给占用了
我是来自开源,也希望我能帮上有需要的人,我自己也还需要不断努力
最后感谢社区大佬的巨人肩膀和许许多多的肩膀
问题同标题
起因是之前我为了学习linux自己画了一个板子但是ic上只有两个spi一个给了flash一个给了esp8089,为了体验各种操作方式把spi都用了,也不知道ic上那个40pin的是模拟的还是硬件的,本着学习的目就用了模拟8080来驱动st7789,前几天用st7735当终端,但他始终是复用了spi,现在想让io快起来给添加到framebuffer,
现在附上代码供大佬检查主要还是io的方式是不是这样不太好
st7789.c
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/of_gpio.h>
#include "st7789bus.h"
#define ST7789_CNT 1
#define ST7789_NAME "st7789"
struct st7789_dev st7789dev;
static struct file_operations st7789_fops = {
.owner = THIS_MODULE,
};
static int st7789_probe(struct platform_device *dev)
{
int ret;
printk("st7789_probe\r\n");
ret = alloc_chrdev_region(&st7789dev.devid, 0, ST7789_CNT, ST7789_NAME);
if(ret < 0){
printk("devid_err\r\n");
return -EINVAL;
}
st7789dev.major = MAJOR(st7789dev.devid);
printk("st7789 major:%d\r\n",st7789dev.major);
cdev_init(&st7789dev.cdev, &st7789_fops);
cdev_add(&st7789dev.cdev, st7789dev.devid, ST7789_CNT);
st7789dev.class = class_create(THIS_MODULE, ST7789_NAME);
if(IS_ERR(st7789dev.class)){
return PTR_ERR(st7789dev.class);
}
st7789dev.device = device_create(st7789dev.class, NULL, st7789dev.devid, NULL, ST7789_NAME);
if(IS_ERR(st7789dev.device)){
return PTR_ERR(st7789dev.device);
}
st7789_gpio_request(&st7789dev);
Lcd_Init();
LCD_Clear(0x07E0);
return 0;
}
static int st7789_remove(struct platform_device *dev)
{
int i;
printk("st7789_remove\r\n");
gpio_free(st7789dev.res);
gpio_free(st7789dev.cs);
gpio_free(st7789dev.dc);
gpio_free(st7789dev.wr);
gpio_free(st7789dev.rd);
for(i=0;i<8;i++){
gpio_free(st7789dev.db[j]);
}
device_destroy(st7789dev.class, st7789dev.devid);
class_destroy(st7789dev.class);
cdev_del(&st7789dev.cdev);
unregister_chrdev_region(st7789dev.devid, ST7789_CNT);
return 0;
}
static struct of_device_id st7789_of_match[] = {
{.compatible = "cxj,8080"},
{}
};
static struct platform_driver st7789_driver = {
.probe = st7789_probe,
.remove = st7789_remove,
.driver = {
.owner = THIS_MODULE,
.name = "st7789",
.of_match_table = st7789_of_match,
},
};
static int __init st7789_init(void)
{
return platform_driver_register(&st7789_driver);
}
static void __exit st7789_exit(void)
{
platform_driver_unregister(&st7789_driver);
}
module_init(st7789_init);
module_exit(st7789_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("CXJ");
st7789bus.h
#ifndef ST7789BUS_H
#define ST7789BUS_H
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/of_gpio.h>
struct st7789_dev {
dev_t devid;
int major;
struct cdev cdev;
struct class *class;
struct device *device;
struct device_node *node;
int res;
int cs;
int dc;
int wr;
int rd;
int db[8];
};
extern struct st7789_dev st7789dev;
#define LCD_RST_SET gpio_set_value(st7789dev.res, 1)
#define LCD_CS_SET gpio_set_value(st7789dev.cs, 1)
#define LCD_DC_SET gpio_set_value(st7789dev.dc, 1)
#define LCD_WR_SET gpio_set_value(st7789dev.wr, 1)
#define LCD_RD_SET gpio_set_value(st7789dev.rd, 1)
#define LCD_RST_CLR gpio_set_value(st7789dev.res, 0)
#define LCD_CS_CLR gpio_set_value(st7789dev.cs, 0)
#define LCD_DC_CLR gpio_set_value(st7789dev.dc, 0)
#define LCD_WR_CLR gpio_set_value(st7789dev.wr, 0)
#define LCD_RD_CLR gpio_set_value(st7789dev.rd, 0)
#define LCD_W 240
#define LCD_H 240
int st7789_gpio_request(struct st7789_dev *dev);
void Lcd_Init(void);
void LCD_Clear(uint16_t Color);
#endif
st7789bus.c
#include "st7789bus.h"
/*中景园复制粘贴修修改改*/
int st7789_gpio_request(struct st7789_dev *dev)
{
int ret=1;
int i;
char name[10];
dev->node = of_find_node_by_path("/st7789");
if(dev->node == NULL){
printk("tree_node is not find\r\n");
return -EINVAL;
}
dev->res = of_get_named_gpio(dev->node, "res-gpios", 0);
if(dev->res < 0){
printk("can not get res-gpios\r\n");
}
dev->cs = of_get_named_gpio(dev->node, "cs-gpios", 0);
if(dev->cs < 0){
printk("can not get cs-gpios\r\n");
ret = -EINVAL;
}
dev->dc = of_get_named_gpio(dev->node, "dc-gpios", 0);
if(dev->dc < 0){
printk("can not get dc-gpios\r\n");
ret = -EINVAL;
}
dev->wr = of_get_named_gpio(dev->node, "wr-gpios", 0);
if(dev->wr < 0){
printk("can not get wr-gpios\r\n");
ret = -EINVAL;
}
dev->rd = of_get_named_gpio(dev->node, "rd-gpios", 0);
if(dev->rd < 0){
printk("can not get rd-gpios\r\n");
ret = -EINVAL;
}
for(i=0;i<8;i++){
dev->db[j] = of_get_named_gpio(dev->node, "db-gpios", i);
if(dev->db[j] < 0){
printk("can not get db[%d]-gpios\r\n",i);
ret = -EINVAL;
}
}
if(ret != -EINVAL){
printk("res:%d cs:%d dc:%d wr:%d rd:%d\r\n", dev->res, dev->cs, dev->dc, dev->wr, dev->rd);
for(i=0;i<8;i++){
printk("db[%d]:%d", i, dev->db[j]);
}
}
gpio_request(dev->res, "res");
gpio_direction_output(dev->res, 0);
gpio_request(dev->cs, "cs");
gpio_direction_output(dev->cs, 0);
gpio_request(dev->dc, "dc");
gpio_direction_output(dev->dc, 0);
gpio_request(dev->wr, "wr");
gpio_direction_output(dev->wr, 0);
gpio_request(dev->rd, "rd");
gpio_direction_output(dev->rd, 0);
for(i=0;i<8;i++){
sprintf(name,"db%d",i);
gpio_request(dev->db[j], name);
gpio_direction_output(dev->db[j], 0);
}
return ret;
}
void data_out(struct st7789_dev dev, uint8_t dat)
{
int i;
for(i=0;i<8;i++){
gpio_set_value(dev.db[j],dat&0x01);
dat = dat>>1;
}
}
/******************************************************************************
函数说明:LCD 8位并口数据写入函数
入口数据:dat 要写入的并行数据
返回值: 无
******************************************************************************/
void LCD_Writ_Bus(uint8_t dat)
{
LCD_CS_CLR;
LCD_RD_SET;
LCD_WR_CLR;
data_out(st7789dev, dat);
LCD_WR_SET;
LCD_CS_SET;
}
/******************************************************************************
函数说明:LCD写入数据
入口数据:dat 写入的数据
返回值: 无
******************************************************************************/
void LCD_WR_DATA8(uint8_t dat)
{
LCD_DC_SET;//写数据
LCD_Writ_Bus(dat);
}
/******************************************************************************
函数说明:LCD写入数据
入口数据:dat 写入的数据
返回值: 无
******************************************************************************/
void LCD_WR_DATA(uint16_t dat)
{
LCD_DC_SET;//写数据
LCD_Writ_Bus(dat>>8);
LCD_Writ_Bus(dat);
}
/******************************************************************************
函数说明:LCD写入命令
入口数据:dat 写入的命令
返回值: 无
******************************************************************************/
void LCD_WR_REG(uint8_t dat)
{
LCD_DC_CLR;//写命令
LCD_Writ_Bus(dat);
}
/******************************************************************************
函数说明:设置起始和结束地址
入口数据:x1,x2 设置列的起始和结束地址
y1,y2 设置行的起始和结束地址
返回值: 无
******************************************************************************/
void LCD_Address_Set(u16 x1,u16 y1,u16 x2,u16 y2)
{
LCD_WR_REG(0x2a);//列地址设置
LCD_WR_DATA(x1);
LCD_WR_DATA(x2);
LCD_WR_REG(0x2b);//行地址设置
LCD_WR_DATA(y1);
LCD_WR_DATA(y2);
LCD_WR_REG(0x2c);//储存器写
}
// int Lcd_Test(struct st7789_dev dev)
// {
// int ret;
// LCD_WR_REG(0x04); //read id
// /*移植中景园发现画屏
// 增加时序延迟不行画屏
// 怀疑时序出错但是这个是移植大概率不会有问题
// 阅读datasheet的8080时序发现好像没啥问题画屏就算有反应
// 准备读id看时序发现原来LCD_Writ_Bus里没有禁止读LCD_RD_SET;
// 加上就行了
// */
// return ret;
// }
/******************************************************************************
函数说明:LCD初始化函数
入口数据:无
返回值: 无
******************************************************************************/
void Lcd_Init(void)
{
LCD_RST_CLR;
mdelay(200);
LCD_RST_SET;
mdelay(200);
//************* Start Initial Sequence **********//
LCD_WR_REG(0x01);
mdelay(200);
LCD_WR_REG(0x36);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0x3A);
LCD_WR_DATA8(0x05);
LCD_WR_REG(0xB2);
LCD_WR_DATA8(0x0C);
LCD_WR_DATA8(0x0C);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x33);
LCD_WR_DATA8(0x33);
LCD_WR_REG(0xB7);
LCD_WR_DATA8(0x35);
LCD_WR_REG(0xBB);
LCD_WR_DATA8(0x19);
LCD_WR_REG(0xC0);
LCD_WR_DATA8(0x2C);
LCD_WR_REG(0xC2);
LCD_WR_DATA8(0x01);
LCD_WR_REG(0xC3);
LCD_WR_DATA8(0x12);
LCD_WR_REG(0xC4);
LCD_WR_DATA8(0x20);
LCD_WR_REG(0xC6);
LCD_WR_DATA8(0x0F);
LCD_WR_REG(0xD0);
LCD_WR_DATA8(0xA4);
LCD_WR_DATA8(0xA1);
LCD_WR_REG(0xE0);
LCD_WR_DATA8(0xD0);
LCD_WR_DATA8(0x04);
LCD_WR_DATA8(0x0D);
LCD_WR_DATA8(0x11);
LCD_WR_DATA8(0x13);
LCD_WR_DATA8(0x2B);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x54);
LCD_WR_DATA8(0x4C);
LCD_WR_DATA8(0x18);
LCD_WR_DATA8(0x0D);
LCD_WR_DATA8(0x0B);
LCD_WR_DATA8(0x1F);
LCD_WR_DATA8(0x23);
LCD_WR_REG(0xE1);
LCD_WR_DATA8(0xD0);
LCD_WR_DATA8(0x04);
LCD_WR_DATA8(0x0C);
LCD_WR_DATA8(0x11);
LCD_WR_DATA8(0x13);
LCD_WR_DATA8(0x2C);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x44);
LCD_WR_DATA8(0x51);
LCD_WR_DATA8(0x2F);
LCD_WR_DATA8(0x1F);
LCD_WR_DATA8(0x1F);
LCD_WR_DATA8(0x20);
LCD_WR_DATA8(0x23);
LCD_WR_REG(0x21);
LCD_WR_REG(0x11);
//Delay (120);
LCD_WR_REG(0x29);
}
/******************************************************************************
函数说明:LCD清屏函数
入口数据:无
返回值: 无
******************************************************************************/
void MY_LCD_WR_DATA(uint16_t Color)
{
LCD_DC_SET;//写数据
LCD_CS_CLR;
LCD_RD_SET;
LCD_WR_CLR;
data_out(st7789dev, dat);
LCD_WR_SET;
LCD_CS_SET;
}
void LCD_Clear(uint16_t Color)
{
u16 i,j;
LCD_Address_Set(0,0,LCD_W-1,LCD_H-1);
for(i=0;i<LCD_W;i++)
{
for (j=0;j<LCD_H;j++)
{
//LCD_WR_DATA(Color); 里面很多多余动作
LCD_WR_DATA(Color);
}
}
}
MODULE_LICENSE("GPL");
MODULE_AUTHOR("CXJ");
代码难看不太像linux的风格,只是移植能用就行
在时序上明显有可以优化的地方但是我感觉这个问他题主要还是io的操作方式
又搞了一上午准备放弃自己写了的,最后检查了设备树结果发现spi引脚添加错了
大概操作流程就是先按照这个里面 https://www.bilibili.com/read/cv9947785 把引脚申请改了我用的是5.7.1
然后去fb_st7735r.c里面修改
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
//(xs+24) >> 8, (xs+24) & 0xFF, (xe+24) >> 8, (xe+24) & 0xFF);
xs >> 8, (xs+1) & 0xFF, xe >> 8, (xe+1) & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
(ys+25) >> 8, (ys+26) & 0xFF, (ye+25) >> 8, (ye+26) & 0xFF);
//ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
static struct fbtft_display display = {
.regwidth = 8,
.width = 80,
.height = 160,
.init_sequence = default_init_sequence,
.gamma_num = 2,
.gamma_len = 16,
.gamma = DEFAULT_GAMMA,
.fbtftops = {
.set_addr_win = set_addr_win,
.set_var = set_var,
.set_gamma = set_gamma,
},
};
下面是设备树里面
&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pd_pins>;
st7735r@0{
compatible = "sitronix,st7735r";
reg = <0>;
status = "okay";
spi-max-frequency = <36000000>;
spi-cpol;
spi-cpha;
rotate = <90>;
fps = <60>;
buswidth = <8>;
dc-gpios = <&pio 3 16 GPIO_ACTIVE_HIGH>;
reset-gpios = <&pio 3 17 GPIO_ACTIVE_HIGH>;
led-gpios = <&pio 3 15 GPIO_ACTIVE_LOW>;
debug = <0x0>;
};
};
然后修改bootargs 里面添加console=tty0
[ 1.108265] fb_st7735r spi0.0: fbtft_property_value: buswidth = 8
[ 1.114547] fb_st7735r spi0.0: fbtft_property_value: debug = 0
[ 1.120435] fb_st7735r spi0.0: fbtft_property_value: rotate = 90
[ 1.126555] fb_st7735r spi0.0: fbtft_property_value: fps = 60
[ 2.188617] Console: switching to colour frame buffer device 10x20
[ 2.197506] graphics fb0: fb_st7735r frame buffer, 80x160, 25 KiB video memory, 4 KiB buffer memory, fps=100, spi0.0 at 36 MHz
dev下面都有fb了纳闷了
&spi0 {
status = "okay";
st7735r@0{
compatible = "sitronix,st7735r";
reg = <0>;
status = "okay";
spi-max-frequency = <36000000>;
spi-cpol;
spi-cpha;
rotate = <90>;
fps = <60>;
buswidth = <8>;
dc-gpios = <&pio 3 16 GPIO_ACTIVE_HIGH>;
reset-gpios = <&pio 3 17 GPIO_ACTIVE_HIGH>;
led-gpios = <&pio 3 15 GPIO_ACTIVE_LOW>;
debug = <0x0>;
};
};
按照网上把申请io的地方换了
是不是我还有哪里有没设置
那个esp他的spi注册哪里始终是esp8089_spi: FAILED to find master 那个bus_num我也改成0了
我看网上说去 /sys/class/spi_master/目录看bus_num的号但是我没有
几番查找说内核没打开CONFIG_SPI_MASTER我去make menuconfig看了有是有的
现在不知道咋弄了
我的设备树在这里大佬帮我看看
#include <dt-bindings/clock/suniv-ccu-f1c100s.h>
#include <dt-bindings/reset/suniv-ccu-f1c100s.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&intc>;
clocks {
osc24M: clk-24M {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <24000000>;
clock-output-names = "osc24M";
};
osc32k: clk-32k {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32768>;
clock-output-names = "osc32k";
};
};
cpus {
cpu {
compatible = "arm,arm926ej-s";
device_type = "cpu";
};
};
soc {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;
sram-controller@1c00000 {
compatible = "allwinner,suniv-f1c100s-system-control",
"allwinner,sun4i-a10-system-control";
reg = <0x01c00000 0x30>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
sram_d: sram@10000 {
compatible = "mmio-sram";
reg = <0x00010000 0x1000>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0x00010000 0x1000>;
otg_sram: sram-section@0 {
compatible = "allwinner,suniv-f1c100s-sram-d",
"allwinner,sun4i-a10-sram-d";
reg = <0x0000 0x1000>;
status = "disabled";
};
};
};
ccu: clock@1c20000 {
compatible = "allwinner,suniv-f1c100s-ccu";
reg = <0x01c20000 0x400>;
clocks = <&osc24M>, <&osc32k>;
clock-names = "hosc", "losc";
#clock-cells = <1>;
#reset-cells = <1>;
};
intc: interrupt-controller@1c20400 {
compatible = "allwinner,suniv-f1c100s-ic";
reg = <0x01c20400 0x400>;
interrupt-controller;
#interrupt-cells = <1>;
};
pio: pinctrl@1c20800 {
compatible = "allwinner,suniv-f1c100s-pinctrl";
reg = <0x01c20800 0x400>;
interrupts = <38>, <39>, <40>;
clocks = <&ccu 37>, <&osc24M>, <&osc32k>;
clock-names = "apb", "hosc", "losc";
gpio-controller;
interrupt-controller;
#interrupt-cells = <3>;
#gpio-cells = <3>;
uart0_pe_pins: uart0-pe-pins {
pins = "PE0", "PE1";
function = "uart0";
};
mmc0_pins: mmc0-pins {
pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
function = "mmc0";
};
spi0_pc_pins: spi0-pc-pins {
pins = "PC0","PC1","PC2","PC3";
function = "spi0";
};
led_pins: led-pins {
pins = "PE2";
function = "led";
};
key_pins: key-pins {
pins = "PD15";
function = "key";
};
};
timer@1c20c00 {
compatible = "allwinner,suniv-f1c100s-timer";
reg = <0x01c20c00 0x90>;
interrupts = <13>;
clocks = <&osc24M>;
};
mmc0: mmc@1c0f000 {
compatible = "allwinner,suniv-f1c100s-mmc",
"allwinner,sun7i-a20-mmc";
reg = <0x01c0f000 0x1000>;
clocks = <&ccu CLK_BUS_MMC0>,
<&ccu CLK_MMC0>,
<&ccu CLK_MMC0_OUTPUT>,
<&ccu CLK_MMC0_SAMPLE>;
clock-names = "ahb",
"mmc",
"output",
"sample";
resets = <&ccu RST_BUS_MMC0>;
reset-names = "ahb";
interrupts = <23>;
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
wdt: watchdog@1c20ca0 {
compatible = "allwinner,suniv-f1c100s-wdt",
"allwinner,sun4i-a10-wdt";
reg = <0x01c20ca0 0x20>;
};
uart0: serial@1c25000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25000 0x400>;
interrupts = <1>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu 38>;
resets = <&ccu 24>;
status = "disabled";
};
uart1: serial@1c25400 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25400 0x400>;
interrupts = <2>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu 39>;
resets = <&ccu 25>;
status = "disabled";
};
uart2: serial@1c25800 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25800 0x400>;
interrupts = <3>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu 40>;
resets = <&ccu 26>;
status = "disabled";
};
spi0: spi@1c05000 {
compatible = "allwinner,suniv-spi",
"allwinner,sun8i-h3-spi";
reg = <0x01c05000 0x1000>;
interrupts = <10>;
clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
clock-names = "ahb", "mod";
resets = <&ccu RST_BUS_SPI0>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
};
};
/dts-v1/;
#include "suniv-f1c100s.dtsi"
#include <dt-bindings/gpio/gpio.h>
/ {
model = "Lichee Pi Nano";
compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s";
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
led {
compatible = "cxj,my_led";
pinctrl-names = "default";
pinctrl-0 = <&led_pins>;
led-gpios = <&pio 4 2 GPIO_ACTIVE_LOW>;
status = "okay";
};
key {
compatible = "cxj,my_key";
pinctrl-names = "default";
pinctrl-0 = <&key_pins>;
key-gpios = <&pio 3 15 GPIO_ACTIVE_LOW>;
interrupt-parent = <&pio>;
interrupts = <3 15 IRQ_TYPE_EDGE_BOTH>;
interrupt-controller;
status = "okay";
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pe_pins>;
status = "okay";
};
&mmc0 {
vmmc-supply = <®_vcc3v3>;
bus-width = <4>;
broken-cd;
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pc_pins>;
status = "okay";
};
紧跟大佬学习第二章
1先make ******defcofig再make编译
2
会出现mmc0 各种clock没定义
刚开始还不知道是没定义看了半天然后想起把官方的对比下这是官方上的
然后顺着文件路径寻找要添加头文件#include <dt-bindings/clock/suniv-ccu-f1c100s.h> #include <dt-bindings/reset/suniv-ccu-f1c100s.h>
然后就是suniv-f1c100s-licheepi-nano.dts里好像还少了
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
继续去制作文件系统。。。。。。。
中途SD卡还搞坏了用SD Card Formatter修复了还是不能用win下面能用不过bin都下不进去不知道啥情况
准备试试flash启动搞了半天Linux下的sunxi给我来个unknown都有点绝望了
sudo sunxi-fel ver
AWUSBFEX soc=00001663(unknown) 00000001 ver=0001 44 08 scratchpad=00007e00 00000000 00000000
然后在坑网找到一个大佬的工具花了5块还是是很值得的,很方便
不知道咋发图片反正flash能启动了
后面等新买的sd卡到了在试试也不知道和卡的文件系统有没有关系,而且sd的cmd被拉低我想也可能是芯片主动拉低的
先研究研究uboot
搞不明白啊,菜鸟一个
U-Boot SPL 2018.01-05679-g013ca457fd-dirty (Oct 22 2021 - 12:05:04)
DRAM: 64 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
就启动不到我测试了下电流在40ma上tf卡是50的样子,
而且我感觉是tf的cmd引脚没被上拉到3.3有引起的,是不是不正常啊?,而且也没和地短在一起,上拉电阻前还有3.3后面就没了。
写着写着突然怀疑是不是电阻坏(没有坏)搞不明白了,
有大佬知道如何去看那个error-95这个log对应问题在哪里万一又碰着其他了咋办呀?
事发现场和原理图
fc200s.7z
页次: 1