[AR-300M] U-Boot serial access settings for version 20220216

Hi!

I have the following problem: I’m unable to communicate to U-Boot through serial.

My u-boot-env is the following:

root@OpenWrt:~# fw_printenv                                                                                             
lf=if ping $serverip; then tftp 0x80060000 $firmware_name && erase $firmware_addr +$filesize && cp.b $fileaddr $firmware
_addr $filesize; if nand bad; then run dlf; fi; else echo ping $serverip failed; fi                                     
rlf=if ping $serverip; then tftp $loadaddr $firmware_name && erase $firmware_addr +$filesize && cp.b $fileaddr $firmware
_addr $filesize && echo OK!; else echo ERROR! Server not reachable!; fi                                                 
dlf=if ping 192.168.1.2; then echo ok; elif ping 192.168.1.2; then echo ok; elif ping 192.168.1.2; then echo ok; elif ec
ho ping 192.168.1.2; then echo ok; elif echo ping 192.168.1.2; then echo ok; else echo ping finally failed; fi; tftp 0x8
1000000 openwrt-gl-ar300m.img && nand erase && nand write $fileaddr 0 $filesize                                         
firmware_addr=0x9f050000                                                                                                
firmware_name=openwrt-gl-ar300m.bin                                                                                     
lu=if ping $serverip; then tftp $loadaddr $uboot_name && erase $uboot_addr +$uboot_size && cp.b $fileaddr $uboot_addr $f
ilesize && echo OK!; else echo ERROR! Server not reachable!; fi                                                         
lc=tftp 0x80100000 config.bin && cp.b 0x9fff0000 0x81000000 0xffff && cp.b 0x80100000 0x81000000 0x40 && cp.b 0x80100000
 0x81001002 0x06 && erase 0x9fff0000 +0xffff && cp.b 0x81000000 0x9fff0000 0xffff                                       
uboot_addr=0x9f000000                                                                                                   
uboot_size=0x00050000                                                                                                   
uboot_name=uboot-gl-ar300m.bin                                                                                          
bootlimit=3                                                                                                             
bootargs=board=ar300m console=ttyS0,115200  ubi.mtd=5,2048 root=/dev/mtdblock8 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot
-env),128k(reserved),64k(art);spi0.1:2m(kernel),20m(rootfs),106m(data),22m@0x0(firmware) rootfstype=squashfs,jffs2 noini
trd                                                                                                                     
bootcmd=nboot 0x81000000 0 0                                                                                            
bootdelay=2                                                                                                             
baudrate=115200                                                                                                         
ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee                                                                                   
ipaddr=192.168.1.1                                                                                                      
serverip=192.168.1.2                                                                                                    
loadaddr=0x80800000                                                                                                     
stdin=serial                                                                                                            
stdout=serial                                                                                                           
stderr=serial                                                                                                           
ethact=eth1                                                                                                             
bootcount=4                                      

I use 115200 8N1 for minicom but it still doesn’t work, as seen below. (SNIPPED the middle.)

root@OpenWrt:~# dmesg |head
[    0.000000] Linux version 5.10.176 (builder@buildhost) (mips-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20123-38ccc4
7687) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Sun Apr 9 12:27:46 2023
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] MIPS: machine is GL.iNet GL-AR300M (NOR)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
root@OpenWrt:~# reboot 
root@OpenWrt:~# [  197.280372] br-lan: port 1(eth0) entered disabled state
[  197.302254] device eth0 left promiscuous mode
[  197.306846] br-lan: port 1(eth0) entered disabled state
[  197.322368] eth0: link down
[  201.891174] reboot: Restarting system
�a�U���ѠL)�˖a�󊒵KVK�y�i��A��&ʱ*Q���ʩ�H��j 깕y�� �                       "I��'�
                                                                               �.�
   b Y+j   ���(ʀ����*���S��էJ��C���ꅺ���ͥ������7��A�J�I�'�I����������:���E���0�,����ݲ�xSʔ�e�+҂�Ұ����0�'�V٩W+џ��٩)ʵJ
�e�+��j���ݱ��������+A���N���D��鬲�鳚�A�)��tX�����҂�Ұ�ڦ'��,'�5�� XV������u���U�������ڱ��Y'����jų�a�����H�� (Vj   ��E�   �
�K�I��!��C�Ӧ��ݠ����gL����,ikA��Ѡ���5   �Ŭ��d������0�"���LV�� �e�!e�.˕�LSJ� ��,�+����t�����r��P�                         
  ��iW����n�͠Z                         �           �a��˵�+�o.                                              ���hz��dZ�   �
�e                                                             �c�                                                      
                                                                  ���Ґ�R�����=����*9�����YW����=��*                     
                                                                                                       �,� ��7�y�
gY            �*�����xLʑ�a��      ¸2e�                                                                                 �
���0����-ꂰI0�
�*��Z�����A��A��K�o�������)����Kգz٦�F�                                  %��

<SNIP>

�գ��A���ɽ�Y,2�.�n���̈B�����J���Y
                                       Ѻ��eƪ�0�j
                                                  ����KŮJ��V�� ��
                                                                                           ��O�ٗ"�n]u�)�����(.V�eV��
���0���S        ʠ����:�J��C!�R+�����'���
                                            �LZ�� )��e �a�A�K�Š��Კ�դ�� �"�ѡ���'��&�³� (ѕsꂀ�)��H� �b�Ť                ��
� ��0.0�000�] L��ux��er��on��.1��17��(b��lde�@bu�ldh��t)��mi��-o��nw��-l��ux��us��gcc�(Op�nWr��GC��11��.0��20��3-��cc��7
�  ��.0��00�� C��0 ��vi��on �s: �001��74��MI�� 2��c)����  ��.0��000� MI�S: ��ch��e �� G��iN�� G��AR��0M��NOR���] ��ab��d
[��  ��000�00]�SoC��Qu��co�� A��er�� Q��95�� v�� 2 �ev �
[�   ��00��00��In��rd��ot��ou�� or�emp�y -��is��li�� i��tr��
                                                              ��.0��00�� P��ma�� i��tru�tio� ca��e ��kB��VI��, ��wa�� l�
�es��e 3� by�es.��[  � 0.�000��] ��im��y ��ta��ac�� 3��B,��-wa�, V�PT,��ac�� a��as��, ��ne��ze��2 ��tes�
                                                                                                        [��  ��00��00��Z
o�� ra�ges�
[ �� 0��00��0]�� N��mal�  [�em ��00��00��00��00��-0��00��00��7ff�fff�
[��  ��00��00��Mo��bl��zo�� st�rt �or ��ch��od��
                                                [��  ��00��00��Ea��y m�mor� no�� r��ge��
                                                                                        [ �� 0��00��0]�� n��e ��0:��me��
���  ��.0��00�� In�tme� se��p ��de�� [��m ��00��00��00��000�-0x�000��00��ff��ff��
                                                                                 [��  ��00��00��Bu��t ��zon�lis�s, ��bi�
�ty��ro��in��on�� T��al��age�: 3�480��[  � 0.�000��] ��rn�� c��ma�� l��e:��on��le=�tyS�,11��00�� r��tf��yp��sq��sh��,jf�
�[ �� 0��00��0]��en��y ��ch��has� ta�le ��tr��s:��63�� (��de�� 4��65��6 b�tes� li��ar��
                                                                                       [��  ��00��00��In��e-��che�has� t
���   �.00�000��me��au��-i��t:��ta��:o��, ��ap �llo�:of�� h��p ��ee��ff��[�   �.00��00��Me��ry��12��12��13��72��ava�lab�
e (��81��ke��el��od�� 6��K ��dat�, 7�8K ��da��, ��44��in��, ��4K��ss��105�0K �ese��ed��0K��ma��es��ve��                 
[  � 0.��00��] ��UB��HW��ig��32��Or��r=0�3, �inO��ec��=0��CP��=1��No��s=��                                              
�[��  ��00��10��sc��d_��ock� 32�bit� at��25��z,��es��ut��n ��s,��rap� ev�ry ��07��15��ns��[ �  0�008��4]��al��ra��ng��el
�  ��.0��92�� p��_m��: d�fau�t: ��76��mi��mu�� 3��                                                                      
�  ��0.��99��] ��un��cac�e h�sh ��bl��en��ie�� 1��4 ��rd��: 0� 40�6 b��es��li��ar��                                     
                                                                                   [ �� 0.�876�6] ��un��oi��-c��he��as��
ta��e ��tri�s: �024��or��r:��, ��96��yt��, ��nea�)                                                                      
�[�   �.11��97��fu��x ��sh��ab�� e��rie�: 2�6 (��de�� -�� 3��2 ��te�� l��ea��� m��_i��e_��: ��11��044�275�000�ns        
[�   ��12��93��pi��tr��co��: ��iti�liz�d p��ct�� s��sy��em����  ��.1��44�� NE�: R�gis��re��pr��oc�� f��il��16��[��  ��14
��65��the�mal�sys��Re��st��ed��he��al��ov��no��'st�p_w�se'��[��  ��20��22��cl��kso�rce� Sw��ch�� t��cl��ks��rc��MI��    
�[ �� 0��28��3]��cp��ist�n_p�rta�dr_��sh��as��ta��e ��tr��s:��12 �ord�r: �� 4��6 ��te�� l��ea��                         
��  ��0.��54��] T�P b�nd ��sh��ab�� e��ri��: ��24��ord�r: �, 4��6 ��te�� l��ea��ine�r)                                  
  �0.2�292�� T��: ��sh��ab��s ��nf��ur�� (e�tab�ish�� 1��4 ��nd��02��                                                   
[ �� 0��597�6] �DP ��sh��ab�� e��ri��: ��6 ��rde�: 0� 40�� b��es��li��ar��                                              
                                                                            �0.2��74�� U��-L��e ��sh��ab�� en�rie�: 2�� 
(��de�� 0��40�� b��es��li��ar)�                                                                                         
�[ �� 0��79��7]��CI:�CLS�0 b��es��de��ul��32��[ �� 0��90��2]��ork�ngs�t: ��me��am��bi��=1��ma��or��r=�� bu�ket�ord��=1��
  �0.3��79�� s��as��s:��er��on��.0��200�/01�31)��hi��ip��ou��er��[�   ��30��20��jf��2:��er��on��.2��NAN�) (�UMM��Y)��LZ�
�[ �� 0.�385�2] ��io��xp��t ��io��xp��t:�� gp�o(s� ex�ort��ize�72�lo��ed��ma��r ��2)                                    
��  ��.3��949� Se�ial��82��/1��50��ri��r,��6 ��rts� IR� sh�rin��en��le��                                                
                                                                        [ �� 0��54��5]��ri��k:��on��le ty�0] ��sa��ed��[
 �� 0��58��8]��80��00��ua��: ��yS0�at �MIO��x1��20��0 ��rq�� 9��ba��_ba�d =�156��00��is�� 1��50��                       
                                                                                                 [    0.367956] printk: 
console [ttyS0] enabled                                                                                                 
[    0.367956] printk: console [ttyS0] enabled                                                                          
[    0.377015] printk: bootconsole [early0] disabled                                                                    
[    0.377015] printk: bootconsole [early0] disabled                                                                    
[    0.406522] spi-nand spi0.1: GigaDevice SPI NAND was found.                                                          
[    0.412382] spi-nand spi0.1: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 128                            
[    0.423832] 2 fixed-partitions partitions found on MTD device (null)                                                 
[    0.430411] Creating 2 MTD partitions on "(null)":                                                                   
[    0.435442] 0x000000000000-0x000000400000 : "nand_kernel"                                                            
[    0.447611] 0x000000400000-0x000008000000 : "nand_ubi"                                                               
[    0.626510] spi-nor spi0.0: mx25l12805d (16384 Kbytes)                                                               
[    0.631891] 4 fixed-partitions partitions found on MTD device spi0.0                                                 
[    0.638553] OF: Bad cell count for /ahb/spi@1f000000/flash@0/partitions                                              
[    0.645438] OF: Bad cell count for /ahb/spi@1f000000/flash@0/partitions                                              
[    0.652804] OF: Bad cell count for /ahb/spi@1f000000/flash@0/partitions                                              
[    0.659658] OF: Bad cell count for /ahb/spi@1f000000/flash@0/partitions                                              
[    0.667225] Creating 4 MTD partitions on "spi0.0":                                                                   
[    0.672246] 0x000000000000-0x000000040000 : "u-boot"                                                                 
[    0.681103] 0x000000040000-0x000000050000 : "u-boot-env"                                                             
[    0.687751] 0x000000050000-0x000000ff0000 : "firmware"                                                               
[    0.696151] 2 uimage-fw partitions found on MTD device firmware                                                      
[    0.702349] Creating 2 MTD partitions on "firmware":                                                                 
[    0.707482] 0x000000000000-0x000000260000 : "kernel"                                                                 
[    0.714636] 0x000000260000-0x000000fa0000 : "rootfs"                                                                 
[    0.720786] mtd: setting mtd6 (rootfs) as root device                                                                
[    0.727058] 1 squashfs-split partitions found on MTD device rootfs                                                   
[    0.733535] 0x0000006d0000-0x000000fa0000 : "rootfs_data"                                                            
[    0.741114] 0x000000ff0000-0x000001000000 : "art"                                                                    
[    1.103018] ag71xx 19000000.eth: Could not connect to PHY device. Deferring probe.                                   
[    1.795019] switch0: Atheros AR8229 rev. 1 switch registered on mdio.0                                               
[    1.853943] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]                   
[    1.863930] eth0: Atheros AG71xx at 0xba000000, irq 5, mode: gmii                                                    
[    1.872752] NET: Registered protocol family 10                                                                       
[    1.886165] Segment Routing with IPv6                                                                                
[    1.890076] NET: Registered protocol family 17                                                                       
[    1.894827] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_
netfilter if you need this.                                                                                             
[    1.908228] 8021q: 802.1Q VLAN Support v1.8                                                                          
[    1.917910] PCI host bridge /ahb/pcie-controller@180c0000 ranges:                                                    
[    1.924310]  MEM 0x0000000010000000..0x0000000013ffffff                                                              
[    1.929713]   IO 0x0000000000000000..0x0000000000000000                                                              
[    1.935324] PCI host bridge to bus 0000:00                                                                           
[    1.939569] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]                                           
[    1.946712] pci_bus 0000:00: root bus resource [io  0x0000]                                                          
[    1.952486] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]                                            
[    1.959495] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]                               
[    1.967753] pci 0000:00:00.0: [168c:0050] type 00 class 0x028000                                                     
[    1.974010] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x001fffff 64bit]                                            
[    1.981069] pci 0000:00:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]                                             
[    1.988075] pci 0000:00:00.0: supports D1                                                                            
[    1.992232] pci 0000:00:00.0: PME# supported from D0 D1 D3hot                                                        
[    1.999284] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00                                              
[    2.006185] pci 0000:00:00.0: BAR 0: assigned [mem 0x10000000-0x101fffff 64bit]                                      
[    2.013775] pci 0000:00:00.0: BAR 6: assigned [mem 0x10200000-0x1020ffff pref]                                       
[    2.366274] ag71xx 19000000.eth: connected to PHY at mdio.0:1f:04 [uid=004dd042, driver=Generic PHY]                 
[    2.376722] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode: mii                                                     
[    2.395045] VFS: Mounted root (squashfs filesystem) readonly on device 31:6.                                         
[    2.410023] Freeing unused kernel memory: 1244K                                                                      
[    2.414747] This architecture does not have kernel memory protection.                                                
[    2.421411] Run /sbin/init as init process                                                                           
[    3.215978] init: Console is alive                                                                                   
[    3.220043] init: - watchdog -                                                                                       
[    4.757622] kmodloader: loading kernel modules from /etc/modules-boot.d/*                                            
[    4.899061] usbcore: registered new interface driver usbfs                                                           
[    4.904907] usbcore: registered new interface driver hub                                                             
[    4.910484] usbcore: registered new device driver usb                                                                
[    4.927434] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver                                               
[    4.937706] fsl-ehci: Freescale EHCI Host controller driver                                                          
[    4.945377] ehci-platform: EHCI generic platform driver                                                              
[    4.951221] ehci-platform 1b000000.usb: EHCI Host Controller                                                         
[    4.957169] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1                                
[    4.965419] ehci-platform 1b000000.usb: irq 3, io mem 0x1b000000                                                     
[    4.991978] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00                                                   
[    4.999333] hub 1-0:1.0: USB hub found                                                                               
[    5.006487] hub 1-0:1.0: 1 port detected                                                                             
[    5.014624] kmodloader: done loading kernel modules from /etc/modules-boot.d/*                                       
[    5.034500] init: - preinit -                                                                                        
[    6.734826] random: jshn: uninitialized urandom read (4 bytes read)                                                  
[    6.944946] random: jshn: uninitialized urandom read (4 bytes read)                                                  
[    7.001781] random: jshn: uninitialized urandom read (4 bytes read)                                                  
[    7.298453] eth0: link up (1000Mbps/Full duplex)                                                                     
[    7.311670] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready                                                  
Press the [f] key and hit [enter] to enter failsafe mode                                                                
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level                                            
[   11.777438] jffs2: notice: (455) jffs2_build_xattr_subsystem: complete building xattr subsystem, 75 of xdatum (9 unch
ecked, 64 orphan) and 88 of xref (38 dead, 36 orphan) found.                                                            
[   11.796211] mount_root: switching to jffs2 overlay                                                                   
[   11.806549] overlayfs: upper fs does not support tmpfile.                                                            
[   11.819340] urandom-seed: Seeding with /etc/urandom.seed                                                             
[   12.093555] eth0: link down                                                                                          
[   12.111106] procd: - early -                                                                                         
[   12.114897] procd: - watchdog -                                                                                      
[   12.896489] procd: - watchdog -                                                                                      
[   12.900389] procd: - ubus -                                                                                          
[   13.028090] random: ubusd: uninitialized urandom read (4 bytes read)                                                 
[   13.037931] random: ubusd: uninitialized urandom read (4 bytes read)                                                 
[   13.052134] random: ubusd: uninitialized urandom read (4 bytes read)                                                 
[   13.066924] procd: - init -                                                                                          
Please press Enter to activate this console.                                                                            
[   14.241714] random: jshn: uninitialized urandom read (4 bytes read)                                                  
[   14.390344] random: ubusd: uninitialized urandom read (4 bytes read)                                                 
[   14.412221] random: ubus: uninitialized urandom read (4 bytes read)                                                  
[   14.534090] kmodloader: loading kernel modules from /etc/modules.d/*                                                 
[   15.087653] urngd: v1.0.2 started.                                                                                   
[   15.158745] Loading modules backported from Linux version v5.15.92-0-ge515b9902f5f                                   
[   15.166638] Backport generated by backports.git v5.15.92-1-0-gdfe0f60c                                               
[   15.631321] PPP generic driver version 2.4.2                                                                         
[   15.643209] NET: Registered protocol family 24                                                                       
[   15.682464] usbcore: registered new interface driver snd-usb-audio                                                   
[   15.813641] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=13                                              
[   15.823786] random: crng init done                                                                                   
[   15.827315] random: 25 urandom warning(s) missed due to ratelimiting                                                 
[   15.934666] kmodloader: done loading kernel modules from /etc/modules.d/*                                            
[   37.256145] eth0: link up (1000Mbps/Full duplex)                                                                     
[   37.262881] br-lan: port 1(eth0) entered blocking state                                                              
[   37.268302] br-lan: port 1(eth0) entered disabled state                                                              
[   37.274162] device eth0 entered promiscuous mode                                                                     
[   37.303021] br-lan: port 1(eth0) entered blocking state                                                              
[   37.308435] br-lan: port 1(eth0) entered forwarding state                                                            
[   38.262034] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready                                                

What’s wrong with U-Boot?

Hi, I couldn’t find your version here, so I tested it with the latest stable version and I have no problems here. If your serial cable is not connected wrong, I suggest you upgrade to the latest version and try, but be aware that if you upgrade to the latest version and you don’t save the upgrade file of the existing version locally, there is no way to revert to your current version.
p.s: ar300m’s serial port and reset switch are on the same side, the closest to reset are TX, RX and GND.
my_env_info.zip (806 Bytes)

Are you talking about U-Boot version?
I use uboot-gl-ar300m-20220216-md5-97ff7bb80cbf129fa21f34ded1559ff8.bin from gl-inet/uboot-for-qca95xx.

The checksum is correct:

$ md5sum Downloads/uboot-gl-ar300m-20220216-md5-97ff7bb80cbf129fa21f34ded1559ff8.bin 
97ff7bb80cbf129fa21f34ded1559ff8  Downloads/uboot-gl-ar300m-20220216-md5-97ff7bb80cbf129fa21f34ded1559ff8.bin

Are there more recent version somewhere?

Is it relevant that my board is one of the limited edition GL-AR300M + 5G wifi?
It has GL-AR300M-V1.3.1 marked on the PCB.

Sorry, I may have misunderstood you before, if you want to communicate with uboot, then you can only use the gl command to interrupt the boot and enter before the boot, when the system boots, you can’t communicate with uboot

No, the latest version of the firmware is used, but uboot seems to be the same

Ohhh…

My dump from the opening post was done with a CH341A (clone) USB-TTL dongle.
It works nicely when the OS (in my case: official OpenWrt) boots, both the TX and RX work.

Now I tried a CP2102 (clone) USB-TTL dongle, and it workd in the other way: RX works always, I’m able to see the U-Boot output! But it’s TX doesn’t work: I’m unable to stop U-Boot at startup, but also unable to activate OpenWrt console. :see_no_evil:

@_zhang , what kind of USB-TTL dongle were you testing? And with what program? screen? minicom? And with what kind of settings?

I am using cp2102 and the program is SecureCRT.
Baud rate:115200
Data bits:8
Parity:None
Stop bit:1
No flow control setting

1 Like

Thank you for the hint!

Now I’m able to communicate to U-Boot!
I use my CP2102 to receive and the CH341A to send data … of course with two minicoms. :sweat_smile:

And now I know why it doesn’t boot the NAND image:

...
Device 0 bad blocks:
  06000000
  07fe0000
Found ART,Checking calibration status...
Device have calibrated,Checking device test status...
Device haven't tested. Please test device in calibration firmware...
...

So executing the commands below helped me too!

...
Device 0 bad blocks:
  06000000
  07fe0000
Found ART,Checking calibration status...
Device have calibrated,Checking device test status...
Device have tested,Checking MAC address...
Device have MAC address,Checking device flash status...
Device have nor and nand flash,Booting standard firmware from nand flash...
Booting image at: 0x81000000
val is 0
...