schonmann.eu

Arduino jako převodník USB > TTL UART

Měl jsem potřebu připojit se konzolí na OrangePI Zero a zrovna jsem tu co jsem si nedávno objednal z Aliexpresu neměl po ruce. Napadlo mě ale že by to šlo udělat přes Arduino. Shodou okolností těch mám hned několik 🙂 Po chvíli pátrání jak na to jsem dohledal že stačí propojit na Arduinu pin RST a GND viz schéma níže anebo nahrát do Arduina následující kód. S tímhle kódem není třeba propojovat RST-GND

void setup(){
pinMode(0,INPUT);   
pinMode(1,INPUT); 
} 
void loop(){ 
}  

Zapojení kabelů pro první variantu se zapojením RST-GND

Pak už stačí v systému najít kde máte sériovou linku.

Připojení na sériovou linku pak realizuji pomocí screen

A už to jede !

U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:35:15 +0200)
DRAM: 512 MiB
Trying to boot from MMC1


U-Boot 2020.04-armbian (Sep 02 2020 - 10:35:15 +0200) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi Zero
DRAM:  512 MiB
MMC:   mmc@1c0f000: 0, mmc@1c10000: 1
Loading Environment from FAT... Unable to use mmc 0:1... In:    serial
Out:   serial
Err:   serial
Net:   phy interface0
eth0: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1b400: USB OHCI 1.0
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1b400 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 1 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Autoboot in 1 seconds, press  to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
3798 bytes read in 6 ms (618.2 KiB/s)
## Executing script at 43100000
U-boot loaded from SD
Boot script loaded from mmc
230 bytes read in 5 ms (44.9 KiB/s)
9886259 bytes read in 752 ms (12.5 MiB/s)
7793848 bytes read in 592 ms (12.6 MiB/s)
Found mainline kernel configuration
32515 bytes read in 15 ms (2.1 MiB/s)
504 bytes read in 13 ms (37.1 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost2.dtbo
504 bytes read in 13 ms (37.1 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost3.dtbo
4185 bytes read in 14 ms (291 KiB/s)
Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)
## Executing script at 44000000
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    9886195 Bytes = 9.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
EHCI failed to shut down host controller.
   Loading Ramdisk to 49692000, end 49fff9f3 ... OK
   Loading Device Tree to 49621000, end 49691fff ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Loading, please wait...
Starting version 241
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... Scanning for Btrfs filesystems
done.
Begin: Will now check root file system ... fsck from util-linux 2.33.1
[/sbin/fsck.ext4 (1) -- /dev/mmcblk0p1] fsck.ext4 -a -C0 /dev/mmcblk0p1 
/dev/mmcblk0p1: clean, 76566/216224 files, 507448/919552 blocks
done.
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.

Welcome to Armbian 20.08.5 Buster!

[  OK  ] Listening on Journal Audit Socket.
[  OK  ] Listening on udev Control Socket.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Reached target System Time Synchronized.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Reached target Swap.
[  OK  ] Created slice system-serial\x2dgetty.slice.
[  OK  ] Listening on Journal Socket.
         Starting Restore / save the current clock...
         Starting Create list of re…odes for the current kernel...
         Starting Set the console keyboard layout...
         Mounting Kernel Debug File System...
         Starting Load Kernel Modules...
         Mounting POSIX Message Queue File System...
         Mounting RPC Pipe File System...
[  OK  ] Started Dispatch Password …ts to Console Directory Watch.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[  OK  ] Started Forward Password R…uests to Wall Directory Watch.
[  OK  ] Reached target Paths.
[  OK  ] Listening on Syslog Socket.
[  OK  ] Listening on udev Kernel Socket.
         Starting udev Coldplug all Devices...
[  OK  ] Reached target Slices.
[  OK  ] Set up automount Arbitrary…s File System Automount Point.
[  OK  ] Listening on RPCbind Server Activation Socket.
[  OK  ] Listening on fsck to fsckd communication Socket.
         Starting Remount Root and Kernel File Systems...
[  OK  ] Created slice system-getty.slice.
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Started Restore / save the current clock.
[  OK  ] Started Create list of req… nodes for the current kernel.
[  OK  ] Mounted Kernel Debug File System.
[  OK  ] Started Load Kernel Modules.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted RPC Pipe File System.
         Mounting FUSE Control File System...
         Starting Apply Kernel Variables...
         Mounting Kernel Configuration File System...
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Mounted Kernel Configuration File System.
         Starting Load/Save Random Seed...
         Starting Create System Users...
[  OK  ] Started Set the console keyboard layout.
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started Create System Users.
         Starting Create Static Device Nodes in /dev...
[  OK  ] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /tmp...
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Mounted /tmp.
[  OK  ] Reached target Local File Systems.
         Starting Clean up any mess left by 0dns-up...
         Starting Set console font and keymap...
         Starting Preprocess NFS configuration...
         Starting Armbian ZRAM config...
         Starting Helper to synchronize boot up for ifupdown...
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started Set console font and keymap.
[  OK  ] Started Preprocess NFS configuration.
[  OK  ] Started Helper to synchronize boot up for ifupdown.
[  OK  ] Started Clean up any mess left by 0dns-up.
[  OK  ] Found device /dev/ttyGS0.
         Starting Nameserver information manager...
[  OK  ] Reached target NFS client services.
[  OK  ] Started Nameserver information manager.
         Starting Raise network interfaces...
[  OK  ] Found device /dev/ttyS0.
[  OK  ] Started Raise network interfaces.
[  OK  ] Started Armbian ZRAM config.
         Starting Armbian memory supported logging...
[  OK  ] Started Armbian memory supported logging.
         Starting Journal Service...
[  OK  ] Started Journal Service.
         Starting Flush Journal to Persistent Storage...
[  OK  ] Started Flush Journal to Persistent Storage.
         Starting Create Volatile Files and Directories...
[  OK  ] Started Create Volatile Files and Directories.
         Starting RPC bind portmap service...
[  OK  ] Started Entropy daemon using the HAVEGE algorithm.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started RPC bind portmap service.
[  OK  ] Reached target RPC Port Mapper.
[  OK  ] Reached target Remote File Systems (Pre).
[  OK  ] Reached target Remote File Systems.
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Started Daily man-db regeneration.
[  OK  ] Started Daily apt download activities.
         Starting Armbian hardware optimization...
[  OK  ] Started Daily rotation of log files.
         Starting Armbian hardware monitoring...
[  OK  ] Started Daily apt upgrade and clean activities.
[  OK  ] Reached target Timers.
[  OK  ] Started Armbian hardware optimization.
[  OK  ] Started Armbian hardware monitoring.
[  OK  ] Reached target Basic System.
         Starting System Logging Service...
         Starting Resets System Activity Data Collector...
[  OK  ] Started Regular background program processing daemon.
         Starting LSB: start and stop cpufreqd...
         Starting Restore /etc/reso… the ppp link was shut down...
         Starting Initialize hardware monitoring sensors...
[  OK  ] Started D-Bus System Message Bus.
         Starting Network Manager...
         Starting LSB: Load kernel …d to enable cpufreq scaling...
         Starting Login Service...
         Starting WPA supplicant...
[  OK  ] Started System Logging Service.
[  OK  ] Started Resets System Activity Data Collector.
[  OK  ] Started Restore /etc/resol…re the ppp link was shut down.
[  OK  ] Started Initialize hardware monitoring sensors.
[  OK  ] Started Login Service.
[  OK  ] Started LSB: start and stop cpufreqd.
[  OK  ] Started WPA supplicant.
[  OK  ] Started LSB: Load kernel m…ded to enable cpufreq scaling.
         Starting LSB: set CPUFreq kernel parameters...
[  OK  ] Started LSB: set CPUFreq kernel parameters.
         Starting LSB: Set sysfs variables from /etc/sysfs.conf...
[  OK  ] Started Network Manager.
         Starting Hostname Service...
         Starting Network Manager Wait Online...
[  OK  ] Reached target Network.
[  OK  ] Started Unattended Upgrades Shutdown.
         Starting Network Time Service...
         Starting Permit User Sessions...
         Starting The Apache HTTP Server...
         Starting OpenBSD Secure Shell server...
[  OK  ] Started LSB: Set sysfs variables from /etc/sysfs.conf.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Hostname Service.
[  OK  ] Started Network Time Service.
[  OK  ] Started uptime record daemon.
         Starting Network Manager Script Dispatcher Service...
[  OK  ] Listening on Load/Save RF …itch Status /dev/rfkill Watch.
[  OK  ] Started OpenBSD Secure Shell server.
[  OK  ] Started Network Manager Script Dispatcher Service.
[  OK  ] Started The Apache HTTP Server.
         Starting Authorization Manager...
[  OK  ] Started Authorization Manager.
[  OK  ] Started Network Manager Wait Online.
[  OK  ] Reached target Network is Online.
         Starting LSB: Advanced IEEE 802.11 management daemon...
         Starting LSB: Start or sto…tency logging system daemon...
         Starting LSB: exim Mail Transport Agent...
         Starting /etc/rc.local Compatibility...
         Starting Daily apt download activities...
[  OK  ] Started LSB: Advanced IEEE 802.11 management daemon.
[  OK  ] Started /etc/rc.local Compatibility.
[  OK  ] Started LSB: Start or stop…latency logging system daemon.
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Started Serial Getty on ttyGS0.
[  OK  ] Started Getty on tty1.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started Daily apt download activities.
[  OK  ] Started LSB: exim Mail Transport Agent.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

Armbian 20.08.5 Buster ttyS0 

orangepi0 login:
Exit mobile version