WhyCan Forum(哇酷论坛)

人过留名,雁过留声,感谢各位朋友不离不弃地支持。 QQ: 516333132, 微信: whycan_cn (哇酷网/挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2018-03-14 19:56:51

tom
会员
注册时间: 2018-03-14
累计积分: 107

N32926 RTC初始化失败

N32926芯片,使用SPI FLASH启动。

上电启动后,内部loader出现该错误提示:
Initial RTC .Enable Access Fail - Timeout
DRAM Init..1f1f1f1f1f


内核启动后,卡死在RTC初始化中的一个死循环。该死循环是不断检测RTC寄存器是否可以进行读写。

	printk("RTC Access Enable Check\n");
	while(1)
	{	
		rtc_time_out = 0;
		// enable long time press power disable
		if ((readl(REG_RTC_AER) & 0x10000) == 0x0) {
			// set RTC register access enable password
			writel(0xA965, REG_RTC_AER);
			// make sure RTC register read/write enable
			while ((readl(REG_RTC_AER) & 0x10000) == 0x0)
			{
				rtc_time_out++;
				if(rtc_time_out > 0xFFFFFF)
				{
					printk("RTC Access Eanble Fail. AER:0x%X.\n", readl(REG_RTC_AER));
					break;
				}
			}
			rtc_wait_ready();

			if ((readl(REG_RTC_AER) & 0x10000) == 0x10000) 
				break;			
		}
		else
			break;
	}

完整的启动信息如下:

Initial RTC .Enable Access Fail - Timeout
DRAM Init..1f1f1f1f1f
SD Port 0 Booting - EMMC Fail - No Boot Code Header
NAND CS0 Booting Fail - No Boot Code Header
NAND CS1 Booting Fail - No Boot Code Header
SPI Booting 
     Write - 0xB0000204 = 0xFFFFFFFF
     Write - 0xB0000208 = 0xFFFFFFFF
     Write - 0xB0003008 = 0x0000805A
     Write - 0xB0003028 = 0x2AFF3B4A
     Write - 0xB0003004 = 0x00000021
     Delay 256 us
     Write - 0xB0003004 = 0x00000023
     Write - 0xB0003004 = 0x00000027
     Delay 256 us
     Write - 0xB000301C = 0x00002402
     Delay 256 us
     Write - 0xB0003018 = 0x00000532
     Delay 256 us
     Write - 0xB0003004 = 0x00000027
     Delay 256 us
     Write - 0xB0003004 = 0x0000002B
     Delay 256 us
     Write - 0xB0003004 = 0x0000002B
     Delay 256 us
     Write - 0xB0003018 = 0x00000432
     Delay 256 us
     Write - 0xB000301C = 0x00002782
     Delay 256 us
     Write - 0xB000301C = 0x00002402
     Delay 256 us
     Write - 0xB0003004 = 0x00000020
     Delay 256 us
     Write - 0xB0003054 = 0x00000013
     Delay 4096 us
     Write - 0xB0003054 = 0x0000001E
     Delay 20480 us
     DRAM CMD0
     Delay 4096 us
     DRAM CMD2
     DRAM CMD2
     Write - 0xB0003054 = 0x0000001A
     Delay 8192 us
     Write - 0xB0000208 = 0x00008354
     Write - 0xB0000204 = 0x00E5011F
Success
Execute Address 0x00900000
SPI Loader start (20140710).
Want to set DRAM DIV REG = 0x8
11111.13.Ap3:MPLL REG = 0x1178
DRAM DIV REG = 0x8
Enable HW Power Off
Load Image Load file length 0x400, execute address 0x80905C40
Load file length 0x4A38A0, execute address 0x0
Jump to kernelLinux version 2.6.35.4 (root@nuvoton) (gcc version 4.2.1) #195 PREEMPT Wed Mar 14 19:18:59 CST 2018
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: W55FA92
Memory policy: ECC disabled, Data cache writeback
Decoder Instance-0, width = 1280, height = 720
Decoder Instance-0, offset = 0x0, total buf size = 0x77b000
Encoder Instance-0, width = 1280, height = 720
Encoder Instance-0, offset = 0x0, total buf size = 0x42f000
TOTAL_VDE_BUF_SIZE = 0xbaa000, dec_total=0x77b000, enc_total=0x42f000
AVC Buffer Size: 0xbaa000
VIN_DEV1 Buffer Size: 0x238800
CPU type 0x00fad007 is W55FA92
w55fa92_external_clock  = 12.0 MHz
w55fa92_apll_clock      = 432000 KHz
w55fa92_upll_clock      = 240000 KHz
w55fa92_mpll_clock      = 360000 KHz
w55fa92_system_clock    = 240000 KHz
w55fa92_cpu_clock       = 240000 KHz
w55fa92_ahb_clock       = 120000 KHz
w55fa92_apb_clock       = 60000 KHz
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: root=/dev/ram0 console=ttyS1,115200n8 rdinit=/sbin/init mem=64M vt.global_cursor_default=0
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 45856k/45856k available, 19680k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xff600000 - 0xffe00000   (   8 MB)
    vmalloc : 0xc4800000 - 0xe0000000   ( 440 MB)
    lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc0142000   (1256 kB)
      .text : 0xc0142000 - 0xc0486000   (3344 kB)
      .data : 0xc0486000 - 0xc04a3820   ( 119 kB)
Hierarchical RCU implementation.
        RCU-based detection of stalled CPUs is disabled.
        Verbose stalled-CPUs detection is disabled.
NR_IRQS:47
Console: colour dummy device 80x30
w55fa92_serial_initconsole, w55fa92-uart
w55fa92_serial_init_ports: initialising ports...
w55fa92_serial_init_port: port=c0496654, platdev=c048b748
w55fa92_serial_init_port: c0496654 (hw 0)...
resource c048b6d8 (b8008000..b80080ff)
port: map=b8008000, mem=f8008000, irq=14, clock=12000000
w55fa92_serial_resetport: port=c0496654 (b8008000), cfg=c048c158
w55fa92_serial_init_port: port=c04966f8, platdev=c048b800
w55fa92_serial_init_port: c04966f8 (hw 1)...
resource c048b710 (b8008100..b80081ff)
port: map=b8008100, mem=f8008100, irq=30, clock=12000000
w55fa92_serial_resetport: port=c04966f8 (b8008100), cfg=c048c174
w55fa92_serial_console_setup: port=c04966f8 (1)
w55fa92_serial_console_setup: baud 115200
baud=115200, quot=102
w-config: 8bits/char
console [ttyS1] enabled
w55fa92_avc_alloc_mem : Kernel allocate phy buf addr =0x4c7000, vir_addr = 0xc04c7000
ENCODER_TOTAL_SIZE = 0x42f000, DECODER_TOTAL_SIZE = 0x77b000
w55fa92_avc_alloc_mem,_ENCODER_BUF_START = 0x4c7000,  _DECODER_BUF_START = 0x8f6000,
Calibrating delay loop... 119.19 BogoMIPS (lpj=595968)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.23.
cfg80211: Calling CRDA to update world regulatory domain
Switching to clocksource w55fa92-timer1
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
register clock device
w55fa92_edma_init
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 89
io scheduler noop registered (default)
---w55fa92fb_init ----w55fa92 frame buffer init 
###########w55fa92 frame buffer probe############
1*** fbi->fb->fix.smem_len = 0x70800
check_var(var=c3c9b020, info=c3c9b000)
w55fa92fb_set_par !!! ================= 
var->width = 0x140 !!!
var->bits_per_pixel = 0x10 !!!
w55fa92fb_set_par !!! ================= 
var->width = 0x140 !!!
var->bits_per_pixel = 0x10 !!!
Console: switching to colour frame buffer device 40x30
w55fa92 LCD driver has been installed successfully
paq 1=0x33cc55aa
w55fa92_gpio_configure()-1,13
w55fa92_gpio_configure()-1,14
paq 2:0xffffffff
w55fa92 paq5406_module initialized successfully!
w55fa92 SysMgr driver has been initialized successfully!
fa92 vpe register char device Successful!
w55fa92 VPE driver has been initialized successfully!
W55FA92 uart driver has been initialized successfully!
w55fa92_serial_init(c04965e4,c0496630)
w55fa92_serial_probe(c048b748, c0496630) 0
w55fa92_serial_probe: initialising port c0496640...
w55fa92_serial_init_port: port=c0496654, platdev=c048b748
w55fa92_serial_probe: adding port
w55fa92-uart0: ttyS0 at MMIO 0xb8008000 (irq = 14) is a W55FA92
w55fa92_serial_probe(c048b800, c0496630) 1
w55fa92_serial_probe: initialising port c04966e4...
w55fa92_serial_init_port: port=c04966f8, platdev=c048b800
w55fa92_serial_probe: adding port
w55fa92-uart1: ttyS1 at MMIO 0xb8008100 (irq = 30) is a W55FA92
brd: module loaded
loop: module loaded
w55fa92_avc_init
fa92 AVC Decoder Supported
FAVC Decoder IRQ mode(33)v1.0
fa92 AVC Encoder Supported
FAVC Encoder IRQ mode(34)v1.0
H264 Driver Version v1.0
### W55FA92 ether driver v0.1 has been initialized successfully!
rtl8150: v0.6.2 (2004/08/27):rtl8150 based usb-ethernet driver
usbcore: registered new interface driver rtl8150
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
USBH2.0 Clock source is UPLL, divider is 5
Over-current is Disabled - REG_OpModEn = 0x00000000
w55fa92-ehci w55fa92-ehci: Nuvoton w55fa92 EHCI Host Controller
w55fa92-ehci w55fa92-ehci: new USB bus registered, assigned bus number 1
w55fa92-ehci w55fa92-ehci: irq 21, io mem 0xb100b000
w55fa92-ehci w55fa92-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
USB device plug in
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci_hcd_w55fa92_drv_probe
usb_hcd_w55fa92_probe
w55fa92-ohci w55fa92-ohci: Nuvoton W55FA92 OHCI Host Controller
w55fa92-ohci w55fa92-ohci: new USB bus registered, assigned bus number 2
w55fa92-ohci w55fa92-ohci: irq 22, io mem 0xb1005000
ohci_w55fa92_start
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
USB device plug in
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
w55fa92_udc_probe 20140401
w55fa92-rtc w55fa92-rtc: rtc core: registered w55fa92-rtc as rtc0
<USBD - USBD plug>
Check RTC Level Shift Status
-> Level Shift is enabled!
RTC Access Enable Check
RTC Access Eanble Fail. AER:0xA965.
RTC Access Eanble Fail. AER:0xA965.
RTC Access Eanble Fail. AER:0xA965.
RTC Access Eanble Fail. AER:0xA965.

有碰到该问题的吗?帮忙分析下原因。

离线

#2 2018-03-14 21:04:06

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,838

Re: N32926 RTC初始化失败

稍等,这个问题我以前解决过, 我帮你找找记录。

方便把你的 RTC部分电路图传上来吗?
发图片的方法: https://whycan.cn/t_588.html

离线

#3 2018-03-14 21:39:11

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,838

Re: N32926 RTC初始化失败

参考链接1: N3292x-RTC-application.pdf
参考链接2: N3292x Design Guide_A1.pdf

简单一点,
你参考第6页,

将N32926的RTC_WAKE接地,然后在boot里面将RTC_HW_PCLR_EN bit置0.

看问题是否解决, 然后我们进一步深入讨论。

离线

#4 2018-03-15 08:42:35

tom
会员
注册时间: 2018-03-14
累计积分: 107

Re: N32926 RTC初始化失败

电路倒是没有什么特别的。芯片是直接上电的,没有使用RTC_RPWR管脚来控制电源。  RTC_RWAKE管脚我是直接接地了,官方RTC应用文档是用10K电阻接地,或者是使用三极管给一个下拉的脉冲。

晕哥说的“在boot里面将RTC_HW_PCLR_EN bit置0” 是指在spi/nand的 启动代码里面增加吗?

离线

#5 2018-03-15 09:16:23

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,838

Re: N32926 RTC初始化失败

是的,在bootloader里面设置这个寄存器位为零。

离线

#6 2018-03-24 16:45:56

tom
会员
注册时间: 2018-03-14
累计积分: 107

Re: N32926 RTC初始化失败

重新在nuvoton的FTP上下载了一个spi bootloader,现在问题这个问题解决了。初步看了下loader代码,里面确实有晕哥提到的RTC_HW_PCLR_EN 的问题。

由于电路板硬件将RTC_RWAKE直接接地了,而该pin在芯片内部有50k的上拉,因此,该pin会消耗电流,这导致RTC电池不是很耐用。。。  现在这个问题还真是头疼了

离线

#7 2018-03-24 17:25:00

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,838

Re: N32926 RTC初始化失败

对,因为这个漏电电流的设计缺陷,得打补丁。
可以用pcf8563这种i2c时钟芯片解决此问题,多一块多钱人民币。

离线

#8 2020-01-10 14:54:41

小光光
会员
注册时间: 2020-01-10
累计积分: 1

Re: N32926 RTC初始化失败

晕哥,我最近也遇到了N32926 RTC初始化失败的问题,926不带系统裸奔,我时钟电路是按照RTC应用电路(三)设计的,在loader里将HW_PCLR_EN置0了,此前在loader中通过IO送给RTC_WKUP一个低脉冲,但是在执行RTC初始化时,设定寄存器的值再去读发现没有改变,这会是什么原因呢?请教您

离线

#9 2020-01-10 15:56:26

tom
会员
注册时间: 2018-03-14
累计积分: 107

Re: N32926 RTC初始化失败

先查一查,寄存器是不是可访问?  RTC访问前需要设置使能

离线

页脚