页次: 1
开机显示包括两部分,全志的sdk还有一个boot1,它是比uboot先运行的,所以要想显示开机logo,boot1文件夹下边也需要修改一个文件
文件路径:.\lichee_a13\boot\boot1\driver\drv_de\de_bsp\lcd下的lcd0_panel_cfg.c
这个文件直接复制linux内核文件夹的那个就可以.
替换完成以后在编译运行就可以看到开机logo了
在源码路径.\lichee_a13\linux-3.0\drivers\video\sun5i\lcd\lcd_bak有一个示例文件cpu_320x240_kgm281i0.c
我们可以模仿这个文件写一个st7735s的,主要就是屏幕的初始化和屏幕的刷新函数不太一样.
#define LCD_PARA_USE_CONFIG //这个宏定义是选择从全志的设备树读取LCD屏幕的参数还是从当前文件写死参数,一般是选择从设备树,不然修改的时候很麻烦.
我们主要是修改一下init函数,屏幕的分辨率等等参数就可以了,感兴趣的可以看源码,记得修改了源码以后设备树文件也要对应修改.
第一步就是提取设备树:全志的设备树提取的方法好像也是有好几种,我是用的dd命令把系统的前几个分区备份出来然后再通过压缩软件把分区解压就可以得到一个script.bin的文件,通过bin2fex再把编译过的设备树还原成能看懂的源文件就可以了.
下面是我提取出来的设备树文件:
[product]
version = "1.1"
machine = "R8-BAYMIN-V1.0"
[platform]
eraseflag = 1
next_work = 2
debug_mode = 23
[zhc_power]
axp20_fpga = "axp20_ldo4"
axp20_led = "axp20_ldo5"
power_fpga = port:PD21<1><0><default><1>
power_dcin = port:PD22<1><0><default><1>
power_adc = port:PF03<1><0><default><0>
power_amp = port:PD02<1><0><default><1>
[fpga_para]
fpga_used = 1
fpga_name = "iCE40_UL_1K"
fpga_crest_b = port:PD23<1><0><default><0>
fpga_spi_cs0 = port:PE00<1><0><default><0>
fpga_cdone_data_IRQ = port:PB02<0><default><default><default>
fpga_soft_reset = port:PD19<1><0><default><0>
fpga_spi_cs1 = port:PB10<1><0><default><1>
fpga_test = port:PF05<1><1><default><default>
[led_para]
led_used = 1
led_red = port:PF00<1><0><default><1>
led_green = port:PF01<1><0><default><1>
led_blue = port:PF02<1><0><default><1>
[gpio_para]
gpio_used = 1
gpio_pcba_test = port:PF04<0><0><default><default>
[target]
boot_clock = 1008
burn_key = 1
[power_sply]
dcdc2_vol = 1400
dcdc3_vol = 1200
ldo2_vol = 3000
ldo3_vol = 3300
ldo4_vol = 3300
pll4_freq = 960
pll6_freq = 720
[card_boot]
logical_start = 40960
sprite_gpio0 =
[pm_para]
standby_mode = 0
[card_boot0_para]
card_ctrl = 0
card_high_speed = 1
card_line = 4
sdc_d1 = port:PF00<2><1><default><default>
sdc_d0 = port:PF01<2><1><default><default>
sdc_clk = port:PF02<2><1><default><default>
sdc_cmd = port:PF03<2><1><default><default>
sdc_d3 = port:PF04<2><1><default><default>
sdc_d2 = port:PF05<2><1><default><default>
[twi_para]
twi_port = 0
twi_scl = port:PB00<2><1><default><default>
twi_sda = port:PB01<2><1><default><default>
[uart_para]
uart_debug_port = 1
uart_debug_tx = port:PG03<4><1><default><default>
uart_debug_rx = port:PG04<4><1><default><default>
[uart_force_debug]
uart_debug_port = 0
uart_debug_tx = port:PG03<4><default><default><default>
uart_debug_rx = port:PG04<4><default><default><default>
[jtag_para]
jtag_enable = 0
jtag_ms = port:PF00<4><1><default><default>
jtag_ck = port:PF05<4><1><default><default>
jtag_do = port:PF03<4><1><default><default>
jtag_di = port:PF01<4><1><default><default>
[dram_para]
dram_baseaddr = 0x40000000
dram_clk = 456
dram_type = 3
dram_rank_num = 1
dram_chip_density = 4096
dram_io_width = 16
dram_bus_width = 16
dram_cas = 9
dram_zq = 0x7a
dram_odt_en = 0
dram_size = 512
dram_tpr0 = 0x42d899b7
dram_tpr1 = 0xa090
dram_tpr2 = 0x22a00
dram_tpr3 = 0x0
dram_tpr4 = 0x0
dram_tpr5 = 0x0
dram_emr1 = 0x0
dram_emr2 = 0x10
dram_emr3 = 0x0
[nand_para]
nand_used = 1
nand_we = port:PC00<2><default><default><default>
nand_ale = port:PC01<2><default><default><default>
nand_cle = port:PC02<2><default><default><default>
nand_ce1 = port:PC03<2><default><default><default>
nand_ce0 = port:PC04<2><default><default><default>
nand_nre = port:PC05<2><default><default><default>
nand_rb0 = port:PC06<2><default><default><default>
nand_rb1 = port:PC07<2><default><default><default>
nand_d0 = port:PC08<2><default><default><default>
nand_d1 = port:PC09<2><default><default><default>
nand_d2 = port:PC10<2><default><default><default>
nand_d3 = port:PC11<2><default><default><default>
nand_d4 = port:PC12<2><default><default><default>
nand_d5 = port:PC13<2><default><default><default>
nand_d6 = port:PC14<2><default><default><default>
nand_d7 = port:PC15<2><default><default><default>
nand_wp =
nand_ce2 =
nand_ce3 =
nand_ce4 =
nand_ce5 =
nand_ce6 =
nand_ce7 =
nand_spi =
nand_ndqs = port:PC19<2><default><default><default>
good_block_ratio = 0
[mali_para]
mali_used = 1
mali_clkdiv = 2
[twi0_para]
twi0_used = 1
twi0_scl = port:PB00<2><default><default><default>
twi0_sda = port:PB01<2><default><default><default>
[twi1_para]
twi1_used = 1
twi1_scl = port:PB15<2><default><default><default>
twi1_sda = port:PB16<2><default><default><default>
[twi2_para]
twi2_used = 1
twi2_scl = port:PB17<2><default><default><default>
twi2_sda = port:PB18<2><default><default><default>
[uart_para0]
uart_used = 0
uart_port = 0
uart_type = 2
uart_tx = port:PF02<4><1><default><default>
uart_rx = port:PF04<4><1><default><default>
[uart_para1]
uart_used = 1
uart_port = 1
uart_type = 2
uart_tx = port:PG03<4><1><default><default>
uart_rx = port:PG04<4><1><default><default>
[uart_para2]
uart_used = 0
uart_port = 2
uart_type = 2
uart_tx =
uart_rx =
[uart_para3]
uart_used = 1
uart_port = 3
uart_type = 4
uart_tx = port:PG09<3><1><default><default>
uart_rx = port:PG10<3><1><default><default>
uart_cts = port:PG11<3><1><default><default>
uart_rts = port:PG12<3><1><default><default>
[spi0_para]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PC03<3><default><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
[spi1_para]
spi_used = 0
spi_cs0 = port:PG09<2><default><default><default>
spi_cs1 = port:PG13<2><default><default><default>
spi_sclk = port:PG10<2><default><default><default>
spi_mosi = port:PG11<2><default><default><default>
spi_miso = port:PG12<2><default><default><default>
[spi2_para]
spi_used = 1
spi_cs0 = port:PE00<4><default><default><default>
spi_sclk = port:PE01<4><default><default><default>
spi_mosi = port:PE02<4><default><default><default>
spi_miso = port:PE03<4><default><default><default>
[spi_devices]
spi_dev_num = 1
[spi_board0]
modalias = "spidev"
max_speed_hz = 50000000
bus_num = 2
chip_select = 0
mode = 3
[rtp_para]
rtp_used = 1
rtp_screen_size = 5
rtp_regidity_level = 5
rtp_press_threshold_enable = 0
rtp_press_threshold = 0x1f40
rtp_sensitive_level = 0xf
rtp_exchange_x_y_flag = 0
[ctp_para]
ctp_used = 0
ctp_name = "ft5x_ts"
ctp_twi_id = 2
ctp_twi_addr = 0x70
ctp_screen_max_x = 800
ctp_screen_max_y = 480
ctp_revert_x_flag = 0
ctp_revert_y_flag = 0
ctp_exchange_x_y_flag = 0
ctp_int_port = port:PH21<6><default><default><default>
ctp_wakeup = port:PB13<1><default><default><1>
ctp_io_port = port:PH21<0><default><default><default>
[tkey_para]
tkey_used = 0
tkey_name = "hv_keypad"
tkey_twi_id = 2
tkey_twi_addr = 0x62
tkey_int =
[motor_para]
motor_used = 0
motor_shake =
[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 1
screen0_output_mode = 4
screen1_output_type = 1
screen1_output_mode = 4
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 0
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
[lcd0_para]
lcd_used = 1
lcd_driver_name = "cpu_st7735s"
lcd_x = 128
lcd_y = 160
lcd_dclk_freq = 4
lcd_pwm_not_used = 0
lcd_pwm_ch = 0
lcd_pwm_freq = 10000
lcd_pwm_pol = 0
lcd_if = 1
lcd_hbp = 43
lcd_ht = 531
lcd_vbp = 12
lcd_vt = 576
lcd_hv_if = 0
lcd_hv_smode = 0
lcd_hv_s888_if = 0
lcd_hv_syuv_if = 0
lcd_hv_vspw = 1
lcd_hv_hspw = 1
lcd_lvds_ch = 0
lcd_lvds_mode = 0
lcd_lvds_bitwidth = 0
lcd_lvds_io_cross = 0
lcd_cpu_if = 7
lcd_frm = 2
lcd_io_cfg0 = 0
lcd_gamma_correction_en = 0
lcd_gamma_tbl_0 = 0x0
lcd_gamma_tbl_1 = 0x10101
lcd_gamma_tbl_255 = 0xffffff
lcd_bl_en_used = 1
lcd_bl_en = port:PD15<1><0><default><0>
lcd_power_used = 1
lcd_power = port:PD14<1><0><default><1>
lcd_pwm_used = 0
lcd_gpio_0 = port:PD13<1><0><default><1>
lcdd3 = port:PD03<2><0><default><default>
lcdd4 = port:PD04<2><0><default><default>
lcdd5 = port:PD05<2><0><default><default>
lcdd6 = port:PD06<2><0><default><default>
lcdd7 = port:PD07<2><0><default><default>
lcdd10 = port:PD10<2><0><default><default>
lcdd11 = port:PD11<2><0><default><default>
lcdd12 = port:PD12<2><0><default><default>
lcdclk = port:PD24<2><0><default><default>
lcdde = port:PD25<2><0><default><default>
lcdhsync = port:PD26<2><0><default><default>
lcdvsync = port:PD27<2><0><default><default>
[tv_out_dac_para]
dac_used = 1
dac0_src = 0
[hdmi_para]
hdmi_used = 0
[csi0_para]
csi_used = 0
csi_mode = 0
csi_dev_qty = 1
csi_stby_mode = 1
csi_mname = "gc0308"
csi_twi_id = 2
csi_twi_addr = 0x42
csi_if = 0
csi_vflip = 0
csi_hflip = 1
csi_iovdd = ""
csi_avdd = ""
csi_dvdd = ""
csi_flash_pol = 1
csi_mname_b = ""
csi_twi_id_b = 1
csi_twi_addr_b = 0x78
csi_if_b = 0
csi_vflip_b = 1
csi_hflip_b = 0
csi_iovdd_b = ""
csi_avdd_b = ""
csi_dvdd_b = ""
csi_flash_pol_b = 1
csi_ck = port:PE01<3><default><default><default>
csi_hsync = port:PE02<3><default><default><default>
csi_vsync = port:PE03<3><default><default><default>
csi_d0 = port:PE04<3><default><default><default>
csi_d1 = port:PE05<3><default><default><default>
csi_d2 = port:PE06<3><default><default><default>
csi_d3 = port:PE07<3><default><default><default>
csi_d4 = port:PE08<3><default><default><default>
csi_d5 = port:PE09<3><default><default><default>
csi_d6 = port:PE10<3><default><default><default>
csi_d7 = port:PE11<3><default><default><default>
csi_reset = port:power3<1><default><default><0>
csi_power_en =
csi_flash =
csi_af_en =
csi_reset_b =
csi_power_en_b =
csi_stby_b =
csi_flash_b =
csi_af_en_b =
[csi1_para]
csi_used = 0
csi_mode = 0
csi_dev_qty = 1
csi_stby_mode = 1
csi_mname = ""
csi_twi_id = 1
csi_twi_addr = 0xba
csi_if = 0
csi_vflip = 0
csi_hflip = 0
csi_iovdd = ""
csi_avdd = ""
csi_dvdd = ""
csi_flash_pol = 1
csi_mname_b = ""
csi_twi_id_b = 1
csi_twi_addr_b = 0x78
csi_if_b = 0
csi_vflip_b = 1
csi_hflip_b = 0
csi_iovdd_b = ""
csi_avdd_b = ""
csi_dvdd_b = ""
csi_flash_pol_b = 1
csi_reset =
csi_power_en =
csi_stby =
csi_flash =
csi_af_en =
csi_reset_b =
csi_power_en_b =
csi_stby_b =
csi_flash_b =
csi_af_en_b =
[mmc0_para]
sdc_used = 0
sdc_detmode = 4
bus_width = 4
sdc_d1 = port:PF00<2><1><2><default>
sdc_d0 = port:PF01<2><1><2><default>
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>
sdc_d3 = port:PF04<2><1><2><default>
sdc_d2 = port:PF05<2><1><2><default>
sdc_det = port:PG00<0><1><default><default>
sdc_use_wp = 0
sdc_wp =
[mmc1_para]
sdc_used = 0
sdc_detmode =
bus_width =
sdc_cmd =
sdc_clk =
sdc_d0 =
sdc_d1 =
sdc_d2 =
sdc_d3 =
sdc_det =
sdc_use_wp =
sdc_wp =
[mmc2_para]
sdc_used = 1
sdc_detmode = 3
bus_width = 4
sdc_cmd = port:PE08<4><1><2><default>
sdc_clk = port:PE09<4><1><2><default>
sdc_d0 = port:PE04<4><1><2><default>
sdc_d1 = port:PE05<4><1><2><default>
sdc_d2 = port:PE06<4><1><2><default>
sdc_d3 = port:PE07<4><1><2><default>
sdc_det =
sdc_use_wp = 0
sdc_wp =
[ms_para]
ms_used = 0
ms_bs =
ms_clk =
ms_d0 =
ms_d1 =
ms_d2 =
ms_d3 =
ms_det =
[keypad_para]
kp_used = 0
kp_in_size =
kp_out_size =
kp_in0 =
kp_in1 =
kp_in2 =
kp_in3 =
kp_in4 =
kp_in5 =
kp_in6 =
kp_in7 =
kp_out0 =
kp_out1 =
kp_out2 =
kp_out3 =
kp_out4 =
kp_out5 =
kp_out6 =
kp_out7 =
[usbc0]
usb_used = 1
usb_port_type = 0
usb_detect_type = 0
usb_id_gpio = port:PG02<0><1><default><default>
usb_drv_vbus_gpio = port:PB03<1><0><default><0>
usb_host_init_state = 0
[usbc1]
usb_used = 1
usb_port_type = 1
usb_detect_type = 0
usb_id_gpio =
usb_det_vbus_gpio =
usb_drv_vbus_gpio =
usb_drv_vbus_1_gpio =
usb_host_init_state = 0
[usb_feature]
vendor_id = 6353
mass_storage_id = 1
adb_id = 2
manufacturer_name = "USB Developer"
product_name = "Android"
serial_number = "20080411"
[msc_feature]
vendor_name = "USB 2.0"
product_name = "USB Flash Driver"
release = 100
luns = 3
[gsensor_para]
gsensor_used = 0
gsensor_name = "bma222"
gsensor_twi_id = 1
gsensor_twi_addr = 0x18
gsensor_int1 =
gsensor_int2 =
[gps_para]
gps_used = 0
gps_spi_id =
gps_spi_cs_num =
gps_lradc =
gps_clk =
gps_sign =
gps_mag =
gps_vcc_en =
gps_osc_en =
gps_rx_en =
[rf_para]
module_num = 10
module_power1 = "axp20_ldo3"
module_power1_vol = 3300000
module_power2 = ""
module_power2_vol =
module_power3 = ""
module_power3_vol =
power_switch =
chip_en =
lpo_use_apclk = ""
[wifi_para]
wifi_used = 1
wifi_sdc_id = 2
wifi_usbc_id = 1
wifi_usbc_type = 1
wl_reg_on = port:PD18<1><default><default><0>
wl_host_wake = port:PG00<6><default><default><0>
wl_host_wake_int_num = 0
wl_host_wake_invert = 0
[bt_para]
bt_used = 1
bt_uart_id = 1
bt_rst_n = port:PE10<1><default><default><0>
bt_wake = port:PB03<1><default><default><0>
bt_host_wake = port:PG01<6><default><default><0>
bt_host_wake_invert = 0
[3g_para]
3g_used = 0
3g_name =
3g_usbc_num =
3g_on_off =
3g_reset =
3g_poweron =
3g_wakeup_out =
3g_wakeup_in =
[gy_para]
gy_used = 0
gy_twi_id = 1
gy_twi_addr = 0
gy_int1 =
gy_int2 =
[ls_para]
ls_used = 1
ls_name = "ltr501als"
ls_twi_id = 1
ls_twi_addr =
ls_int =
[compass_para]
compass_used = 0
compass_twi_id =
compass_twi_addr =
compass_int =
[i2s_para]
i2s_used = 0
i2s_channel =
i2s_mclk =
i2s_bclk =
i2s_lrclk =
i2s_dout0 =
i2s_dout1 =
i2s_dout2 =
i2s_dout3 =
i2s_din =
[spdif_para]
spdif_used = 0
spdif_mclk =
spdif_dout =
spdif_din =
[audio_para]
audio_used = 1
capture_used = 1
audio_lr_change = 0
audio_pa_ctrl = port:PD20<1><0><default><0>
[ir_para]
ir_used = 0
ir0_rx = port:PB04<2><default><default><default>
[rtc_para]
rtc_used = 1
rtc_name = "pcf8563"
rtc_twi_id = 1
rtc_twi_addr = 81
[pmu_para]
pmu_used = 1
pmu_twi_addr = 52
pmu_twi_id = 0
pmu_irq_id = 0
pmu_battery_rdc = 180
pmu_battery_cap = 3500
pmu_init_chgcur = 1000
pmu_earlysuspend_chgcur = 1000
pmu_suspend_chgcur = 1000
pmu_resume_chgcur = 1000
pmu_shutdown_chgcur = 1000
pmu_init_chgvol = 4200
pmu_init_chgend_rate = 15
pmu_init_chg_enabled = 1
pmu_init_adc_freq = 100
pmu_init_adc_freqc = 100
pmu_init_chg_pretime = 50
pmu_init_chg_csttime = 720
pmu_bat_para1 = 0
pmu_bat_para2 = 0
pmu_bat_para3 = 0
pmu_bat_para4 = 0
pmu_bat_para5 = 2
pmu_bat_para6 = 3
pmu_bat_para7 = 9
pmu_bat_para8 = 14
pmu_bat_para9 = 22
pmu_bat_para10 = 34
pmu_bat_para11 = 49
pmu_bat_para12 = 56
pmu_bat_para13 = 71
pmu_bat_para14 = 82
pmu_bat_para15 = 89
pmu_bat_para16 = 98
pmu_usbvol_limit = 0
pmu_usbcur_limit = 0
pmu_usbvol = 0
pmu_usbcur = 0
pmu_usbvol_pc = 0
pmu_usbcur_pc = 0
pmu_pwroff_vol = 3300
pmu_pwron_vol = 2900
pmu_pekoff_time = 10000
pmu_pekoff_en = 1
pmu_peklong_time = 1500
pmu_pekon_time = 1000
pmu_pwrok_time = 64
pmu_pwrnoe_time = 2000
pmu_intotp_en = 1
pmu_used2 = 0
pmu_adpdet =
pmu_init_chgcur2 = 1000
pmu_earlysuspend_chgcur2 = 1000
pmu_suspend_chgcur2 = 1200
pmu_resume_chgcur2 = 1000
pmu_shutdown_chgcur2 = 1200
pmu_suspendpwroff_vol = 3500
pmu_batdeten = 1
[recovery_key]
key_min = 4
key_max = 6
[dvfs_table]
max_freq = 1008000000
min_freq = 60000000
LV_count = 7
LV1_freq = 1104000000
LV1_volt = 1500
LV2_freq = 1008000000
LV2_volt = 1400
LV3_freq = 912000000
LV3_volt = 1350
LV4_freq = 864000000
LV4_volt = 1300
LV5_freq = 624000000
LV5_volt = 1200
LV6_freq = 576000000
LV6_volt = 1200
LV7_freq = 432000000
LV7_volt = 1200
[boot_disp]
output_disp = 0
output_type = 1
output_mode = 5
auto_hpd = 1
应该很多全志的设备都可以用这个方法提取设备树,有了设备树就可以进行下一步了,从lcd节点可以看出屏幕的驱动应该是st7735s的,有了屏幕引脚定义和驱动就可以点亮屏幕了.
前几天从闲鱼淘了一块古老的A13主控的智能音箱的板子,全志A13这颗芯片比较老了,但是想到曾经的荔枝派one上边也是用的这一款主控于是就想着买回来研究一下.
下面是板子的图片:
经过几天的查找资料算是把屏幕驱动了,能显示图片了.也可以播放音乐了.
这块板子的配置 板载一块Nand Flash,没有SD卡槽.... 有串口 屏幕是MCU的接口 wifi部分是ap6212带蓝牙功能 系统是TinaLinux 主要就是这些
因为没有sd卡槽所以有些不方便,一开始尝试编译主线linux,但是卡在了uboot的nand驱动那里,spl能运行,但是不能加载uboot,由于资料有限就没有再继续主线linux,而是从网上下载了别人分享的荔枝派one的sdk,由于原来没有接触过这种的SDK所以搭建环境也费了一些时间,虚拟机不要用版本太高的Ubuntu我是用的14.04的版本.
下面是我修改过的SDK的百度云链接:
链接: https://pan.baidu.com/s/14OH_HRm4ixDTR006GvG4zA?pwd=8jhq 提取码: 8jhq 复制这段内容后打开百度网盘手机App,操作更方便哦
我说一下如何适配屏幕,以为这块屏是MCU接口的跟我以前用的RGB和SPI的屏幕不太一样.
我在闲鱼掏了一块板子,没有资料,拆开看了看主控是F1C200SFlash是mx35lf1GE4AB这是一块nand flash,我在网上看到芒果派r3也是用的nand flash于是就找到了相关的sdk就是这个 buildroot-mangopi-r根据里边的说明成功编译但是烧录进去后报错:
烧录教程是这个wiki.dfrobot.com.cn烧录过程没有报错,应该是没有问题.
设备树也改了把uboot和kernel的norflash相关的都注释了.
串口打印日志如下:
U-Boot SPL 2020.07 (Jul 20 2024 - 20:54:39 +0800)
DRAM: 64 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
spl: mmc init failed with error: -95
Trying to boot from MMC2
Card did not respond to voltage select!
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
然后就卡死了,有没有人也遇到过这个问题能指导一下.
uboot设备树
路径.\buildroot-mangopi-r\board\widora\mangopi\r3\devicetree\uboot
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
// spi-nor@0 {
// #address-cells = <1>;
// #size-cells = <1>;
// reg = <0>;
// compatible = "winbond,w25q128", "jedec,spi-nor";
// spi-max-frequency = <50000000>;
// status = "disabled";
// };
spi-nand@1 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "spi-nand";
spi-max-frequency = <50000000>;
status = "okay";
};
};
路径:.\opt\buildroot-mangopi-r\board\widora\mangopi\r3\devicetree\linux
内核设备树
&spi0 {
status = "okay";
// spi-nor@0 {
// #address-cells = <1>;
// #size-cells = <1>;
// compatible = "winbond,w25q128", "jedec,spi-nor";
// reg = <0>;
// spi-max-frequency = <50000000>;
// status = "disabled";
//
// partitions {
// compatible = "fixed-partitions";
// #address-cells = <1>;
// #size-cells = <1>;
//
// partition@0 {
// label = "u-boot";
// reg = <0x000000 0x70000>;
// read-only;
// };
//
// partition@1 {
// label = "kernel";
// reg = <0x70000 0x590000>;
// read-only;
// };
//
// partition@2 {
// label = "rom";
// reg = <0x600000 0x700000>;
// read-only;
// };
//
// partition@3 {
// label = "overlay";
// reg = <0xd00000 0x300000>;
// };
// };
// };
//
spi-nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <50000000>;
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};
partition@1 {
label = "kernel";
reg = <0x100000 0x500000>;
read-only;
};
partition@2 {
label = "rom";
reg = <0x600000 0x2a00000>;
read-only;
};
partition@3 {
label = "vendor";
reg = <0x3000000 0x1000000>;
};
partition@4 {
label = "overlay";
reg = <0x4000000 0x3000000>;
};
};
};
};
问题解决了,原来是Page size设置错了,一不小心多打了一个0导致编译的sunxi-spl-with-ecc.bin体积大了很多.....
应该是上位机的不同命令决定的吧
我也遇到了这个问题,按照厂家的配置,结果显示会有条纹出现,换了一块还是 应该是配置问题
闲鱼掏了一块板子 主控是用的全志A13 不能插TF卡,只有板载的NandFlash型号是H27UBG8T2BTR查到了规格书是4G的,原来上边的系统跑的是Tina Linux,后来自己提取了设备树,想着自己刷一个u-boot,结果烧录了以后不能启动,串口没有输出.u-boot版本是sunxi哪个论坛下载的 分支是nano-v2018.01,烧录方法就是先用sunxi-tools工具把相应bin加载到内存然后启动
sudo sunxi-fel spl spl/sunxi-spl.bin
sudo sunxi-fel write 0x4a000000 u-boot-dtb.bin
sudo sunxi-fel write 0x43000000 spl/sunxi-spl-with-ecc.bin
sudo sunxi-fel exe 0x4a000000
使用工具可以启动进入uboot打印日志如下:
U-Boot SPL 2018.01-05679-g013ca457fd-dirty (Jan 10 2024 - 11:04:07)
DRAM: 512 MiB
Failed to set core voltage! Can't set CPU frequency
Trying to boot from FEL
U-Boot 2018.01-05679-g013ca457fd-dirty (Jan 10 2024 - 11:04:07 +0800) Allwinner Technology
CPU: Allwinner A13 (SUN5I)
Model: YCDL Xiaobai
I2C: ready
DRAM: 512 MiB
NAND: 4096 MiB
In: serial
Out: serial
Err: serial
Allwinner mUSB OTG (Peripheral)
Net: eth0: usb_ether
Hit any key to stop autoboot: 0
hello boy
=>
使用nand相关命令可以看到NandFlash的相关信息
=> nand info
Device 0: nand0, sector size 2048 KiB
Page size 8192 b
OOB size 640 b
Erase size 2097152 b
subpagesize 8192 b
options 0x40007200
bbt options 0x00070000
=> mtd
device nand0 <sunxi-nand.0>, # parts = 4
#: name size offset mask_flags
0: spl 0x00200000 0x00000000 0
1: uboot-env 0x00200000 0x00200000 0
2: uboot 0x00200000 0x00400000 0
3: UBI 0xffa00000 0x00600000 0
先擦除再写入
=> nand erase.part spl
NAND erase.part: device 0 offset 0x0, size 0x200000
Erasing at 0x0 -- 100% complete.
OK
=> nand write.raw.noverify 0x43000000 0x0 20
NAND write: 282624 bytes written: OK
=>
根据NandFlash的规格书,一页是8K,bin文件大小是132k所以写16页就够了,这里我写了20页
- Page size : (8K+640spare)bytes
- Block size : (2048K+160K)bytes
- Plane size : 1024blocks
- Device size : 2048blocks
按道理讲这不就是已经把spl写入了nand了吗,可是重启以后控制台没有输出,直接进入fel模式了.有没有大佬能指点一下,小白一个很多东西都不懂.....
下面是我修改过的文件
1.添加了一条内容在uboot/drivers/mtd/nand/nand_ids.c
{"H27UBG8T2BTR-BC 32G 3.3V 8-bit",
{ .id = {0xad, 0xd7, 0x94, 0xda, 0x74, 0xc3} },
SZ_8K, SZ_4K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640, NAND_ECC_INFO(40, SZ_1K), 0 },
2.设备树的nfc节点内容主要是修改了nand-ecc-strength nand-ecc-step-size
&nfc {
pinctrl-names = "default";
pinctrl-0 = <&nand_pins_a &nand_cs0_pins_a &nand_rb0_pins_a>;
status = "okay";
nand@0 {
#address-cells = <2>;
#size-cells = <2>;
reg = <0>;
allwinner,rb = <0>;
nand-ecc-mode = "hw";
nand-on-flash-bbt;
onfi,nand-timing-mode = <0x1f>;
nand-ecc-strength = <40>;
nand-ecc-step-size = <1024>;
partitions {
compatible = "fixed-partitions";
#address-cells = <2>;
#size-cells = <2>;
partition@0 {
label = "spl";
reg = <0x0 0x0 0x0 0x200000>;
};
partition@200000 {
label = "uboot-env";
reg = <0x0 0x200000 0x0 0x200000>;
};
partition@400000 {
label = "uboot";
reg = <0x0 0x400000 0x0 0x200000>;
};
partition@600000 {
label = "UBI";
reg = <0x0 0x600000 0x1 0xff000000>;
};
};
};
};
我查了一下感觉问题可能是出在ecc校验的环节 但是不知道怎么改....
这一波我支持司徒大佬
页次: 1