Clicky

20240310

Rotel RC-1570 bad flash recovery

Update 30-Mar-2024.

At the end of the day the problems started with a bad USB - RS-232 adapter. This adapter had a counterfeit CH340 chip, which created the initial firmware update problems. These counterfeit chips are found in cheap Chinese USB to 9p DIN adapters. Penny wise, pound foolish!

So, when the Rotel YMODEM software shows garbled output, like this, try another RS-232 adapter or maybe even a different PC to update the Rotel firmware.

Garbled output due to bad USB - RS-232 adapter.

--------------------------------------------------------------------------------------------------------------------------

This post is about fixing a Rotel RC-1570 bad flash due to a broken RS-232 interface.


Warning/disclaimer: when you start digging in the hard- and software of your device, you may easily break the device beyond repair. I do not and will not take any responsibility for this. You are on your own. 

Requirement: upgrade the firmware of the amplifier.

You *should* use the Rotel Firmware update software ("ROTEL YModem Upgrade Manager V203.exe". See link below). This Windows application is a YMODEM protocol shell to program the CPU's firmware through the RS-232 port. It tries to figure out the Rotel device type and allows to select the new firmware from disk, and program it. Comprehensive feedback is provided on the state of the upgrade.

When the Rotel Firmware software works, you are done. Nothing to see here, walk over. In case something fails, or the amplifier is dead, read on!

So, I bought a second-hand Rotel RC-1570 pre-amp. Basically, an input device selector, DAC (S/PDIF + Coax), a PC USB interface and the NE5532 opamp based pre-amplifier. 

I started to upgrade the firmware to the latest version. The firmware upgrade is done using the RS-232 9 Pin D-connector at the back of the device. You need to get a 9p D to USB adapter, which is supported by your Windows PC (drivers). When you connect the RS-232 adapter and you configure the COM port settings as 115200/8/n/1, you will see some output appear on the console program.

Problem statement:
1. The RS-232 out shows garbled characters.
2. A previous flash exercise left the device in a "dead" state.

After the failed flash the device seems dead as a dodo. No light, no display, no relay clicks, no nothing. Connecting a terminal emulator (PuTTY, Tera Term) there was garbled output shown. The garbled out still showed "readable" words.

Step 1: Diagnosing the garbled data

The garbled data with readable words is an important symptom because this means that the CPU/software/firmware was most likely working, and that we had a data transmission problem.

The RS-232 adapter is on a separate module together with other Rotel signalling:


 

The module is connected to the motherboard with connector CN207. This is the data path of the RS-232 data to the CPU of the Rotel (click to enlarge):

 

 

On the righthand side you find the RS-232 input. IC205 converts RS-232 signal voltage to 3VDC and back. The input/output signals are directly connected to the CPU (pin 68 and 69). When we use an adapter with 3VDC levels, we do not have to use the RS-232 board. 

We disconnected connector CN207 and used a spare connector/cable to connect a USB-TTL adapter.

 


The only pins we needed are 1 (RX, Rotel in, red wire), 2 (TX, Rotel out, white wire) and 3 (Ground, green wire). We connected a standard CH340E chip USB-TTL adapter to the 3 pins:

After powering up the device, all console output shown was correct. Conclusion: the RS-232 interface is broken. At this point the "ROTEL YModem Upgrade Manager V203" software should work. The Rotel can be flashed again.

However, since the Rotel software is a YMODEM shell, we took a different approach to flash the CPU.

Step 2: Flashing the firmware with YMODEM

Terminal emulator Tera Term (see links below) has build-in YMODEM support. Still having the USB-TTL adapter connected, we powered on the Rotel. The Rotel STM32 flash menu is shown:


Select "1" and watch "C" characters appear. This is the start of the YMODEM upload. In the Tera Term menu select  File -> Transfer -> YMODEM -> Send and select the Rotel firmware (here: "RA1570-V138-Ymodem.bin"). A progress bar is shown, and after completion of the upload you will see this:

After power down and power up, the Rotel came alive again! 

Since YMODEM is a relativly simple protocol, I guess that YMODEM upload, in this case with Tera Term, should work for al Rotel STM32 CPU related firmware updates. However, the use of the  "ROTEL YModem Upgrade Manager V203" software is perferred.

Links:

Rotel RC-1570:
 
STM32 CPU:
 
 
YMODEM:  

20230403

Building an FTP server: from zero to hero in less than 3 minutes

Requirement: a simple FTP server, low on energy and with cheap hardware. This is my IPcam streams- and snapshot server.

A secondhand Archer C7 is available for (less than) $10 or even for free. Check your attic or eBay for compatible hardware. Make sure you have the 12VDC/2Amp power supply. You have to figure out how to put OpenWRT on the Archer C7 (or on other compatible hardware. Note: minimum 16MB flash memory is required). There are excellent webpages ready to teach you how flash a router with  OpenWRT firmware.


TP-Link Archer C7 + USB disk

FTP server build steps:

  1. Install FTP server and disk management software;
  2. Configure the USB disk;
  3. Configure the FTP server.

Prerequisites:

  1. Put OpenWRT on the Archer C7;
  2. Make sure:
    • That the router has Internet access;
      Tip: configure the Archer C7 WiFi adapters as a WiFi Client (Network > Wireless > Scan > Join Network > WPA passphrase > Submit > Save > Save & Apply);
    • The USB disk is attached to the C7;
    •  Computer to connect to the C7, to show the OpenWRT webpages and an SSH client (e.g. putty).

This is the webpage you need to see, to get started:

All done? Here we go:

Logon to the Archer C7 (SSH client, e.g. putty) and install the software. Copy the script below and paste the next lines in your Putty session. You will see command responses.

WARNING: you WILL lose data on the USB disk, even if you do not want that. Don't blame me, you are on your own!  

#--- FTPserver20230428

sleep 1
clear

#--- Script start.

#--- Check Internet connectivity...
ping -c 4 9.9.9.9

#--- Update list of available software...
opkg update

#--- Install all software and prepare disk partition...
#--- USB support...
opkg install kmod-usb-storage kmod-usb-storage-uas usbutils
#--- Storage support...
opkg install block-mount e2fsprogs f2fs-tools kmod-fs-f2fs kmod-fs-ext4 sgdisk
#--- FTP server...
opkg install vsftpd
#--- User account management...
opkg install shadow-useradd
 
#--- Prepare harddisk/SSD/USB disk...
lsusb -t
block info | grep "/dev/sd"
sgdisk -o /dev/sda
sgdisk -N 1 /dev/sda
sgdisk -p /dev/sda
sgdisk -c 1:FTPstorage /dev/sda
sgdisk -i 1 /dev/sda

#--- Create filesystem (choose one)...
#--- USB stick/SSD...
# echo y|mkfs.f2fs /dev/sda1

#--- Harddisk...
echo y|mkfs.ext4 /dev/sda1

#--- Mount the disk automatically after reboot of the Archer C7...
block detect | uci import fstab
uci set fstab.@mount[-1].enabled="1"
uci commit fstab
uci set fstab.@global[0].check_fs="1"
uci commit fstab

#--- Mount the disk now...
block mount
mount | grep "/mnt/sda1"

#--- Create the FTP account and set the password...
useradd -r -s /bin/false -d /mnt/sda1/ftp ftpuser
passwd ftpuser -d
mkdir /mnt/sda1/ftp
chown ftpuser /mnt/sda1/ftp
ls -al /mnt/sda1

#--- Create FTP server configuration file...
echo "
background=YES
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
check_shell=NO
local_root=/mnt/sda1/ftp
session_support=NO
" > /etc/vsftpd.conf

#--- Restart the FTP server and check if the FTP server is running...
/etc/init.d/vsftpd restart
ps | grep ftp

#--- Create scheduled task to remove FTP files older than 30 days...
echo "#--- At midnight, delete files older than 30 days...
0 0 * * * find /mnt/sda1/ftp -type f -mtime +30 -exec rm -rf {} \;"| crontab -

#--- Set hostname...
uci set system.@system[0].hostname=FTPserver
uci commit
echo $(uci get system.@system[0].hostname) > /proc/sys/kernel/hostname

#--- Set FTP user password...
passwd -a sha512 ftpuser
 

That's all. It takes ~3 minutes to build this configuration.

Hardening:

  • You might need to configure the "LAN" interface to a fixed IP address on your network, so that the FTP server can be accessed by other devices on your network. Connect the Ethernet cable to port LAN1;
  • There is NO security on this FTP server. Anyone that knows the FTP client username/password can access the FTP server files. Username and password will go unencrypted over the network.We can prevent that the FTP server has Internet access: set the Default Gateway to 127.0.0.1 or a not used IP address in your home network;
  • Set a password for the root user (System > Administration);
  • Remove the WiFi client settings (Network > Wireless > Remove).

Performance: 

Upload speeds of ~10Mb/s (to a USB thumb drive) or ~19MB/s (2.5" hard disk)  are possible. 

Energy:

An Archer C7 with a USB hard disk consumes between 4.4W (in rest) and 6W (busy).

Build console output:

 To test the server, you can use Filezilla to connect to the FTP server and test upload/donwnload/delete:



 

78:5A:F1:DC:BC:7D:14:0B:C3:F5:14:8C:FB:DF:7E:FD:7F:9C:7C:F9:BA:AA:84:0C:52:48:30:01:25:38:65:FC

20230319

Create (self signed) EC keys and certificates

There are scenarios where you want to use self signed certificates for a client-server application. A typical example is when you run OpenVPN from low performance hardware. In that case Elliptic Curve key material might improve the overall performance. 

The next script produces certificates and private keys for one server and 1-n amount of clients. The script also calculates the SHA256 hash of the certificates. We need that for the project of my next post.

Script usage:

C:\Scripts\> createBridgeKeysAndCerts [client certificate count]

E.g.:

C:\Scripts\> createBridgeKeysAndCerts 3

This will produce the next files:

03/19/2023  02:19 PM               684 bridgeClient1.crt
03/19/2023  02:19 PM               312 bridgeClient1.key
03/19/2023  02:19 PM               116 bridgeClient1.sha256
03/19/2023  02:19 PM               680 bridgeClient2.crt
03/19/2023  02:19 PM               312 bridgeClient2.key
03/19/2023  02:19 PM               116 bridgeClient2.sha256
03/19/2023  02:19 PM               684 bridgeClient3.crt
03/19/2023  02:19 PM               312 bridgeClient3.key
03/19/2023  02:19 PM               116 bridgeClient3.sha256
03/19/2023  02:19 PM               680 bridgeServer.crt
03/19/2023  02:19 PM               312 bridgeServer.key
03/19/2023  02:19 PM               116 bridgeServer.sha256

This the script:

@echo off
goto :BEGIN

    Script: createBridgeKeysAndCerts.bat
    Version: 1.0
    Date: 18-Mar-2023
    Prerequisite: OpenSSL (https://slproweb.com/download/Win64OpenSSL_Light-3_1_0.msi)

:BEGIN
cls
cd /D "%~dp0"

echo *** OpenVPN Bridge config builder...

set openssl="C:\Program Files\OpenSSL-Win64\bin\openssl.exe"
if not exist %openssl% goto :EOF

set clientCertCount=1
if %1.==. goto :START
    echo %1| findstr /r "^[1-9][0-9]*$">nul
    if %errorlevel% equ 0 set clientCertCount=%1
:START

setlocal EnableDelayedExpansion
pushd .

md .\keys >nul 2>nul
cd .\keys

REM --- Generate bridgeServer and bridgeClient keys and certs...
echo.
echo *** bridgeServer cert + key...
%openssl% ecparam -out secp384r1.pem -name secp384r1
%openssl% req -x509 -newkey ec:secp384r1.pem -keyout bridgeServer.key -out bridgeServer.crt -nodes -sha256 -days 3650 -subj "/CN=bridgeServer" >nul 2>nul
%openssl% x509 -fingerprint -sha256 -in bridgeServer.crt -noout > bridgeServer.sha256
certutil -f -decode bridgeServer.crt bridgeServer.cer >nul

echo.
echo *** bridgeClient certs + keys...
for /l %%i in (1,1,%clientCertCount%) do (

    echo *** Processing client %%i...
    %openssl% req -x509 -newkey ec:secp384r1.pem -keyout bridgeClient%%i.key -out bridgeClient%%i.crt -nodes -sha256 -days 3650 -subj "/CN=bridgeClient%%i" >nul 2>nul
    %openssl% x509 -fingerprint -sha256 -in bridgeClient%%i.crt -noout > bridgeClient%%i.sha256
REM --- When a binary certificate (CER) is required, uncomment next line...
REM    certutil -f -decode bridgeClient%%i.crt bridgeClient%%i.cer >nul
   
)


del /q secp384r1.pem >nul 2>nul
echo.
echo *** Keys and certs created:
dir /s | find "bridge"

REM --- Calculate and display SHA256 hash of cert(s)...
echo.
for /f "tokens=2* delims==" %%i in ('%openssl% x509 -fingerprint -sha256 -in bridgeServer.crt -noout') do set hash=%%i
echo *** bridgeServer hash : %hash%
echo.
for /l %%i in (1,1,%clientCertCount%) do (

    for /f "tokens=2* delims==" %%i in ('%openssl% x509 -fingerprint -sha256 -in bridgeClient%%i.crt -noout') do set hash=%%i
    echo *** bridgeClient%%i hash: !hash!

)

setlocal DisableDelayedExpansion
popd


Real Time Web Analytics